mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 21:33:19 +00:00
fix(db): keep plugin index names when moving plugin data to Postgres
The move now creates each index a plugin named under that name, so a later plugin migration that drops or alters it by name finds it on a moved install as on a fresh one.
This commit is contained in:
@@ -151,7 +151,9 @@ function indexDdl(index: SqliteIndex, target: string, notes: string[], table: st
|
||||
return null;
|
||||
}
|
||||
const columns = index.columns.map(quoteIdentifier).join(', ');
|
||||
return `create ${index.unique ? 'unique ' : ''}index on ${target} (${columns})`;
|
||||
// The plugin's own name, for a later migration to find; a UNIQUE constraint's index has none of its own.
|
||||
const name = index.origin === 'c' ? `${quoteIdentifier(index.name)} ` : '';
|
||||
return `create ${index.unique ? 'unique ' : ''}index ${name}on ${target} (${columns})`;
|
||||
}
|
||||
|
||||
/** Plans the copy of one plugin's `plugin.db`: what to create in its schema and what to fill. */
|
||||
|
||||
Reference in New Issue
Block a user