mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Added unique constraints to data migration records.
This commit is contained in:
@@ -92,11 +92,15 @@ namespace Orchard.ImportExport.Services
|
|||||||
environment.Resolve<ITransactionManager>().RequireNew();
|
environment.Resolve<ITransactionManager>().RequireNew();
|
||||||
|
|
||||||
var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>());
|
var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>());
|
||||||
|
|
||||||
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table
|
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table
|
||||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||||
.Column<string>("DataMigrationClass")
|
.Column<string>("DataMigrationClass")
|
||||||
.Column<int>("Version"));
|
.Column<int>("Version"));
|
||||||
|
|
||||||
|
schemaBuilder.AlterTable("Orchard_Framework_DataMigrationRecord",
|
||||||
|
table => table.CreateUniqueConstraint("UC_DataMigrationRecord_DataMigrationClass_Version", "DataMigrationClass", "Version"));
|
||||||
|
|
||||||
var dataMigrationManager = environment.Resolve<IDataMigrationManager>();
|
var dataMigrationManager = environment.Resolve<IDataMigrationManager>();
|
||||||
dataMigrationManager.Update("Settings");
|
dataMigrationManager.Update("Settings");
|
||||||
|
|
||||||
|
@@ -146,11 +146,13 @@ namespace Orchard.Setup.Services {
|
|||||||
// Make a workaround to avoid the Transaction issue for PostgreSQL
|
// Make a workaround to avoid the Transaction issue for PostgreSQL
|
||||||
environment.Resolve<ITransactionManager>().RequireNew();
|
environment.Resolve<ITransactionManager>().RequireNew();
|
||||||
|
|
||||||
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord",
|
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table
|
||||||
table => table
|
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
.Column<string>("DataMigrationClass")
|
||||||
.Column<string>("DataMigrationClass")
|
.Column<int>("Version"));
|
||||||
.Column<int>("Version"));
|
|
||||||
|
schemaBuilder.AlterTable("Orchard_Framework_DataMigrationRecord",
|
||||||
|
table => table.CreateUniqueConstraint("UC_DataMigrationRecord_DataMigrationClass_Version", "DataMigrationClass", "Version"));
|
||||||
|
|
||||||
var dataMigrationManager = environment.Resolve<IDataMigrationManager>();
|
var dataMigrationManager = environment.Resolve<IDataMigrationManager>();
|
||||||
dataMigrationManager.Update("Settings");
|
dataMigrationManager.Update("Settings");
|
||||||
|
Reference in New Issue
Block a user