Added Migrations rather than a manual DB Script #865

This commit is contained in:
Jamie.Rees 2017-07-03 14:44:08 +01:00
parent 77f9e90c0e
commit b69b322bd5
13 changed files with 1206 additions and 433 deletions

View file

@ -1,5 +1,4 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Ombi.Helpers;
@ -16,20 +15,7 @@ namespace Ombi.Store.Context
if (_created) return;
_created = true;
Database.EnsureCreated();
Database.Migrate();
#if DEBUG
var location = System.Reflection.Assembly.GetEntryAssembly().Location;
var directory = System.IO.Path.GetDirectoryName(location);
var file = File.ReadAllText(Path.Combine(directory,"SqlTables.sql"));
#else
var file = File.ReadAllText("SqlTables.sql");
#endif
// Run Script
Database.ExecuteSqlCommand(file, 0);
// Add the notifcation templates
AddAllTemplates();