diff --git a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs index f0bc816bd7..19a45a3b22 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs @@ -90,11 +90,11 @@ namespace Umbraco.Core.Migrations.Upgrade // From("{init-7.14.0}"); + // begin migrating from v7 - remove all keys and indexes To("{B36B9ABD-374E-465B-9C5F-26AB0D39326F}"); To("{7C447271-CA3F-4A6A-A913-5D77015655CB}"); To("{CBFF58A2-7B50-4F75-8E98-249920DB0F37}"); // fixme cascade - //To("{3D18920C-E84D-405C-A06A-B7CEE52FE5DD}"); // we're going to drop them anyways To("{5CB66059-45F4-48BA-BCBD-C5035D79206B}"); To("{FB0A5429-587E-4BD0-8A67-20F0E7E62FF7}"); To("{F0C42457-6A3B-4912-A7EA-F27ED85A2092}"); @@ -117,21 +117,18 @@ namespace Umbraco.Core.Migrations.Upgrade To("{5F4597F4-A4E0-4AFE-90B5-6D2F896830EB}"); To("{290C18EE-B3DE-4769-84F1-1F467F3F76DA}"); To("{6A2C7C1B-A9DB-4EA9-B6AB-78E7D5B722A7}"); - //To("{77874C77-93E5-4488-A404-A630907CEEF0}"); // we're going to recreate keys at the end To("{8804D8E8-FE62-4E3A-B8A2-C047C2118C38}"); To("{23275462-446E-44C7-8C2C-3B8C1127B07D}"); To("{6B251841-3069-4AD5-8AE9-861F9523E8DA}"); To("{EE429F1B-9B26-43CA-89F8-A86017C809A3}"); To("{08919C4B-B431-449C-90EC-2B8445B5C6B1}"); To("{7EB0254C-CB8B-4C75-B15B-D48C55B449EB}"); - //To("{648A2D5F-7467-48F8-B309-E99CEEE00E2A}"); // duplicate (see above) To("{C39BF2A7-1454-4047-BBFE-89E40F66ED63}"); To("{64EBCE53-E1F0-463A-B40B-E98EFCCA8AE2}"); To("{0009109C-A0B8-4F3F-8FEB-C137BBDDA268}"); To("{ED28B66A-E248-4D94-8CDB-9BDF574023F0}"); To("{38C809D5-6C34-426B-9BEA-EFD39162595C}"); To("{6017F044-8E70-4E10-B2A3-336949692ADD}"); - To("{98339BEF-E4B2-48A8-B9D1-D173DC842BBE}"); Merge() .To("{CDBEDEE4-9496-4903-9CF2-4104E00FF960}") @@ -139,12 +136,22 @@ namespace Umbraco.Core.Migrations.Upgrade .To("{940FD19A-00A8-4D5C-B8FF-939143585726}") .As("{0576E786-5C30-4000-B969-302B61E90CA3}"); + To("{48AD6CCD-C7A4-4305-A8AB-38728AD23FC5}"); + + // finish migrating from v7 - recreate all keys and indexes To("{3F9764F5-73D0-4D45-8804-1240A66E43A2}"); To("{E0CBE54D-A84F-4A8F-9B13-900945FD7ED9}"); - To("{78BAF571-90D0-4D28-8175-EF96316DA789}"); // release-8.0.0 - To("{80C0A0CB-0DD5-4573-B000-C4B7C313C70D}"); // release-8.0.1 + To("{78BAF571-90D0-4D28-8175-EF96316DA789}"); + // release-8.0.0 + + // to 8.0.1... + To("{80C0A0CB-0DD5-4573-B000-C4B7C313C70D}"); + // release-8.0.1 + + // to 8.1.0... To("{B69B6E8C-A769-4044-A27E-4A4E18D1645A}"); + To("{0372A42B-DECF-498D-B4D1-6379E907EB94}"); //FINAL } diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddLockTable.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddLockTable.cs deleted file mode 100644 index 88c6e0bf98..0000000000 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddLockTable.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Linq; -using Umbraco.Core.Persistence.Dtos; - -namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 -{ - public class AddLockTable : MigrationBase - { - public AddLockTable(IMigrationContext context) - : base(context) - { } - - public override void Migrate() - { - var tables = SqlSyntax.GetTablesInSchema(Context.Database); - if (tables.InvariantContains("umbracoLock")) - return; - - Create.Table(true); - } - } -} diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddUserLoginDtoDateIndex.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddUserLoginDtoDateIndex.cs deleted file mode 100644 index 0ccc2d93ff..0000000000 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddUserLoginDtoDateIndex.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Umbraco.Core.Persistence.Dtos; - -namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 -{ - public class AddUserLoginDtoDateIndex : MigrationBase - { - public AddUserLoginDtoDateIndex(IMigrationContext context) - : base(context) - { } - - public override void Migrate() - { - if (!IndexExists("IX_umbracoUserLogin_lastValidatedUtc")) - Create.Index("IX_umbracoUserLogin_lastValidatedUtc") - .OnTable(UserLoginDto.TableName) - .OnColumn("lastValidatedUtc") - .Ascending() - .WithOptions().NonClustered() - .Do(); - } - } -} diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/FixLanguageIsoCodeLength.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/FixLanguageIsoCodeLength.cs new file mode 100644 index 0000000000..8de06c9a6f --- /dev/null +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/FixLanguageIsoCodeLength.cs @@ -0,0 +1,21 @@ +namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 +{ + public class FixLanguageIsoCodeLength : MigrationBase + { + public FixLanguageIsoCodeLength(IMigrationContext context) + : base(context) + { } + + public override void Migrate() + { + // there is some confusion here when upgrading from v7 + // it should be 14 already but that's not always the case + + Alter.Table("umbracoLanguage") + .AlterColumn("languageISOCode") + .AsString(14) + .Nullable() + .Do(); + } + } +} diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/FixLockTablePrimaryKey.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/FixLockTablePrimaryKey.cs deleted file mode 100644 index fbb233927b..0000000000 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/FixLockTablePrimaryKey.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Linq; - -namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 -{ - public class FixLockTablePrimaryKey : MigrationBase - { - public FixLockTablePrimaryKey(IMigrationContext context) - : base(context) - { } - - public override void Migrate() - { - // at some point, the KeyValueService dropped the PK and failed to re-create it, - // so the PK is gone - make sure we have one, and create if needed - - var constraints = SqlSyntax.GetConstraintsPerTable(Database); - var exists = constraints.Any(x => x.Item2 == "PK_umbracoLock"); - - if (!exists) - Create.PrimaryKey("PK_umbracoLock").OnTable(Constants.DatabaseSchema.Tables.Lock).Column("id").Do(); - } - } -} diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_1_0/RenameUserLoginDtoDateIndex.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_1_0/RenameUserLoginDtoDateIndex.cs new file mode 100644 index 0000000000..c0b9c8f2db --- /dev/null +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_1_0/RenameUserLoginDtoDateIndex.cs @@ -0,0 +1,36 @@ +using Umbraco.Core.Persistence.Dtos; + +namespace Umbraco.Core.Migrations.Upgrade.V_8_1_0 +{ + public class RenameUserLoginDtoDateIndex : MigrationBase + { + public RenameUserLoginDtoDateIndex(IMigrationContext context) + : base(context) + { } + + public override void Migrate() + { + // there has been some confusion with an index name, resulting in + // different names depending on which migration path was followed, + // and discrepancies between an upgraded or an installed database. + // better normalize + + if (IndexExists("IX_umbracoUserLogin_lastValidatedUtc")) + return; + + if (IndexExists("IX_userLoginDto_lastValidatedUtc")) + Delete + .Index("IX_userLoginDto_lastValidatedUtc") + .OnTable(UserLoginDto.TableName) + .Do(); + + Create + .Index("IX_umbracoUserLogin_lastValidatedUtc") + .OnTable(UserLoginDto.TableName) + .OnColumn("lastValidatedUtc") + .Ascending() + .WithOptions().NonClustered() + .Do(); + } + } +} diff --git a/src/Umbraco.Core/Persistence/Dtos/UserLoginDto.cs b/src/Umbraco.Core/Persistence/Dtos/UserLoginDto.cs index d7d02631b7..8bf254ea31 100644 --- a/src/Umbraco.Core/Persistence/Dtos/UserLoginDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/UserLoginDto.cs @@ -37,7 +37,7 @@ namespace Umbraco.Core.Persistence.Dtos /// [Column("lastValidatedUtc")] [NullSetting(NullSetting = NullSettings.NotNull)] - [Index(IndexTypes.NonClustered, Name = "IX_userLoginDto_lastValidatedUtc")] + [Index(IndexTypes.NonClustered, Name = "IX_umbracoUserLogin_lastValidatedUtc")] public DateTime LastValidatedUtc { get; set; } /// diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 7730608f36..24999f56c8 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -222,12 +222,14 @@ + + @@ -388,7 +390,6 @@ - @@ -401,7 +402,6 @@ - @@ -691,7 +691,6 @@ -