diff --git a/src/NzbDrone.Core/Datastore/Migration/177_language_improvements.cs b/src/NzbDrone.Core/Datastore/Migration/177_language_improvements.cs index 2bb478795..481777acf 100644 --- a/src/NzbDrone.Core/Datastore/Migration/177_language_improvements.cs +++ b/src/NzbDrone.Core/Datastore/Migration/177_language_improvements.cs @@ -47,7 +47,7 @@ protected override void MainDbUpgrade() //Manual SQL, Fluent Migrator doesn't support multi-column unique contraint on table creation, SQLite doesn't support adding it after creation Execute.Sql("CREATE TABLE MovieTranslations(" + - "Id INTEGER PRIMARY KEY, " + + "Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " + "MovieId INTEGER NOT NULL, " + "Title TEXT, " + "CleanTitle TEXT, " + diff --git a/src/NzbDrone.Core/Datastore/Migration/204_ensure_identity_on_id_columns.cs b/src/NzbDrone.Core/Datastore/Migration/204_ensure_identity_on_id_columns.cs new file mode 100644 index 000000000..504ea3e61 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/204_ensure_identity_on_id_columns.cs @@ -0,0 +1,24 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(204)] + public class ensure_identity_on_id_columns : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Column("Id").OnTable("Movies").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("MovieTranslations").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("Commands").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("Credits").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("Profiles").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("PendingReleases").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("NamingConfig").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("History").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("Blocklist").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("MovieFiles").AsInt32().PrimaryKey().Identity(); + Alter.Column("Id").OnTable("CustomFormats").AsInt32().PrimaryKey().Identity(); + } + } +}