|
| 1 | +import { Kysely } from 'kysely' |
| 2 | + |
| 3 | +export async function up(db: Kysely<any>): Promise<void> { |
| 4 | + await db.schema |
| 5 | + .alterTable('attachments') |
| 6 | + .alterColumn('messageId', (col) => col.setDataType('text')) |
| 7 | + .alterColumn('snowflakeId', (col) => col.setDataType('text')) |
| 8 | + .execute() |
| 9 | + |
| 10 | + await db.schema |
| 11 | + .alterTable('channels') |
| 12 | + .alterColumn('snowflakeId', (col) => col.setDataType('text')) |
| 13 | + .execute() |
| 14 | + |
| 15 | + await db.schema |
| 16 | + .alterTable('messages') |
| 17 | + .alterColumn('postId', (col) => col.setDataType('text')) |
| 18 | + .alterColumn('replyToMessageId', (col) => col.setDataType('text')) |
| 19 | + .alterColumn('snowflakeId', (col) => col.setDataType('text')) |
| 20 | + .alterColumn('userId', (col) => col.setDataType('text')) |
| 21 | + .execute() |
| 22 | + |
| 23 | + await db.schema |
| 24 | + .alterTable('posts') |
| 25 | + .alterColumn('answerId', (col) => col.setDataType('text')) |
| 26 | + .alterColumn('channelId', (col) => col.setDataType('text')) |
| 27 | + .alterColumn('snowflakeId', (col) => col.setDataType('text')) |
| 28 | + .alterColumn('userId', (col) => col.setDataType('text')) |
| 29 | + .execute() |
| 30 | + |
| 31 | + await db.schema |
| 32 | + .alterTable('users') |
| 33 | + .alterColumn('discriminator', (col) => col.setDataType('text')) |
| 34 | + .alterColumn('snowflakeId', (col) => col.setDataType('text')) |
| 35 | + .execute() |
| 36 | +} |
| 37 | + |
| 38 | +export async function down(db: Kysely<any>): Promise<void> { |
| 39 | + await db.schema |
| 40 | + .alterTable('attachments') |
| 41 | + .alterColumn('messageId', (col) => col.setDataType('varchar(40)')) |
| 42 | + .alterColumn('snowflakeId', (col) => col.setDataType('varchar(40)')) |
| 43 | + .execute() |
| 44 | + |
| 45 | + await db.schema |
| 46 | + .alterTable('channels') |
| 47 | + .alterColumn('snowflakeId', (col) => col.setDataType('varchar(40)')) |
| 48 | + .execute() |
| 49 | + |
| 50 | + await db.schema |
| 51 | + .alterTable('messages') |
| 52 | + .alterColumn('postId', (col) => col.setDataType('varchar(40)')) |
| 53 | + .alterColumn('replyToMessageId', (col) => col.setDataType('varchar(40)')) |
| 54 | + .alterColumn('snowflakeId', (col) => col.setDataType('varchar(40)')) |
| 55 | + .alterColumn('userId', (col) => col.setDataType('varchar(40)')) |
| 56 | + .execute() |
| 57 | + |
| 58 | + await db.schema |
| 59 | + .alterTable('posts') |
| 60 | + .alterColumn('answerId', (col) => col.setDataType('varchar(40)')) |
| 61 | + .alterColumn('channelId', (col) => col.setDataType('varchar(40)')) |
| 62 | + .alterColumn('snowflakeId', (col) => col.setDataType('varchar(40)')) |
| 63 | + .alterColumn('userId', (col) => col.setDataType('varchar(40)')) |
| 64 | + .execute() |
| 65 | + |
| 66 | + await db.schema |
| 67 | + .alterTable('users') |
| 68 | + .alterColumn('discriminator', (col) => col.setDataType('varchar(4)')) |
| 69 | + .alterColumn('snowflakeId', (col) => col.setDataType('varchar(40)')) |
| 70 | + .execute() |
| 71 | +} |
0 commit comments