mirror of https://github.com/immich-app/immich.git
fix: schema ci checks (#18146)
parent
bbd8de177b
commit
a6e5e4f625
@ -0,0 +1,21 @@
|
||||
import { Kysely, sql } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
const { rows } = await sql<{ db: string }>`SELECT current_database() as db`.execute(db);
|
||||
const databaseName = rows[0].db;
|
||||
await sql.raw(`ALTER DATABASE "${databaseName}" SET search_path TO "$user", public, vectors`).execute(db);
|
||||
await sql`ALTER TABLE "naturalearth_countries" DROP CONSTRAINT IF EXISTS "PK_21a6d86d1ab5d841648212e5353";`.execute(db);
|
||||
await sql`ALTER TABLE "naturalearth_countries" DROP CONSTRAINT IF EXISTS "naturalearth_countries_pkey";`.execute(db);
|
||||
await sql`ALTER TABLE "naturalearth_countries" ADD CONSTRAINT "naturalearth_countries_pkey" PRIMARY KEY ("id") WITH (FILLFACTOR = 100);`.execute(db);
|
||||
await sql`DROP INDEX IF EXISTS "IDX_02a43fd0b3c50fb6d7f0cb7282";`.execute(db);
|
||||
await sql`DROP INDEX IF EXISTS "IDX_95ad7106dd7b484275443f580f";`.execute(db);
|
||||
await sql`DROP INDEX IF EXISTS "IDX_7e077a8b70b3530138610ff5e0";`.execute(db);
|
||||
await sql`DROP INDEX IF EXISTS "IDX_92e67dc508c705dd66c9461557";`.execute(db);
|
||||
await sql`DROP INDEX IF EXISTS "IDX_6afb43681a21cf7815932bc38a";`.execute(db);
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
const { rows } = await sql<{ db: string }>`SELECT current_database() as db`.execute(db);
|
||||
const databaseName = rows[0].db;
|
||||
await sql.raw(`ALTER DATABASE "${databaseName}" RESET "search_path"`).execute(db);
|
||||
}
|
||||
Loading…
Reference in New Issue