feat(collections): 自动同步作品交付集验收状态
This commit is contained in:
@@ -25,7 +25,11 @@ if (databaseUrl) {
|
||||
pool = new pg.Pool({ connectionString: databaseUrl, ssl: process.env.PGSSL === 'disable' ? false : undefined, max: Number(process.env.PG_POOL_MAX || 10) });
|
||||
}
|
||||
let schema = fs.readFileSync(path.resolve('db/postgres/schema.sql'), 'utf8');
|
||||
if (databaseUrl === 'pg-mem://') schema = schema.replace(/CREATE UNIQUE INDEX IF NOT EXISTS one_active_storage_config[^;]+;/, '');
|
||||
if (databaseUrl === 'pg-mem://') {
|
||||
schema = schema
|
||||
.replace(/CREATE UNIQUE INDEX IF NOT EXISTS one_active_storage_config[^;]+;/, '')
|
||||
.replace(/-- COLLECTION_STATUS_REPAIR_START[\s\S]+?-- COLLECTION_STATUS_REPAIR_END/, '');
|
||||
}
|
||||
await pool.query(schema);
|
||||
const userCount = Number((await pool.query('SELECT COUNT(*)::int AS count FROM users')).rows[0].count);
|
||||
if (userCount === 0) {
|
||||
|
||||
Reference in New Issue
Block a user