Ensure new DBs match old DBs

This commit is contained in:
Qstick 2020-06-28 22:15:06 -04:00
parent f85ec3b3d6
commit 72ca3c6f18
8 changed files with 37 additions and 31 deletions

View File

@ -28,8 +28,8 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("Overview").AsString().Nullable()
.WithColumn("Images").AsString()
.WithColumn("Path").AsString().Indexed()
.WithColumn("Monitored").AsBoolean()
.WithColumn("AlbumFolder").AsBoolean()
.WithColumn("Monitored").AsInt32()
.WithColumn("AlbumFolder").AsInt32()
.WithColumn("LastInfoSync").AsDateTime().Nullable()
.WithColumn("LastDiskSync").AsDateTime().Nullable()
.WithColumn("DateFormed").AsDateTime().Nullable()
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("Overview").AsString().Nullable()
.WithColumn("Images").AsString()
.WithColumn("Path").AsString().Indexed()
.WithColumn("Monitored").AsBoolean()
.WithColumn("Monitored").AsInt32()
.WithColumn("LastInfoSync").AsDateTime().Nullable()
.WithColumn("LastDiskSync").AsDateTime().Nullable()
.WithColumn("ReleaseDate").AsDateTime().Nullable()
@ -82,11 +82,11 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("AlbumId").AsInt32()
.WithColumn("TrackNumber").AsInt32()
.WithColumn("Title").AsString().Nullable()
.WithColumn("Explicit").AsBoolean()
.WithColumn("Compilation").AsBoolean()
.WithColumn("Explicit").AsInt32()
.WithColumn("Compilation").AsInt32()
.WithColumn("DiscNumber").AsInt32().Nullable()
.WithColumn("TrackFileId").AsInt32().Nullable().Indexed()
.WithColumn("Monitored").AsBoolean()
.WithColumn("Monitored").AsInt32()
.WithColumn("Ratings").AsString().Nullable()
.WithColumn("Duration").AsInt32().WithDefaultValue(0);
@ -120,14 +120,14 @@ namespace NzbDrone.Core.Datastore.Migration
Create.TableForModel("Notifications")
.WithColumn("Name").AsString()
.WithColumn("OnGrab").AsBoolean()
.WithColumn("OnDownload").AsBoolean()
.WithColumn("OnGrab").AsInt32()
.WithColumn("OnDownload").AsInt32()
.WithColumn("Settings").AsString()
.WithColumn("Implementation").AsString()
.WithColumn("ConfigContract").AsString().Nullable()
.WithColumn("OnUpgrade").AsBoolean().Nullable()
.WithColumn("OnUpgrade").AsInt32().Nullable()
.WithColumn("Tags").AsString().Nullable()
.WithColumn("OnRename").AsBoolean().NotNullable();
.WithColumn("OnRename").AsInt32().NotNullable();
Create.TableForModel("ScheduledTasks")
.WithColumn("TypeName").AsString().Unique()
@ -139,8 +139,8 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("Implementation").AsString()
.WithColumn("Settings").AsString().Nullable()
.WithColumn("ConfigContract").AsString().Nullable()
.WithColumn("EnableRss").AsBoolean().Nullable()
.WithColumn("EnableSearch").AsBoolean().Nullable();
.WithColumn("EnableRss").AsInt32().Nullable()
.WithColumn("EnableSearch").AsInt32().Nullable();
Create.TableForModel("Profiles")
.WithColumn("Name").AsString().Unique()
@ -154,9 +154,9 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("MaxSize").AsDouble().Nullable();
Create.TableForModel("NamingConfig")
.WithColumn("ReplaceIllegalCharacters").AsBoolean().WithDefaultValue(true)
.WithColumn("ReplaceIllegalCharacters").AsInt32().WithDefaultValue(true)
.WithColumn("ArtistFolderFormat").AsString().Nullable()
.WithColumn("RenameTracks").AsBoolean().Nullable()
.WithColumn("RenameTracks").AsInt32().Nullable()
.WithColumn("StandardTrackFormat").AsString().Nullable()
.WithColumn("AlbumFolderFormat").AsString().Nullable();
@ -175,7 +175,7 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("AlbumIds").AsString().WithDefaultValue("");
Create.TableForModel("Metadata")
.WithColumn("Enable").AsBoolean().NotNullable()
.WithColumn("Enable").AsInt32().NotNullable()
.WithColumn("Name").AsString().NotNullable()
.WithColumn("Implementation").AsString().NotNullable()
.WithColumn("Settings").AsString().NotNullable()
@ -194,7 +194,7 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("Extension").AsString().NotNullable();
Create.TableForModel("DownloadClients")
.WithColumn("Enable").AsBoolean().NotNullable()
.WithColumn("Enable").AsInt32().NotNullable()
.WithColumn("Name").AsString().NotNullable()
.WithColumn("Implementation").AsString().NotNullable()
.WithColumn("Settings").AsString().NotNullable()
@ -222,8 +222,8 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("Tags").AsString().NotNullable();
Create.TableForModel("DelayProfiles")
.WithColumn("EnableUsenet").AsBoolean().NotNullable()
.WithColumn("EnableTorrent").AsBoolean().NotNullable()
.WithColumn("EnableUsenet").AsInt32().NotNullable()
.WithColumn("EnableTorrent").AsInt32().NotNullable()
.WithColumn("PreferredProtocol").AsInt32().NotNullable()
.WithColumn("UsenetDelay").AsInt32().NotNullable()
.WithColumn("TorrentDelay").AsInt32().NotNullable()

