From 4347f4859bfd0a7e766da6e999b35f262e904650 Mon Sep 17 00:00:00 2001 From: Benjamin Ifland Date: Sun, 17 Mar 2019 21:44:47 +0100 Subject: [PATCH] Log DB --- API/API/API.csproj | 7 + API/API/Database/DataContext.cs | 6 +- .../201903172028249_Log.Designer.cs | 29 ++++ API/API/Migrations/201903172028249_Log.cs | 27 ++++ API/API/Migrations/201903172028249_Log.resx | 126 ++++++++++++++++++ API/API/Migrations/Configuration.cs | 2 +- API/Models/API.Models.csproj | 1 + API/Models/Log.cs | 10 ++ 8 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 API/API/Migrations/201903172028249_Log.Designer.cs create mode 100644 API/API/Migrations/201903172028249_Log.cs create mode 100644 API/API/Migrations/201903172028249_Log.resx create mode 100644 API/Models/Log.cs diff --git a/API/API/API.csproj b/API/API/API.csproj index a8dedba..d2aff1a 100644 --- a/API/API/API.csproj +++ b/API/API/API.csproj @@ -141,6 +141,10 @@ 201903172015115_SongNumber.cs + + + 201903172028249_Log.cs + @@ -174,6 +178,9 @@ 201903172015115_SongNumber.cs + + 201903172028249_Log.cs + 10.0 diff --git a/API/API/Database/DataContext.cs b/API/API/Database/DataContext.cs index 61d21dc..6b961cf 100644 --- a/API/API/Database/DataContext.cs +++ b/API/API/Database/DataContext.cs @@ -1,14 +1,18 @@ using API.Models; +using API.Migrations; using System.Data.Entity; namespace API.Database { public class DataContext : DbContext { - public DataContext() : base("DataContext") { } + public DataContext() : base("DataContext") { + System.Data.Entity.Database.SetInitializer(new MigrateDatabaseToLatestVersion()); + } public DbSet Songs { get; set; } public DbSet Changes { get; set; } public DbSet Files { get; set; } public DbSet Users { get; set; } + public DbSet Logs { get; set; } } } \ No newline at end of file diff --git a/API/API/Migrations/201903172028249_Log.Designer.cs b/API/API/Migrations/201903172028249_Log.Designer.cs new file mode 100644 index 0000000..0c17eab --- /dev/null +++ b/API/API/Migrations/201903172028249_Log.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 Log : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(Log)); + + string IMigrationMetadata.Id + { + get { return "201903172028249_Log"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/API/API/Migrations/201903172028249_Log.cs b/API/API/Migrations/201903172028249_Log.cs new file mode 100644 index 0000000..47786bd --- /dev/null +++ b/API/API/Migrations/201903172028249_Log.cs @@ -0,0 +1,27 @@ +namespace API.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class Log : DbMigration + { + public override void Up() + { + CreateTable( + "dbo.Logs", + c => new + { + ID = c.Long(nullable: false, identity: true), + Date = c.DateTime(nullable: false), + Method = c.String(), + }) + .PrimaryKey(t => t.ID); + + } + + public override void Down() + { + DropTable("dbo.Logs"); + } + } +} diff --git a/API/API/Migrations/201903172028249_Log.resx b/API/API/Migrations/201903172028249_Log.resx new file mode 100644 index 0000000..5185fc1 --- /dev/null +++ b/API/API/Migrations/201903172028249_Log.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 + + + H4sIAAAAAAAEAO1cW2/kNBR+R+I/RHkC1G3aLkJQzYDKbLsasd1Wne7C28pN3BmLxJmNnaoV4pfxwE/iL+BLLr5l4syNslohrVrH57PPxcfnHJ/yz19/j356zNLgARYE5XgcHh8ehQHEcZ4gPB+HJb1/8X34049ffjE6T7LH4H097yWf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HHr1Uwn8fyxqHqkrPK+FOcwMdx+IcgOw2mv32oKA+Cq4JZ7mlwFPw5dPHmVA9evKL0X3xYW+0nY7FGi6thKt2CnpJ3GH0smbBvmSiHa1Zted3IPmX4vgUgo3V1IyytPXVvMtXbVfu9z7A21U/G5J0to6WQPBKY98jZOO+lp8F9YRvZmdlOukWdWyWa/7PKt3Kr6h2dA/Q2rGvzkxG63kHZc3E/nzOl9lNuBGT2TG4EpvRFbsid0vtouAvfiGyYx3F5LaX/8Q6t67LW6xxqqzaDWnsCu4VhrY6j6vLhf3bJMk5CC5ZzWrWr6wLhGC1Bqu7ZTrd9HAEXXwNnfnkFlxDz463z5bPSinpSg2p4pD7Wd9E9tWm71L413VGH/y81vaKEtHVNu/vH7IaQjicRvarQ3SAmyy4sFLjjrlA6nq42HFf3WGfzmAvY3dDk6ivrbCtzwVaNaP0dZ10NZy5Q2aDm0YrW2YnmQnX2SO2wSU1VUdts0d+T5mjLel6NaFbn2c6ZGtBqZldBmSNQ/lcGzAcRNG8heF0Xw1hzAc2cKb7Pa1dk7KieYkfngIX24KxgCRyIKfvMs2HxFyRVP/I5i0eTKb4q6bKkjGWY3aXacxn3aKvWF/10+p5HV0vxJxfbYIFtE/Hs5Ar/XKI0afZ94YiJOiC4q6xCeK5LykP5+VODJLvqfYAq8TUenseNKQMjV3gGlL+OGLA3dgrfwDmIn+pidjdIvyJ0sY9eITAvQEYqjJae/cpsOMkef/wXjipkDtFDAAA= + + + dbo + + \ No newline at end of file diff --git a/API/API/Migrations/Configuration.cs b/API/API/Migrations/Configuration.cs index 6e5dc5f..75dc8d3 100644 --- a/API/API/Migrations/Configuration.cs +++ b/API/API/Migrations/Configuration.cs @@ -3,7 +3,7 @@ namespace API.Migrations { internal sealed class Configuration : DbMigrationsConfiguration { public Configuration() { - AutomaticMigrationsEnabled = false; + AutomaticMigrationsEnabled = true; } } } diff --git a/API/Models/API.Models.csproj b/API/Models/API.Models.csproj index 5c1d010..ee35db4 100644 --- a/API/Models/API.Models.csproj +++ b/API/Models/API.Models.csproj @@ -52,6 +52,7 @@ + diff --git a/API/Models/Log.cs b/API/Models/Log.cs new file mode 100644 index 0000000..5408900 --- /dev/null +++ b/API/Models/Log.cs @@ -0,0 +1,10 @@ +using System; + +namespace API.Models { + public class Log { + public long ID { get; set; } + public DateTime Date { get; set; } + public string Method { get; set; } + + } +} \ No newline at end of file