mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat: naming strategy (#19848)
* feat: naming strategy * feat: detect renames
This commit is contained in:
@@ -10,8 +10,17 @@ export const processIndexes: Processor = (ctx, items) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
const indexName =
|
||||
options.name ||
|
||||
ctx.getNameFor({
|
||||
type: 'index',
|
||||
tableName: table.name,
|
||||
columnNames: options.columns,
|
||||
where: options.where,
|
||||
});
|
||||
|
||||
table.indexes.push({
|
||||
name: options.name || ctx.asIndexName(table.name, options.columns, options.where),
|
||||
name: indexName,
|
||||
tableName: table.name,
|
||||
unique: options.unique ?? false,
|
||||
expression: options.expression,
|
||||
@@ -50,7 +59,13 @@ export const processIndexes: Processor = (ctx, items) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
const indexName = options.indexName || ctx.asIndexName(table.name, [column.name]);
|
||||
const indexName =
|
||||
options.indexName ||
|
||||
ctx.getNameFor({
|
||||
type: 'index',
|
||||
tableName: table.name,
|
||||
columnNames: [column.name],
|
||||
});
|
||||
|
||||
const isIndexPresent = table.indexes.some((index) => index.name === indexName);
|
||||
if (isIndexPresent) {
|
||||
|
||||
Reference in New Issue
Block a user