mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 12:32:31 +01:00
simplified migrations.
This commit is contained in:
parent
4be637edff
commit
a0560da33d
@ -0,0 +1,14 @@
|
|||||||
|
using FluentMigrator.Builders.Create;
|
||||||
|
using FluentMigrator.Builders.Create.Table;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration.Framework
|
||||||
|
{
|
||||||
|
public static class MigrationExtension
|
||||||
|
{
|
||||||
|
public static ICreateTableColumnOptionOrWithColumnSyntax TableForModel(this ICreateExpressionRoot expressionRoot, string name)
|
||||||
|
{
|
||||||
|
return expressionRoot.Table(name).WithColumn("Id").AsInt32().PrimaryKey().Identity();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -9,29 +9,50 @@ public class Migration20130324 : NzbDroneMigrationBase
|
|||||||
{
|
{
|
||||||
protected override void MainDbUpgrade()
|
protected override void MainDbUpgrade()
|
||||||
{
|
{
|
||||||
Create.Table("Config")
|
Create.TableForModel("Config")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("Key").AsString().Unique()
|
||||||
.WithColumn("Key").AsString().PrimaryKey()
|
.WithColumn("Value").AsString();
|
||||||
.WithColumn("Value").AsString().NotNullable();
|
|
||||||
|
|
||||||
Create.Table("EpisodeFiles")
|
Create.TableForModel("RootFolders")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("Path").AsString().Unique();
|
||||||
.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")
|
Create.TableForModel("Series")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("TvdbId").AsInt32().Unique()
|
||||||
.WithColumn("TvDbEpisodeId").AsInt32().Nullable()
|
.WithColumn("TvRageId").AsInt32().Unique()
|
||||||
.WithColumn("SeriesId").AsInt32().NotNullable()
|
.WithColumn("ImdbId").AsString().Unique()
|
||||||
.WithColumn("SeasonNumber").AsInt32().NotNullable()
|
.WithColumn("Title").AsString()
|
||||||
.WithColumn("EpisodeNumber").AsInt32().NotNullable()
|
.WithColumn("TitleSlug").AsString().Unique()
|
||||||
|
.WithColumn("CleanTitle").AsString()
|
||||||
|
.WithColumn("Status").AsInt32()
|
||||||
|
.WithColumn("Overview").AsString().Nullable()
|
||||||
|
.WithColumn("AirTime").AsString().Nullable()
|
||||||
|
.WithColumn("Images").AsString()
|
||||||
|
.WithColumn("Path").AsString().Unique()
|
||||||
|
.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("UtcOffSet").AsInt32()
|
||||||
|
.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("Title").AsString().Nullable()
|
||||||
.WithColumn("Overview").AsString().Nullable()
|
.WithColumn("Overview").AsString().Nullable()
|
||||||
.WithColumn("Ignored").AsBoolean().Nullable()
|
.WithColumn("Ignored").AsBoolean().Nullable()
|
||||||
@ -44,122 +65,81 @@ protected override void MainDbUpgrade()
|
|||||||
.WithColumn("SceneSeasonNumber").AsInt32().Nullable()
|
.WithColumn("SceneSeasonNumber").AsInt32().Nullable()
|
||||||
.WithColumn("SceneEpisodeNumber").AsInt32().Nullable();
|
.WithColumn("SceneEpisodeNumber").AsInt32().Nullable();
|
||||||
|
|
||||||
Create.Table("ExternalNotificationDefinitions")
|
Create.TableForModel("EpisodeFiles")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("SeriesId").AsInt32()
|
||||||
.WithColumn("Enable").AsBoolean().NotNullable()
|
.WithColumn("Path").AsString().Unique()
|
||||||
.WithColumn("Type").AsString().NotNullable()
|
.WithColumn("Quality").AsInt32()
|
||||||
.WithColumn("Name").AsString().NotNullable();
|
.WithColumn("Proper").AsBoolean()
|
||||||
|
.WithColumn("Size").AsInt64()
|
||||||
|
.WithColumn("DateAdded").AsDateTime()
|
||||||
|
.WithColumn("SeasonNumber").AsInt32()
|
||||||
|
.WithColumn("SceneName").AsString().Nullable()
|
||||||
|
.WithColumn("ReleaseGroup").AsString().Nullable();
|
||||||
|
|
||||||
Create.Table("History")
|
Create.TableForModel("History")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("EpisodeId").AsInt32()
|
||||||
.WithColumn("EpisodeId").AsInt32().NotNullable()
|
.WithColumn("SeriesId").AsInt32()
|
||||||
.WithColumn("SeriesId").AsInt32().NotNullable()
|
.WithColumn("NzbTitle").AsString()
|
||||||
.WithColumn("NzbTitle").AsString().NotNullable()
|
.WithColumn("Date").AsDateTime()
|
||||||
.WithColumn("Date").AsDateTime().NotNullable()
|
.WithColumn("Quality").AsString()
|
||||||
.WithColumn("Quality").AsString().NotNullable()
|
.WithColumn("Indexer").AsString()
|
||||||
.WithColumn("Indexer").AsString().NotNullable()
|
|
||||||
.WithColumn("NzbInfoUrl").AsString().Nullable()
|
.WithColumn("NzbInfoUrl").AsString().Nullable()
|
||||||
.WithColumn("ReleaseGroup").AsString().Nullable();
|
.WithColumn("ReleaseGroup").AsString().Nullable();
|
||||||
|
|
||||||
Create.Table("IndexerDefinitions")
|
Create.TableForModel("ExternalNotificationDefinitions")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("Enable").AsBoolean()
|
||||||
.WithColumn("Enable").AsBoolean().NotNullable()
|
.WithColumn("Type").AsString().Unique()
|
||||||
.WithColumn("Type").AsString().NotNullable()
|
.WithColumn("Name").AsString().Unique();
|
||||||
.WithColumn("Name").AsString().NotNullable();
|
|
||||||
|
|
||||||
Create.Table("JobDefinitions")
|
Create.TableForModel("JobDefinitions")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("Enable").AsBoolean()
|
||||||
.WithColumn("Enable").AsBoolean().NotNullable()
|
.WithColumn("Type").AsString().Unique()
|
||||||
.WithColumn("Type").AsString().NotNullable()
|
.WithColumn("Name").AsString().Unique()
|
||||||
.WithColumn("Name").AsString().NotNullable()
|
.WithColumn("Interval").AsInt32()
|
||||||
.WithColumn("Interval").AsInt32().NotNullable()
|
.WithColumn("LastExecution").AsDateTime()
|
||||||
.WithColumn("LastExecution").AsDateTime().NotNullable()
|
.WithColumn("Success").AsBoolean();
|
||||||
.WithColumn("Success").AsBoolean().NotNullable();
|
|
||||||
|
|
||||||
Create.Table("NewznabDefinitions")
|
Create.TableForModel("IndexerDefinitions")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("Enable").AsBoolean()
|
||||||
.WithColumn("Enable").AsBoolean().NotNullable()
|
.WithColumn("Type").AsString().Unique()
|
||||||
.WithColumn("Name").AsString().NotNullable()
|
.WithColumn("Name").AsString().Unique();
|
||||||
.WithColumn("Url").AsString().NotNullable()
|
|
||||||
|
Create.TableForModel("NewznabDefinitions")
|
||||||
|
.WithColumn("Enable").AsBoolean()
|
||||||
|
.WithColumn("Name").AsString().Unique()
|
||||||
|
.WithColumn("Url").AsString()
|
||||||
.WithColumn("ApiKey").AsString().Nullable()
|
.WithColumn("ApiKey").AsString().Nullable()
|
||||||
.WithColumn("BuiltIn").AsBoolean().NotNullable();
|
.WithColumn("BuiltIn").AsBoolean();
|
||||||
|
|
||||||
Create.Table("QualityProfiles")
|
Create.TableForModel("QualityProfiles")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("Name").AsString().Unique()
|
||||||
.WithColumn("Name").AsString().NotNullable()
|
.WithColumn("Cutoff").AsInt32()
|
||||||
.WithColumn("Cutoff").AsInt32().NotNullable()
|
.WithColumn("Allowed").AsString();
|
||||||
.WithColumn("Allowed").AsString().NotNullable();
|
|
||||||
|
|
||||||
Create.Table("QualitySizes")
|
Create.TableForModel("QualitySizes")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("QualityId").AsInt32().Unique()
|
||||||
.WithColumn("QualityId").AsInt32().NotNullable().Unique()
|
.WithColumn("Name").AsString().Unique()
|
||||||
.WithColumn("Name").AsString().NotNullable()
|
.WithColumn("MinSize").AsInt32()
|
||||||
.WithColumn("MinSize").AsInt32().NotNullable()
|
.WithColumn("MaxSize").AsInt32();
|
||||||
.WithColumn("MaxSize").AsInt32().NotNullable();
|
|
||||||
|
|
||||||
Create.Table("RootFolders")
|
Create.TableForModel("SceneMappings")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("CleanTitle").AsString()
|
||||||
.WithColumn("Path").AsString().NotNullable();
|
.WithColumn("SceneName").AsString()
|
||||||
|
.WithColumn("TvdbId").AsInt32()
|
||||||
|
.WithColumn("SeasonNumber").AsInt32();
|
||||||
|
|
||||||
Create.Table("SceneMappings")
|
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
|
||||||
.WithColumn("CleanTitle").AsString().NotNullable()
|
|
||||||
.WithColumn("SceneName").AsString().NotNullable()
|
|
||||||
.WithColumn("TvdbId").AsInt32().NotNullable()
|
|
||||||
.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("TitleSlug").AsString().NotNullable()
|
|
||||||
.WithColumn("CleanTitle").AsString().NotNullable()
|
|
||||||
.WithColumn("Status").AsInt32().NotNullable()
|
|
||||||
.WithColumn("Overview").AsString().Nullable()
|
|
||||||
.WithColumn("AirTime").AsString().Nullable()
|
|
||||||
.WithColumn("Images").AsString()
|
|
||||||
.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().Nullable()
|
|
||||||
.WithColumn("CustomStartDate").AsDateTime().Nullable()
|
|
||||||
.WithColumn("UseSceneNumbering").AsBoolean().NotNullable()
|
|
||||||
.WithColumn("TvRageId").AsInt32().Nullable()
|
|
||||||
.WithColumn("TvRageTitle").AsString().Nullable()
|
|
||||||
.WithColumn("UtcOffSet").AsInt32().NotNullable()
|
|
||||||
.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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogDbUpgrade()
|
protected override void LogDbUpgrade()
|
||||||
{
|
{
|
||||||
Create.Table("Logs")
|
Create.TableForModel("Logs")
|
||||||
.WithColumn("Id").AsInt32().PrimaryKey().Identity()
|
.WithColumn("Message").AsString()
|
||||||
.WithColumn("Message").AsString().NotNullable()
|
.WithColumn("Time").AsDateTime()
|
||||||
.WithColumn("Time").AsDateTime().NotNullable()
|
.WithColumn("Logger").AsString()
|
||||||
.WithColumn("Logger").AsString().NotNullable()
|
|
||||||
.WithColumn("Method").AsString().Nullable()
|
.WithColumn("Method").AsString().Nullable()
|
||||||
.WithColumn("Exception").AsString().Nullable()
|
.WithColumn("Exception").AsString().Nullable()
|
||||||
.WithColumn("ExceptionType").AsString().Nullable()
|
.WithColumn("ExceptionType").AsString().Nullable()
|
||||||
.WithColumn("Level").AsString().NotNullable();
|
.WithColumn("Level").AsString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,7 @@
|
|||||||
<Compile Include="Datastore\LazyList.cs" />
|
<Compile Include="Datastore\LazyList.cs" />
|
||||||
<Compile Include="Datastore\MappingExtensions.cs" />
|
<Compile Include="Datastore\MappingExtensions.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationOptions.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationOptions.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\NlogAnnouncer.cs" />
|
<Compile Include="Datastore\Migration\Framework\NlogAnnouncer.cs" />
|
||||||
<Compile Include="Datastore\Migration\Migration20130324.cs" />
|
<Compile Include="Datastore\Migration\Migration20130324.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user