View File

@ -9,11 +9,11 @@ namespace NzbDrone.Core.Datastore.Migration
protected override void MainDbUpgrade()
{
Rename.Column("EnableSearch").OnTable("Indexers").To("EnableAutomaticSearch");
Alter.Table("Indexers").AddColumn("EnableInteractiveSearch").AsBoolean().Nullable();
Alter.Table("Indexers").AddColumn("EnableInteractiveSearch").AsInt32().Nullable();
Execute.Sql("UPDATE Indexers SET EnableInteractiveSearch = EnableAutomaticSearch");
Alter.Table("Indexers").AlterColumn("EnableInteractiveSearch").AsBoolean().NotNullable();
Alter.Table("Indexers").AlterColumn("EnableInteractiveSearch").AsInt32().NotNullable();
}
}
}

View File

@ -13,7 +13,7 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("Implementation").AsString()
.WithColumn("Settings").AsString().Nullable()
.WithColumn("ConfigContract").AsString().Nullable()
.WithColumn("EnableAutomaticAdd").AsBoolean().Nullable()
.WithColumn("EnableAutomaticAdd").AsInt32().Nullable()
.WithColumn("RootFolderPath").AsString()
.WithColumn("ShouldMonitor").AsInt32()
.WithColumn("ProfileId").AsInt32()

View File

@ -8,7 +8,7 @@ namespace NzbDrone.Core.Datastore.Migration
{
protected override void MainDbUpgrade()
{
Alter.Table("Notifications").AddColumn("OnAlbumDownload").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnAlbumDownload").AsInt32().WithDefaultValue(0);
}
}
}

View File

@ -56,7 +56,7 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("ReleaseDate").AsDateTime().Nullable()
.WithColumn("Media").AsString().Nullable()
.WithColumn("TrackCount").AsInt32().Nullable()
.WithColumn("Monitored").AsBoolean();
.WithColumn("Monitored").AsInt32();
Execute.WithConnection(PopulateReleases);
@ -64,7 +64,7 @@ namespace NzbDrone.Core.Datastore.Migration
// Add in the extra columns and update artist metadata id
Alter.Table("Albums").AddColumn("ArtistMetadataId").AsInt32().WithDefaultValue(0);
Alter.Table("Albums").AddColumn("AnyReleaseOk").AsBoolean().WithDefaultValue(true);
Alter.Table("Albums").AddColumn("AnyReleaseOk").AsInt32().WithDefaultValue(true);
Alter.Table("Albums").AddColumn("Links").AsString().Nullable();
// Set metadata ID

View File

@ -9,7 +9,7 @@ namespace NzbDrone.Core.Datastore.Migration
protected override void MainDbUpgrade()
{
Rename.Table("Restrictions").To("ReleaseProfiles");
Alter.Table("ReleaseProfiles").AddColumn("IncludePreferredWhenRenaming").AsBoolean().WithDefaultValue(true);
Alter.Table("ReleaseProfiles").AddColumn("IncludePreferredWhenRenaming").AsInt32().WithDefaultValue(true);
}
}
}

View File

@ -9,11 +9,11 @@ namespace NzbDrone.Core.Datastore.Migration
{
protected override void MainDbUpgrade()
{
Alter.Table("Notifications").AddColumn("OnHealthIssue").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("IncludeHealthWarnings").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnDownloadFailure").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnImportFailure").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnTrackRetag").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnHealthIssue").AsInt32().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("IncludeHealthWarnings").AsInt32().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnDownloadFailure").AsInt32().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnImportFailure").AsInt32().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnTrackRetag").AsInt32().WithDefaultValue(0);
Delete.Column("OnDownload").FromTable("Notifications");

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Data;
using FluentMigrator.Model;
using FluentMigrator.Runner.Processors.SQLite;
@ -228,6 +228,8 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
case "BLOB":
return DbType.Binary;
case "INTEGER":
return DbType.Int32;
case "BIGINT":
return DbType.Int64;
case "NUMERIC":
return DbType.Double;
@ -237,6 +239,10 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
return DbType.DateTime;
case "UNIQUEIDENTIFIER":
return DbType.Guid;
case "SMALLINT":
return DbType.Int16;
case "TINYINT":
return DbType.Boolean;
default:
return null;
}