From 3e519ebcd8556fc4fd3615fb62d694d05a060f1d Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:07:43 +0100 Subject: [PATCH 1/3] remove redundant slug_id index --- .../server/src/database/migrations/20240324T086300-pages.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/apps/server/src/database/migrations/20240324T086300-pages.ts b/apps/server/src/database/migrations/20240324T086300-pages.ts index cbe239c7..ea3fbed9 100644 --- a/apps/server/src/database/migrations/20240324T086300-pages.ts +++ b/apps/server/src/database/migrations/20240324T086300-pages.ts @@ -46,12 +46,6 @@ export async function up(db: Kysely): Promise { .using('GIN') .column('tsv') .execute(); - - await db.schema - .createIndex('pages_slug_id_idx') - .on('pages') - .column('slug_id') - .execute(); } export async function down(db: Kysely): Promise { From 1958067110e2490d715e22702d733307a4b8e6ac Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:16:13 +0100 Subject: [PATCH 2/3] Revert "remove redundant slug_id index" This reverts commit 3e519ebcd8556fc4fd3615fb62d694d05a060f1d. --- .../server/src/database/migrations/20240324T086300-pages.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/server/src/database/migrations/20240324T086300-pages.ts b/apps/server/src/database/migrations/20240324T086300-pages.ts index ea3fbed9..cbe239c7 100644 --- a/apps/server/src/database/migrations/20240324T086300-pages.ts +++ b/apps/server/src/database/migrations/20240324T086300-pages.ts @@ -46,6 +46,12 @@ export async function up(db: Kysely): Promise { .using('GIN') .column('tsv') .execute(); + + await db.schema + .createIndex('pages_slug_id_idx') + .on('pages') + .column('slug_id') + .execute(); } export async function down(db: Kysely): Promise { From e960b8c1a93fba260d975fd12a29a1ed0265755d Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:27:43 +0100 Subject: [PATCH 3/3] create migration --- .../20240707T145623-drop-redundant-pages-slug_id-index.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 apps/server/src/database/migrations/20240707T145623-drop-redundant-pages-slug_id-index.ts diff --git a/apps/server/src/database/migrations/20240707T145623-drop-redundant-pages-slug_id-index.ts b/apps/server/src/database/migrations/20240707T145623-drop-redundant-pages-slug_id-index.ts new file mode 100644 index 00000000..ac2622ab --- /dev/null +++ b/apps/server/src/database/migrations/20240707T145623-drop-redundant-pages-slug_id-index.ts @@ -0,0 +1,7 @@ +import { type Kysely } from 'kysely'; + +export async function up(db: Kysely): Promise { + await db.schema.dropIndex('pages_slug_id_idx').ifExists().execute(); +} + +export async function down(db: Kysely): Promise {}