mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat: sql-tools overrides (#19796)
This commit is contained in:
parent
1f9813a28e
commit
df4a27e8a7
114 changed files with 775 additions and 289 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { sql } from 'kysely';
|
||||
import { DatabaseReader } from 'src/sql-tools/types';
|
||||
import { Reader } from 'src/sql-tools/types';
|
||||
|
||||
export const readIndexes: DatabaseReader = async (schema, db) => {
|
||||
export const readIndexes: Reader = async (ctx, db) => {
|
||||
const indexes = await db
|
||||
.selectFrom('pg_index as ix')
|
||||
// matching index, which has column information
|
||||
|
|
@ -34,12 +34,12 @@ export const readIndexes: DatabaseReader = async (schema, db) => {
|
|||
.select((eb) => eb.fn<string[]>('json_agg', ['a.attname']).as('column_name'))
|
||||
.as('column_names'),
|
||||
])
|
||||
.where('pg_namespace.nspname', '=', schema.schemaName)
|
||||
.where('pg_namespace.nspname', '=', ctx.schemaName)
|
||||
.where('ix.indisprimary', '=', sql.lit(false))
|
||||
.execute();
|
||||
|
||||
for (const index of indexes) {
|
||||
const table = schema.tables.find((table) => table.name === index.table_name);
|
||||
const table = ctx.getTableByName(index.table_name);
|
||||
if (!table) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue