mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-19 09:42:29 +08:00
Fixing PostgreSQL when creating DistributedLocks table
This commit is contained in:
@@ -84,8 +84,11 @@ namespace Orchard.Data.Migration {
|
|||||||
// Ensure the distributed lock record schema exists.
|
// Ensure the distributed lock record schema exists.
|
||||||
var schemaBuilder = new SchemaBuilder(_dataMigrationInterpreter);
|
var schemaBuilder = new SchemaBuilder(_dataMigrationInterpreter);
|
||||||
var distributedLockSchemaBuilder = new DistributedLockSchemaBuilder(_shellSettings, schemaBuilder);
|
var distributedLockSchemaBuilder = new DistributedLockSchemaBuilder(_shellSettings, schemaBuilder);
|
||||||
if (distributedLockSchemaBuilder.EnsureSchema())
|
if (!distributedLockSchemaBuilder.SchemaExists()) {
|
||||||
|
// Workaround to avoid some Transaction issue for PostgreSQL.
|
||||||
_transactionManager.RequireNew();
|
_transactionManager.RequireNew();
|
||||||
|
distributedLockSchemaBuilder.CreateSchema();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,6 @@ namespace Orchard.Tasks.Locking.Services {
|
|||||||
_schemaBuilder = schemaBuilder;
|
_schemaBuilder = schemaBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EnsureSchema() {
|
|
||||||
if (SchemaExists())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CreateSchema();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateSchema() {
|
public void CreateSchema() {
|
||||||
_schemaBuilder.CreateTable(TableName, table => table
|
_schemaBuilder.CreateTable(TableName, table => table
|
||||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||||
|
|||||||
Reference in New Issue
Block a user