diff --git a/API/API/API.csproj b/API/API/API.csproj index 8f49a25..a8dedba 100644 --- a/API/API/API.csproj +++ b/API/API/API.csproj @@ -137,6 +137,10 @@ 201903161558469_Init.cs + + + 201903172015115_SongNumber.cs + @@ -167,6 +171,9 @@ 201903161558469_Init.cs + + 201903172015115_SongNumber.cs + 10.0 diff --git a/API/API/Migrations/201903172015115_SongNumber.Designer.cs b/API/API/Migrations/201903172015115_SongNumber.Designer.cs new file mode 100644 index 0000000..834680d --- /dev/null +++ b/API/API/Migrations/201903172015115_SongNumber.Designer.cs @@ -0,0 +1,29 @@ +// +namespace API.Migrations +{ + using System.CodeDom.Compiler; + using System.Data.Entity.Migrations; + using System.Data.Entity.Migrations.Infrastructure; + using System.Resources; + + [GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")] + public sealed partial class SongNumber : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(SongNumber)); + + string IMigrationMetadata.Id + { + get { return "201903172015115_SongNumber"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/API/API/Migrations/201903172015115_SongNumber.cs b/API/API/Migrations/201903172015115_SongNumber.cs new file mode 100644 index 0000000..98c9eb6 --- /dev/null +++ b/API/API/Migrations/201903172015115_SongNumber.cs @@ -0,0 +1,62 @@ +namespace API.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class SongNumber : DbMigration + { + public override void Up() + { + DropForeignKey("dbo.Changes", "UserId", "dbo.Users"); + DropForeignKey("dbo.Changes", "Song_ID", "dbo.Songs"); + DropIndex("dbo.Changes", new[] { "UserId" }); + DropIndex("dbo.Changes", new[] { "Song_ID" }); + DropPrimaryKey("dbo.Changes"); + DropPrimaryKey("dbo.Users"); + DropPrimaryKey("dbo.Files"); + DropPrimaryKey("dbo.Songs"); + AddColumn("dbo.Changes", "User_ID", c => c.Long()); + AddColumn("dbo.Songs", "Number", c => c.Int(nullable: false)); + AlterColumn("dbo.Changes", "ID", c => c.Long(nullable: false, identity: true)); + AlterColumn("dbo.Changes", "Song_ID", c => c.Long()); + AlterColumn("dbo.Users", "ID", c => c.Long(nullable: false, identity: true)); + AlterColumn("dbo.Files", "ID", c => c.Long(nullable: false, identity: true)); + AlterColumn("dbo.Songs", "ID", c => c.Long(nullable: false, identity: true)); + AddPrimaryKey("dbo.Changes", "ID"); + AddPrimaryKey("dbo.Users", "ID"); + AddPrimaryKey("dbo.Files", "ID"); + AddPrimaryKey("dbo.Songs", "ID"); + CreateIndex("dbo.Changes", "User_ID"); + CreateIndex("dbo.Changes", "Song_ID"); + AddForeignKey("dbo.Changes", "User_ID", "dbo.Users", "ID"); + AddForeignKey("dbo.Changes", "Song_ID", "dbo.Songs", "ID"); + } + + public override void Down() + { + DropForeignKey("dbo.Changes", "Song_ID", "dbo.Songs"); + DropForeignKey("dbo.Changes", "User_ID", "dbo.Users"); + DropIndex("dbo.Changes", new[] { "Song_ID" }); + DropIndex("dbo.Changes", new[] { "User_ID" }); + DropPrimaryKey("dbo.Songs"); + DropPrimaryKey("dbo.Files"); + DropPrimaryKey("dbo.Users"); + DropPrimaryKey("dbo.Changes"); + AlterColumn("dbo.Songs", "ID", c => c.Int(nullable: false, identity: true)); + AlterColumn("dbo.Files", "ID", c => c.Int(nullable: false, identity: true)); + AlterColumn("dbo.Users", "ID", c => c.Int(nullable: false, identity: true)); + AlterColumn("dbo.Changes", "Song_ID", c => c.Int()); + AlterColumn("dbo.Changes", "ID", c => c.Int(nullable: false, identity: true)); + DropColumn("dbo.Songs", "Number"); + DropColumn("dbo.Changes", "User_ID"); + AddPrimaryKey("dbo.Songs", "ID"); + AddPrimaryKey("dbo.Files", "ID"); + AddPrimaryKey("dbo.Users", "ID"); + AddPrimaryKey("dbo.Changes", "ID"); + CreateIndex("dbo.Changes", "Song_ID"); + CreateIndex("dbo.Changes", "UserId"); + AddForeignKey("dbo.Changes", "Song_ID", "dbo.Songs", "ID"); + AddForeignKey("dbo.Changes", "UserId", "dbo.Users", "ID", cascadeDelete: true); + } + } +} diff --git a/API/API/Migrations/201903172015115_SongNumber.resx b/API/API/Migrations/201903172015115_SongNumber.resx new file mode 100644 index 0000000..a034201 --- /dev/null +++ b/API/API/Migrations/201903172015115_SongNumber.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + H4sIAAAAAAAEAO0bXW/bNvB9wP6DoKdtyKIkHYYtsFtkblIYW5ogTtu9FYzEOMQkyhWpIMGwX7aH/aT9hR1FieKXbMmOvWwoChTJiTzeN++Ol7///Gv06iFLg3tcMJLTcXi4fxAGmMZ5Quh8HJb89tsfwlcvv/xidJpkD8H7Zt0LsQ52UjYO7zhfHEcRi+9whth+RuIiZ/kt34/zLEJJHh0dHPwYHR5GGFCEgCsIRlcl5STD1S/w6ySnMV7wEqXneYJTVsPhy6zCGrxFGWYLFONxeHI53X+NOLpBDIfBSUoQ0DDD6W0YIEpzjjhQePyO4RkvcjqfLQCA0uvHBYZ1tygVuyrKj9vlfZk4OBJMRO3GBlVcMp5nAxEevqilEtnb15JtqKQGcjsF+fJHwXUlu3E4uUN0DqzbRx1P0kIsk4KV4t+Xi/cC+eue0juYh/i3F0zKlJcFHlNc8gKle8FleZOS+Gf8eJ3/humYlmmq0wMUwTcDAKDLIl/ggj9e4duayunrMIjMfZG9UW3T9kgOppR//10YvIXD0U2Klbo1bmc8L/AbTHGBOE4uEee4AG1NE1wJzDndOgvMqpgm2nkvjjznLccBxosbDOLna3CEwUgmeZYByQ0esHVw2DA4Rw+/YDrnd+MQfgyDM/KAkwZSI35HCfg3bOJF6Z7zFt2TeSUrD+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TRTdZ578pQOFCGt1ui10yUXaPX9UmOQwbh9EtfhUNBY5XgrI2AWdIW2oegBt4IW/4DmKH5smaDeS1YowxT56TdC8QBmrcbT74Vew4SR7ePkPqKvixAU+AAA= + + + dbo + + \ No newline at end of file diff --git a/API/Models/API.Models.csproj b/API/Models/API.Models.csproj index d944b0b..5c1d010 100644 --- a/API/Models/API.Models.csproj +++ b/API/Models/API.Models.csproj @@ -31,7 +31,14 @@ 4 + + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + @@ -50,5 +57,9 @@ + + + + \ No newline at end of file diff --git a/API/Models/App.config b/API/Models/App.config new file mode 100644 index 0000000..2fb423e --- /dev/null +++ b/API/Models/App.config @@ -0,0 +1,13 @@ + + + + +
+ + + + + + + + \ No newline at end of file diff --git a/API/Models/Change.cs b/API/Models/Change.cs index 2aec3da..7569746 100644 --- a/API/Models/Change.cs +++ b/API/Models/Change.cs @@ -2,7 +2,7 @@ namespace API.Models { public class Change { - public int ID { get; set; } + public long ID { get; set; } public int UserId { get; set; } public User User { get; set; } public DateTime Date { get; set; } diff --git a/API/Models/File.cs b/API/Models/File.cs index 97c8e08..5b5a496 100644 --- a/API/Models/File.cs +++ b/API/Models/File.cs @@ -1,8 +1,10 @@ using System; +using System.ComponentModel.DataAnnotations.Schema; namespace API.Models { public class File { - public int ID { get; set; } + public long ID { get; set; } + [Index(IsUnique = true)] public Guid ReferenceFile { get; set; } public string Name { get; set; } public FileType FileType { get; set; } diff --git a/API/Models/Song.cs b/API/Models/Song.cs index 0c9fc34..d00b50d 100644 --- a/API/Models/Song.cs +++ b/API/Models/Song.cs @@ -1,8 +1,11 @@ using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; namespace API.Models { public class Song { - public int ID { get; set; } + public long ID { get; set; } + [Index(IsUnique = true)] + public int Number { get; set; } public string Name { get; set; } public string Text { get; set; } public string Comments { get; set; } diff --git a/API/Models/User.cs b/API/Models/User.cs index d7ab2f2..81d083a 100644 --- a/API/Models/User.cs +++ b/API/Models/User.cs @@ -1,10 +1,14 @@ -namespace API.Models { +using System.ComponentModel.DataAnnotations.Schema; + +namespace API.Models { public class User { - public int ID { get; set; } + public long ID { get; set; } + [Index(IsUnique = true)] public string Account { get; set; } public string Pass { get; set; } public string Name { get; set; } public string Surname { get; set; } + [Index(IsUnique = true)] public string Email { get; set; } public Access Access { get; set; } } diff --git a/API/Models/packages.config b/API/Models/packages.config new file mode 100644 index 0000000..02a4d9b --- /dev/null +++ b/API/Models/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file