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("")]
|
|
|
|
|
[Migration(20130324)]
|
2013-03-25 06:13:53 +00:00
|
|
|
|
public class Migration20130324 : NzbDroneMigrationBase
|
2013-03-25 04:36:24 +00:00
|
|
|
|
{
|
|
|
|
|
protected override void MainDbUpgrade()
|
|
|
|
|
{
|
|
|
|
|
Create.Table("Config")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("Key").AsString().PrimaryKey()
|
|
|
|
|
.WithColumn("Value").AsString().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("EpisodeFiles")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("SeriesId").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Path").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Quality").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Proper").AsBoolean().NotNullable()
|
|
|
|
|
.WithColumn("Size").AsInt64().NotNullable()
|
|
|
|
|
.WithColumn("DateAdded").AsDateTime().NotNullable()
|
|
|
|
|
.WithColumn("SeasonNumber").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("SceneName").AsString().Nullable()
|
|
|
|
|
.WithColumn("ReleaseGroup").AsString().Nullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("Episodes")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
2013-03-26 05:51:56 +00:00
|
|
|
|
.WithColumn("TvDbEpisodeId").AsInt32().Nullable()
|
2013-03-25 04:36:24 +00:00
|
|
|
|
.WithColumn("SeriesId").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("SeasonNumber").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("EpisodeNumber").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Title").AsString().Nullable()
|
|
|
|
|
.WithColumn("Overview").AsString().Nullable()
|
|
|
|
|
.WithColumn("Ignored").AsBoolean().Nullable()
|
|
|
|
|
.WithColumn("EpisodeFileId").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("AirDate").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("GrabDate").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("PostDownloadStatus").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("AbsoluteEpisodeNumber").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("SceneAbsoluteEpisodeNumber").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("SceneSeasonNumber").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("SceneEpisodeNumber").AsInt32().Nullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("ExternalNotificationDefinitions")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("Enable").AsBoolean().NotNullable()
|
|
|
|
|
.WithColumn("Type").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Name").AsString().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("History")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("EpisodeId").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("SeriesId").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("NzbTitle").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Date").AsDateTime().NotNullable()
|
2013-03-26 05:51:56 +00:00
|
|
|
|
.WithColumn("Quality").AsString().NotNullable()
|
2013-03-25 04:36:24 +00:00
|
|
|
|
.WithColumn("Indexer").AsString().NotNullable()
|
|
|
|
|
.WithColumn("NzbInfoUrl").AsString().Nullable()
|
|
|
|
|
.WithColumn("ReleaseGroup").AsString().Nullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("IndexerDefinitions")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("Enable").AsBoolean().NotNullable()
|
|
|
|
|
.WithColumn("Type").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Name").AsString().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("JobDefinitions")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("Enable").AsBoolean().NotNullable()
|
|
|
|
|
.WithColumn("Type").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Name").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Interval").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("LastExecution").AsDateTime().NotNullable()
|
|
|
|
|
.WithColumn("Success").AsBoolean().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("NewznabDefinitions")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("Enable").AsBoolean().NotNullable()
|
|
|
|
|
.WithColumn("Name").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Url").AsString().NotNullable()
|
|
|
|
|
.WithColumn("ApiKey").AsString().Nullable()
|
|
|
|
|
.WithColumn("BuiltIn").AsBoolean().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("QualityProfiles")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("Name").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Cutoff").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Allowed").AsString().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("QualitySizes")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("QualityId").AsInt32().NotNullable().Unique()
|
|
|
|
|
.WithColumn("Name").AsString().NotNullable()
|
|
|
|
|
.WithColumn("MinSize").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("MaxSize").AsInt32().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("RootFolders")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("Path").AsString().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("SceneMappings")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("CleanTitle").AsString().NotNullable()
|
|
|
|
|
.WithColumn("SceneName").AsString().NotNullable()
|
2013-03-26 08:02:31 +00:00
|
|
|
|
.WithColumn("TvdbId").AsInt32().NotNullable()
|
2013-03-25 04:36:24 +00:00
|
|
|
|
.WithColumn("SeasonNumber").AsInt32().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("Seasons")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("SeriesId").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("SeasonNumber").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Ignored").AsBoolean().NotNullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("Series")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("TvdbId").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Title").AsString().NotNullable()
|
|
|
|
|
.WithColumn("CleanTitle").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Status").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Overview").AsString().NotNullable()
|
|
|
|
|
.WithColumn("AirTime").AsString().Nullable()
|
|
|
|
|
.WithColumn("Language").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Path").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Monitored").AsBoolean().NotNullable()
|
|
|
|
|
.WithColumn("QualityProfileId").AsString().NotNullable()
|
|
|
|
|
.WithColumn("SeasonFolder").AsBoolean().NotNullable()
|
|
|
|
|
.WithColumn("LastInfoSync").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("LastDiskSync").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("Runtime").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("SeriesType").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("BacklogSetting").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Network").AsString().NotNullable()
|
|
|
|
|
.WithColumn("CustomStartDate").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("UseSceneNumbering").AsBoolean().NotNullable()
|
|
|
|
|
.WithColumn("TvRageId").AsInt32().Nullable()
|
|
|
|
|
.WithColumn("TvRageTitle").AsString().NotNullable()
|
|
|
|
|
.WithColumn("UtcOffSet").AsInt32().NotNullable()
|
2013-03-26 05:51:56 +00:00
|
|
|
|
.WithColumn("FirstAired").AsDateTime().Nullable()
|
|
|
|
|
.WithColumn("NextAiring").AsDateTime().Nullable();
|
|
|
|
|
|
|
|
|
|
Create.Table("MediaCovers")
|
|
|
|
|
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("SeriesId").AsInt32().NotNullable()
|
|
|
|
|
.WithColumn("Url").AsString().NotNullable()
|
|
|
|
|
.WithColumn("CoverType").AsInt32().NotNullable();
|
2013-03-25 04:36:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LogDbUpgrade()
|
|
|
|
|
{
|
|
|
|
|
Create.Table("Logs")
|
|
|
|
|
.WithColumn("LogId").AsInt64().PrimaryKey().Identity()
|
|
|
|
|
.WithColumn("Message").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Time").AsDateTime().NotNullable()
|
|
|
|
|
.WithColumn("Logger").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Method").AsString().NotNullable()
|
|
|
|
|
.WithColumn("Exception").AsString().Nullable()
|
|
|
|
|
.WithColumn("ExceptionType").AsString().Nullable()
|
|
|
|
|
.WithColumn("Level").AsString().NotNullable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|