2013-03-25 06:13:53 +00:00
|
|
|
|
using FluentMigrator;
|
2013-03-26 05:51:56 +00:00
|
|
|
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
2013-03-25 04:36:24 +00:00
|
|
|
|
|
2013-03-25 06:13:53 +00:00
|
|
|
|
namespace NzbDrone.Core.Datastore.Migration
|
2013-03-25 04:36:24 +00:00
|
|
|
|
{
|
|
|
|
|
[Tags("")]
|
2013-05-24 04:10:56 +00:00
|
|
|
|
[Migration(1)]
|
|
|
|
|
public class InitialSetup : NzbDroneMigrationBase
|
2013-03-25 04:36:24 +00:00
|
|
|
|
{
|
|
|
|
|
protected override void MainDbUpgrade()
|
|
|
|
|
{
|
2013-03-31 23:04:21 +00:00
|
|
|
|
Create.TableForModel("Config")
|
|
|
|
|
.WithColumn("Key").AsString().Unique()
|
|
|
|
|
.WithColumn("Value").AsString();
|
|
|
|
|
|
|
|
|
|
Create.TableForModel("RootFolders")
|
|
|
|
|
.WithColumn("Path").AsString().Unique();
|
|
|
|
|
|
|
|
|
|
Create.TableForModel("Series")
|
|
|
|
|
.WithColumn("TvdbId").AsInt32().Unique()
|
|
|
|
|
.WithColumn("TvRageId").AsInt32().Unique()
|
|
|
|
|
.WithColumn("ImdbId").AsString().Unique()
|
|
|
|
|
.WithColumn("Title").AsString()
|
|
|
|
|
.WithColumn("TitleSlug").AsString().Unique()
|
|
|
|
|
.WithColumn("CleanTitle").AsString()
|
|
|
|
|
.WithColumn("Status").AsInt32()
|
|
|
|
|
.WithColumn("Overview").AsString().Nullable()
|
|
|
|
|
.WithColumn("AirTime").AsString().Nullable()
|
|
|
|
|
.WithColumn("Images").AsString()
|
2013-05-24 04:10:56 +00:00
|
|
|
|
.WithColumn("Path").AsString()
|
2013-03-31 23:04:21 +00:00
|
|
|
|
.WithColumn("Monitored").AsBoolean()
|
|
|
|
|
.WithColumn("QualityProfileId").AsInt32()
|
|
|
|
|
.WithColumn("SeasonFolder").AsBoolean()
|
|
|
|
|
.WithColumn("LastInfoSync").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("LastDiskSync").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("Runtime").AsInt32()
|
|
|
|
|
.WithColumn("SeriesType").AsInt32()
|
|
|
|
|
.WithColumn("BacklogSetting").AsInt32()
|
|
|
|
|
.WithColumn("Network").AsString().Nullable()
|
|
|
|
|
.WithColumn("CustomStartDate").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("UseSceneNumbering").AsBoolean()
|
|
|
|
|
.WithColumn("FirstAired").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("NextAiring").AsDateTime().Nullable();
|
|
|
|
|
|
|
|
|
|
Create.TableForModel("Seasons")
|
|
|
|
|
.WithColumn("SeriesId").AsInt32()
|
|
|
|
|
.WithColumn("SeasonNumber").AsInt32()
|
|
|
|
|
.WithColumn("Ignored").AsBoolean();
|
|
|
|
|
|
|
|
|
|
Create.TableForModel("Episodes")
|
|
|
|
|
.WithColumn("TvDbEpisodeId").AsInt32().Unique()
|
|
|
|
|
.WithColumn("SeriesId").AsInt32()
|
|
|
|
|
.WithColumn("SeasonNumber").AsInt32()
|
|
|
|
|
.WithColumn("EpisodeNumber").AsInt32()
|
|
|
|
|
.WithColumn("Title").AsString().Nullable()
|
|
|
|
|
.WithColumn("Overview").AsString().Nullable()
|
|
|
|
|
.WithColumn("Ignored").AsBoolean().Nullable()
|
|
|
|
|
.WithColumn("EpisodeFileId").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("AirDate").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("AbsoluteEpisodeNumber").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("SceneAbsoluteEpisodeNumber").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("SceneSeasonNumber").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("SceneEpisodeNumber").AsInt32().Nullable();
|
|
|
|
|
|
|
|
|
|
Create.TableForModel("EpisodeFiles")
|
|
|
|
|
.WithColumn("SeriesId").AsInt32()
|
|
|
|
|
.WithColumn("Path").AsString().Unique()
|
2013-04-01 06:22:16 +00:00
|
|
|
|
.WithColumn("Quality").AsString()
|
2013-03-31 23:04:21 +00:00
|
|
|
|
.WithColumn("Size").AsInt64()
|
|
|
|
|
.WithColumn("DateAdded").AsDateTime()
|
|
|
|
|
.WithColumn("SeasonNumber").AsInt32()
|
2013-03-25 04:36:24 +00:00
|
|
|
|
.WithColumn("SceneName").AsString().Nullable()
|
|
|
|
|
.WithColumn("ReleaseGroup").AsString().Nullable();
|
|
|
|
|
|
2013-03-31 23:04:21 +00:00
|
|
|
|
Create.TableForModel("History")
|
|
|
|
|
.WithColumn("EpisodeId").AsInt32()
|
|
|
|
|
.WithColumn("SeriesId").AsInt32()
|
|
|
|
|
.WithColumn("NzbTitle").AsString()
|
|
|
|
|
.WithColumn("Date").AsDateTime()
|
|
|
|
|
.WithColumn("Quality").AsString()
|
|
|
|
|
.WithColumn("Indexer").AsString()
|
2013-03-25 04:36:24 +00:00
|
|
|
|
.WithColumn("NzbInfoUrl").AsString().Nullable()
|
|
|
|
|
.WithColumn("ReleaseGroup").AsString().Nullable();
|
|
|
|
|
|
2013-05-24 04:10:56 +00:00
|
|
|
|
Create.TableForModel("Notifications")
|
2013-05-19 23:17:32 +00:00
|
|
|
|
.WithColumn("Name").AsString()
|
|
|
|
|
.WithColumn("OnGrab").AsBoolean()
|
|
|
|
|
.WithColumn("OnDownload").AsBoolean()
|
|
|
|
|
.WithColumn("Settings").AsString()
|
|
|
|
|
.WithColumn("Implementation").AsString();
|
2013-03-31 23:04:21 +00:00
|
|
|
|
|
2013-05-09 06:38:20 +00:00
|
|
|
|
Create.TableForModel("ScheduledTasks")
|
2013-05-10 23:53:50 +00:00
|
|
|
|
.WithColumn("TypeName").AsString().Unique()
|
2013-03-31 23:04:21 +00:00
|
|
|
|
.WithColumn("Interval").AsInt32()
|
2013-05-09 06:38:20 +00:00
|
|
|
|
.WithColumn("LastExecution").AsDateTime();
|
2013-03-31 23:04:21 +00:00
|
|
|
|
|
2013-05-24 04:10:56 +00:00
|
|
|
|
Create.TableForModel("Indexers")
|
2013-03-31 23:04:21 +00:00
|
|
|
|
.WithColumn("Enable").AsBoolean()
|
2013-04-07 07:30:37 +00:00
|
|
|
|
.WithColumn("Name").AsString().Unique()
|
2013-05-02 01:59:09 +00:00
|
|
|
|
.WithColumn("Implementation").AsString()
|
2013-04-10 23:44:48 +00:00
|
|
|
|
.WithColumn("Settings").AsString().Nullable();
|
2013-03-31 23:04:21 +00:00
|
|
|
|
|
|
|
|
|
Create.TableForModel("QualityProfiles")
|
|
|
|
|
.WithColumn("Name").AsString().Unique()
|
|
|
|
|
.WithColumn("Cutoff").AsInt32()
|
|
|
|
|
.WithColumn("Allowed").AsString();
|
|
|
|
|
|
|
|
|
|
Create.TableForModel("QualitySizes")
|
|
|
|
|
.WithColumn("QualityId").AsInt32().Unique()
|
|
|
|
|
.WithColumn("Name").AsString().Unique()
|
|
|
|
|
.WithColumn("MinSize").AsInt32()
|
|
|
|
|
.WithColumn("MaxSize").AsInt32();
|
|
|
|
|
|
|
|
|
|
Create.TableForModel("SceneMappings")
|
|
|
|
|
.WithColumn("CleanTitle").AsString()
|
|
|
|
|
.WithColumn("SceneName").AsString()
|
|
|
|
|
.WithColumn("TvdbId").AsInt32()
|
|
|
|
|
.WithColumn("SeasonNumber").AsInt32();
|
|
|
|
|
|
2013-04-25 04:27:49 +00:00
|
|
|
|
|
|
|
|
|
Create.TableForModel("NamingConfig")
|
|
|
|
|
.WithColumn("UseSceneName").AsBoolean()
|
|
|
|
|
.WithColumn("Separator").AsString()
|
|
|
|
|
.WithColumn("NumberStyle").AsInt32()
|
|
|
|
|
.WithColumn("IncludeSeriesTitle").AsBoolean()
|
|
|
|
|
.WithColumn("MultiEpisodeStyle").AsInt32()
|
|
|
|
|
.WithColumn("IncludeEpisodeTitle").AsBoolean()
|
|
|
|
|
.WithColumn("IncludeQuality").AsBoolean()
|
|
|
|
|
.WithColumn("ReplaceSpaces").AsBoolean()
|
|
|
|
|
.WithColumn("SeasonFolderFormat").AsString();
|
2013-03-25 04:36:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LogDbUpgrade()
|
|
|
|
|
{
|
2013-03-31 23:04:21 +00:00
|
|
|
|
Create.TableForModel("Logs")
|
|
|
|
|
.WithColumn("Message").AsString()
|
|
|
|
|
.WithColumn("Time").AsDateTime()
|
|
|
|
|
.WithColumn("Logger").AsString()
|
2013-03-27 04:03:02 +00:00
|
|
|
|
.WithColumn("Method").AsString().Nullable()
|
2013-03-25 04:36:24 +00:00
|
|
|
|
.WithColumn("Exception").AsString().Nullable()
|
|
|
|
|
.WithColumn("ExceptionType").AsString().Nullable()
|
2013-03-31 23:04:21 +00:00
|
|
|
|
.WithColumn("Level").AsString();
|
2013-03-25 04:36:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|