summary refs log tree commit diff
path: root/src/util/migration/postgres/1696420827239-guildChannelOrdering.ts
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2023-12-11 01:12:54 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2023-12-11 01:12:54 +0100
commit0a8ceb9e6349284e75545a01ffad608b020f78e2 (patch)
tree17a9163f963eddabf9168b0b630096b2f7535b64 /src/util/migration/postgres/1696420827239-guildChannelOrdering.ts
parentPrettier: use editorconfig (diff)
downloadserver-dev/emma-refactors.tar.xz
Actually run prettier dev/emma-refactors
Diffstat (limited to '')
-rw-r--r--src/util/migration/postgres/1696420827239-guildChannelOrdering.ts24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/util/migration/postgres/1696420827239-guildChannelOrdering.ts b/src/util/migration/postgres/1696420827239-guildChannelOrdering.ts

index 6fc80ffd..de876ff9 100644 --- a/src/util/migration/postgres/1696420827239-guildChannelOrdering.ts +++ b/src/util/migration/postgres/1696420827239-guildChannelOrdering.ts
@@ -4,31 +4,21 @@ export class guildChannelOrdering1696420827239 implements MigrationInterface { name = "guildChannelOrdering1696420827239"; public async up(queryRunner: QueryRunner): Promise<void> { - const guilds = await queryRunner.query( - `SELECT id FROM guilds`, - undefined, - true, - ); + const guilds = await queryRunner.query(`SELECT id FROM guilds`, undefined, true); - await queryRunner.query( - `ALTER TABLE guilds ADD channel_ordering text NOT NULL DEFAULT '[]'`, - ); + await queryRunner.query(`ALTER TABLE guilds ADD channel_ordering text NOT NULL DEFAULT '[]'`); for (const guild_id of guilds.records.map((x) => x.id)) { const channels: Array<{ position: number; id: string }> = ( - await queryRunner.query( - `SELECT id, position FROM channels WHERE guild_id = $1`, - [guild_id], - true, - ) + await queryRunner.query(`SELECT id, position FROM channels WHERE guild_id = $1`, [guild_id], true) ).records; channels.sort((a, b) => a.position - b.position); - await queryRunner.query( - `UPDATE guilds SET channel_ordering = $1 WHERE id = $2`, - [JSON.stringify(channels.map((x) => x.id)), guild_id], - ); + await queryRunner.query(`UPDATE guilds SET channel_ordering = $1 WHERE id = $2`, [ + JSON.stringify(channels.map((x) => x.id)), + guild_id, + ]); } await queryRunner.query(`ALTER TABLE channels DROP COLUMN position`);