mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Remove the language column from the database, drop the default on search_ext
This commit is contained in:
parent
3edddb8dcc
commit
4664aefa55
2 changed files with 26 additions and 0 deletions
14
src/db/migrations/043_rm_language.ts
Normal file
14
src/db/migrations/043_rm_language.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { Kysely } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await db.schema.alterTable('nostr_events').dropColumn('language').execute();
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await db.schema.alterTable('nostr_events').addColumn('language', 'char(2)').execute();
|
||||
|
||||
await db.schema.createIndex('nostr_events_language_created_idx')
|
||||
.on('nostr_events')
|
||||
.columns(['language', 'created_at desc', 'id asc', 'kind'])
|
||||
.execute();
|
||||
}
|
||||
12
src/db/migrations/044_search_ext_drop_default.ts
Normal file
12
src/db/migrations/044_search_ext_drop_default.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { Kysely } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await db.schema.alterTable('nostr_events').alterColumn('search_ext', (col) => col.dropDefault()).execute();
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
.alterTable('nostr_events')
|
||||
.alterColumn('search_ext', (col) => col.setDefault("'{}'::jsonb"))
|
||||
.execute();
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue