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