From df449169bde6c0576757700f68f2d406139cc846 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Thu, 5 Jan 2023 17:12:21 +1100 Subject: Prettier --- scripts/changelog.js | 8 +- scripts/client.js | 91 +- scripts/schema.js | 2 +- scripts/stagingMigration/index.js | 12 +- .../maria/1672833135670-staging.js | 1466 +++++++++++++++----- .../mysql/1672833135670-staging.js | 1466 +++++++++++++++----- .../postgres/1672815835837-staging.js | 195 ++- scripts/syncronise.js | 2 +- 8 files changed, 2415 insertions(+), 827 deletions(-) (limited to 'scripts') diff --git a/scripts/changelog.js b/scripts/changelog.js index e3468b29..bb1799c6 100644 --- a/scripts/changelog.js +++ b/scripts/changelog.js @@ -26,13 +26,13 @@ const CHANGELOG_SCRIPT = "4ec0b5948572d31df88b.js"; .toString() .replaceAll("\r", "") .replaceAll("\n", "\\n") - .replaceAll("\'", "\\'"); + .replaceAll("'", "\\'"); const index = text.indexOf("t.exports='---changelog---") + 11; - const endIndex = text.indexOf("'\n", index); // hmm + const endIndex = text.indexOf("'\n", index); // hmm await fs.writeFile( path.join(CACHE_PATH, CHANGELOG_SCRIPT), - text.substring(0, index) + newChangelogText + text.substring(endIndex) + text.substring(0, index) + newChangelogText + text.substring(endIndex), ); -})(); \ No newline at end of file +})(); diff --git a/scripts/client.js b/scripts/client.js index cbbbcb6f..32ccca00 100644 --- a/scripts/client.js +++ b/scripts/client.js @@ -18,15 +18,16 @@ const path = require("path"); const fetch = require("node-fetch"); -const http = require('http'); -const https = require('https'); +const http = require("http"); +const https = require("https"); const fs = require("fs/promises"); const { existsSync } = require("fs"); // https://stackoverflow.com/a/62500224 const httpAgent = new http.Agent({ keepAlive: true }); const httpsAgent = new https.Agent({ keepAlive: true }); -const agent = (_parsedURL) => _parsedURL.protocol == 'http:' ? httpAgent : httpsAgent; +const agent = (_parsedURL) => + _parsedURL.protocol == "http:" ? httpAgent : httpsAgent; const CACHE_PATH = path.join(__dirname, "..", "assets", "cache"); const BASE_URL = "https://discord.com"; @@ -55,7 +56,10 @@ const doPatch = (content) => { content = content.replaceAll(/ Discord /g, ` ${INSTANCE_NAME} `); content = content.replaceAll(/Discord /g, `${INSTANCE_NAME} `); content = content.replaceAll(/ Discord/g, ` ${INSTANCE_NAME}`); - content = content.replaceAll(/Discord Premium/g, `${INSTANCE_NAME} Premium`); + content = content.replaceAll( + /Discord Premium/g, + `${INSTANCE_NAME} Premium`, + ); content = content.replaceAll(/Discord Nitro/g, `${INSTANCE_NAME} Premium`); content = content.replaceAll(/Discord's/g, `${INSTANCE_NAME}'s`); //content = content.replaceAll(/DiscordTag/g, "FosscordTag"); @@ -66,41 +70,49 @@ const doPatch = (content) => { ['"Server"', '"Guild"'], ['"Server ', '"Guild '], [' Server"', ' Guild"'], - [' Server ', ' Guild '], + [" Server ", " Guild "], ['"Server."', '"Guild."'], [' Server."', ' Guild."'], ['"Server."', '"Guild,"'], [' Server,"', ' Guild,"'], - [' Server,', ' Guild,'], + [" Server,", " Guild,"], ['"Servers"', '"Guilds"'], ['"Servers ', '"Guilds '], [' Servers"', ' Guilds"'], - [' Servers ', ' Guilds '], + [" Servers ", " Guilds "], ['"Servers."', '"Guilds."'], [' Servers."', ' Guilds,"'], ['"Servers,"', '"Guilds,"'], [' Servers,"', ' Guilds,"'], - [' Servers,', ' Guilds,'], + [" Servers,", " Guilds,"], - ['\nServers', '\nGuilds'], + ["\nServers", "\nGuilds"], ]; - serverVariations.forEach(x => serverVariations.push([x[0].toLowerCase(), x[1].toLowerCase()])); - serverVariations.forEach(x => content = content.replaceAll(x[0], x[1])); + serverVariations.forEach((x) => + serverVariations.push([x[0].toLowerCase(), x[1].toLowerCase()]), + ); + serverVariations.forEach((x) => (content = content.replaceAll(x[0], x[1]))); // sentry - content = content.replaceAll("https://fa97a90475514c03a42f80cd36d147c4@sentry.io/140984", "https://05e8e3d005f34b7d97e920ae5870a5e5@sentry.thearcanebrony.net/6"); + content = content.replaceAll( + "https://fa97a90475514c03a42f80cd36d147c4@sentry.io/140984", + "https://05e8e3d005f34b7d97e920ae5870a5e5@sentry.thearcanebrony.net/6", + ); //logos content = content.replaceAll( "M23.0212 1.67671C21.3107 0.879656 19.5079 0.318797 17.6584 0C17.4062 0.461742 17.1749 0.934541 16.9708 1.4184C15.003 1.12145 12.9974 1.12145 11.0283 1.4184C10.819 0.934541 10.589 0.461744 10.3368 0.00546311C8.48074 0.324393 6.67795 0.885118 4.96746 1.68231C1.56727 6.77853 0.649666 11.7538 1.11108 16.652C3.10102 18.1418 5.3262 19.2743 7.69177 20C8.22338 19.2743 8.69519 18.4993 9.09812 17.691C8.32996 17.3997 7.58522 17.0424 6.87684 16.6135C7.06531 16.4762 7.24726 16.3387 7.42403 16.1847C11.5911 18.1749 16.408 18.1749 20.5763 16.1847C20.7531 16.3332 20.9351 16.4762 21.1171 16.6135C20.41 17.0369 19.6639 17.3997 18.897 17.691C19.3052 18.4993 19.7718 19.2689 20.3021 19.9945C22.6677 19.2689 24.8929 18.1364 26.8828 16.6466H26.8893C27.43 10.9731 25.9665 6.04728 23.0212 1.67671ZM9.68041 13.6383C8.39754 13.6383 7.34085 12.4453 7.34085 10.994C7.34085 9.54272 8.37155 8.34973 9.68041 8.34973C10.9893 8.34973 12.0395 9.54272 12.0187 10.994C12.0187 12.4453 10.9828 13.6383 9.68041 13.6383ZM18.3161 13.6383C17.0332 13.6383 15.9765 12.4453 15.9765 10.994C15.9765 9.54272 17.0124 8.34973 18.3161 8.34973C19.6184 8.34973 20.6751 9.54272 20.6543 10.994C20.6543 12.4453 19.6184 13.6383 18.3161 13.6383Z", - "M 0,0 47.999993,2.7036528e-4 C 48.001796,3.3028172 47.663993,6.5968018 46.991821,9.8301938 43.116101,28.454191 28.452575,43.116441 9.8293509,46.992163 6.5960834,47.664163 3.3023222,48.001868 0,47.999992 Z m 9.8293509,28.735114 v 9.248482 C 22.673599,33.047696 32.857154,22.749268 37.63852,9.829938 H 9.8293509 v 8.679899 H 22.931288 c -3.554489,3.93617 -7.735383,7.257633 -12.373436,9.829938 -0.241031,0.133684 -0.483864,0.265492 -0.7285011,0.395339 z" + "M 0,0 47.999993,2.7036528e-4 C 48.001796,3.3028172 47.663993,6.5968018 46.991821,9.8301938 43.116101,28.454191 28.452575,43.116441 9.8293509,46.992163 6.5960834,47.664163 3.3023222,48.001868 0,47.999992 Z m 9.8293509,28.735114 v 9.248482 C 22.673599,33.047696 32.857154,22.749268 37.63852,9.829938 H 9.8293509 v 8.679899 H 22.931288 c -3.554489,3.93617 -7.735383,7.257633 -12.373436,9.829938 -0.241031,0.133684 -0.483864,0.265492 -0.7285011,0.395339 z", + ); + content = content.replaceAll( + 'width:n,height:c,viewBox:"0 0 28 20"', + 'width:50,height:50,viewBox:"0 0 50 50"', ); - content = content.replaceAll('width:n,height:c,viewBox:"0 0 28 20"', 'width:50,height:50,viewBox:"0 0 50 50"'); // app download links // content = content.replaceAll( @@ -126,28 +138,34 @@ const doPatch = (content) => { // Stop client from deleting `localStorage` global. Makes `plugins` and `preload-plugins` less annoying. content = content.replaceAll( "delete window.localStorage", - "console.log('Prevented deletion of localStorage')" + "console.log('Prevented deletion of localStorage')", ); // fast identify content = content.replaceAll( "e.isFastConnect=t;t?e._doFastConnectIdentify():e._doResumeOrIdentify()", - "e.isFastConnect=t; if (t !== undefined) e._doResumeOrIdentify();" + "e.isFastConnect=t; if (t !== undefined) e._doResumeOrIdentify();", ); // disable qr code login - content = content.replaceAll(/\w\?\(\d,\w\.jsx\)\(\w*\,{authTokenCallback:this\.handleAuthToken}\):null/g, "null"); + content = content.replaceAll( + /\w\?\(\d,\w\.jsx\)\(\w*\,{authTokenCallback:this\.handleAuthToken}\):null/g, + "null", + ); return content; }; const processFile = async (name) => { - const res = await fetch(`${BASE_URL}/assets/${name}${name.includes(".") ? "" : ".js"}`, { - agent, - }); + const res = await fetch( + `${BASE_URL}/assets/${name}${name.includes(".") ? "" : ".js"}`, + { + agent, + }, + ); if (res.status !== 200) { return []; - }; + } if (name.includes(".") && !name.includes(".js") && !name.includes(".css")) { await fs.writeFile(path.join(CACHE_PATH, name), await res.buffer()); @@ -158,9 +176,14 @@ const processFile = async (name) => { text = doPatch(text); - await fs.writeFile(path.join(CACHE_PATH, `${name}${name.includes(".") ? "" : ".js"}`), text); + await fs.writeFile( + path.join(CACHE_PATH, `${name}${name.includes(".") ? "" : ".js"}`), + text, + ); - return [...new Set(text.match(/\"[A-Fa-f0-9]{20}\"/g))].map(x => x.replaceAll("\"", "")); + return [...new Set(text.match(/\"[A-Fa-f0-9]{20}\"/g))].map((x) => + x.replaceAll('"', ""), + ); }; (async () => { @@ -187,7 +210,13 @@ const processFile = async (name) => { process.stdout.moveCursor(0, 1); - const CACHE_MISSES = (await fs.readFile(path.join(CACHE_PATH, "..", "cacheMisses"))).toString().split("\r").join("").split("\n"); + const CACHE_MISSES = ( + await fs.readFile(path.join(CACHE_PATH, "..", "cacheMisses")) + ) + .toString() + .split("\r") + .join("") + .split("\n"); while (CACHE_MISSES.length > 0) { const asset = CACHE_MISSES.shift(); process.stdout.clearLine(0); @@ -216,11 +245,15 @@ const processFile = async (name) => { `Patching existing ${file}. Remaining: ${existing.length}.`, ); - var text = (await fs.readFile(path.join(CACHE_PATH, file))); + var text = await fs.readFile(path.join(CACHE_PATH, file)); if (file.includes(".js") || file.includes(".css")) { text = doPatch(text.toString()); await fs.writeFile(path.join(CACHE_PATH, file), text.toString()); - assets.push(...[...new Set(text.match(/\"[A-Fa-f0-9]{20}\"/g))].map(x => x.replaceAll("\"", ""))); + assets.push( + ...[...new Set(text.match(/\"[A-Fa-f0-9]{20}\"/g))].map((x) => + x.replaceAll('"', ""), + ), + ); } } @@ -249,9 +282,9 @@ const processFile = async (name) => { process.stdout.cursorTo(0); process.stdout.write( `Caching asset ${asset}. ` + - `${i}/${assets.length - 1} = ${Math.floor( - (i / (assets.length - 1)) * 100, - )}% ` + `${i}/${assets.length - 1} = ${Math.floor( + (i / (assets.length - 1)) * 100, + )}% `, // + `Finish at: ${new Date( // Date.now() + finishTime, // ).toLocaleTimeString()}`, diff --git a/scripts/schema.js b/scripts/schema.js index 3a69d002..29665ef1 100644 --- a/scripts/schema.js +++ b/scripts/schema.js @@ -51,7 +51,7 @@ function modify(obj) { function main() { const program = TJS.programFromConfig( path.join(__dirname, "..", "tsconfig.json"), - walk(path.join(__dirname, "..", "src", "util", "schemas")) + walk(path.join(__dirname, "..", "src", "util", "schemas")), ); const generator = TJS.buildGenerator(program, settings); if (!generator || !program) return; diff --git a/scripts/stagingMigration/index.js b/scripts/stagingMigration/index.js index bc375b49..a1acaabb 100644 --- a/scripts/stagingMigration/index.js +++ b/scripts/stagingMigration/index.js @@ -4,11 +4,19 @@ const path = require("path"); (async () => { DataSourceOptions.setOptions({ logging: true, - migrations: [path.join(process.cwd(), "scripts", "stagingMigration", DatabaseType, "*.js")] + migrations: [ + path.join( + process.cwd(), + "scripts", + "stagingMigration", + DatabaseType, + "*.js", + ), + ], }); const dbConnection = await DataSourceOptions.initialize(); await dbConnection.runMigrations(); await dbConnection.destroy(); console.log("migration done"); -})(); \ No newline at end of file +})(); diff --git a/scripts/stagingMigration/maria/1672833135670-staging.js b/scripts/stagingMigration/maria/1672833135670-staging.js index e3745f59..ce0c1ed8 100644 --- a/scripts/stagingMigration/maria/1672833135670-staging.js +++ b/scripts/stagingMigration/maria/1672833135670-staging.js @@ -1,375 +1,1103 @@ const { MigrationInterface, QueryRunner } = require("typeorm"); module.exports = class staging1672833135670 { - name = 'staging1672833135670' + name = "staging1672833135670"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE \`users\` DROP FOREIGN KEY \`FK_76ba283779c8441fd5ff819c8cf\``); - await queryRunner.query(`DROP INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\``); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`id\` \`index\` varchar(255) NOT NULL`); - await queryRunner.query(`CREATE TABLE \`embed_cache\` (\`id\` varchar(255) NOT NULL, \`url\` varchar(255) NOT NULL, \`embed\` text NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query(`CREATE TABLE \`security_settings\` (\`id\` varchar(255) NOT NULL, \`guild_id\` varchar(255) NULL, \`channel_id\` varchar(255) NULL, \`encryption_permission_mask\` int NOT NULL, \`allowed_algorithms\` text NOT NULL, \`current_algorithm\` varchar(255) NOT NULL, \`used_since_message\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query(`ALTER TABLE \`client_release\` DROP COLUMN \`deb_url\``); - await queryRunner.query(`ALTER TABLE \`client_release\` DROP COLUMN \`osx_url\``); - await queryRunner.query(`ALTER TABLE \`client_release\` DROP COLUMN \`win_url\``); - await queryRunner.query(`ALTER TABLE \`users\` DROP COLUMN \`settingsId\``); - await queryRunner.query(`ALTER TABLE \`client_release\` ADD \`platform\` varchar(255) NOT NULL`); - await queryRunner.query(`ALTER TABLE \`client_release\` ADD \`enabled\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`users\` ADD \`purchased_flags\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`users\` ADD \`premium_usage_flags\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`users\` ADD \`settingsIndex\` int NULL`); - await queryRunner.query(`ALTER TABLE \`users\` ADD UNIQUE INDEX \`IDX_0c14beb78d8c5ccba66072adbc\` (\`settingsIndex\`)`); - await queryRunner.query(`ALTER TABLE \`config\` CHANGE \`value\` \`value\` text NULL`); - await queryRunner.query(`ALTER TABLE \`relationships\` CHANGE \`nickname\` \`nickname\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`connected_accounts\` DROP FOREIGN KEY \`FK_f47244225a6a1eac04a3463dd90\``); - await queryRunner.query(`ALTER TABLE \`connected_accounts\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`attachments\` DROP FOREIGN KEY \`FK_623e10eec51ada466c5038979e3\``); - await queryRunner.query(`ALTER TABLE \`attachments\` CHANGE \`height\` \`height\` int NULL`); - await queryRunner.query(`ALTER TABLE \`attachments\` CHANGE \`width\` \`width\` int NULL`); - await queryRunner.query(`ALTER TABLE \`attachments\` CHANGE \`content_type\` \`content_type\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`attachments\` CHANGE \`message_id\` \`message_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` DROP FOREIGN KEY \`FK_bd2726fd31b35443f2245b93ba0\``); - await queryRunner.query(`ALTER TABLE \`audit_logs\` DROP FOREIGN KEY \`FK_3cd01cd3ae7aab010310d96ac8e\``); - await queryRunner.query(`ALTER TABLE \`audit_logs\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` CHANGE \`options\` \`options\` text NULL`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` CHANGE \`reason\` \`reason\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` CHANGE \`target_id\` \`target_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`backup_codes\` DROP FOREIGN KEY \`FK_70066ea80d2f4b871beda32633b\``); - await queryRunner.query(`ALTER TABLE \`backup_codes\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_5999e8e449f80a236ff72023559\``); - await queryRunner.query(`ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_9d3ab7dd180ebdd245cdb66ecad\``); - await queryRunner.query(`ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_07ad88c86d1f290d46748410d58\``); - await queryRunner.query(`ALTER TABLE \`bans\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`bans\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`bans\` CHANGE \`executor_id\` \`executor_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`bans\` CHANGE \`reason\` \`reason\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`categories\` CHANGE \`name\` \`name\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`categories\` CHANGE \`is_primary\` \`is_primary\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`client_release\` DROP COLUMN \`pub_date\``); - await queryRunner.query(`ALTER TABLE \`client_release\` ADD \`pub_date\` datetime NOT NULL`); - await queryRunner.query(`ALTER TABLE \`client_release\` CHANGE \`notes\` \`notes\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`public_ack\` \`public_ack\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`notifications_cursor\` \`notifications_cursor\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`last_pin_timestamp\` \`last_pin_timestamp\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`mention_count\` \`mention_count\` int NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_3f4939aa1461e8af57fea3fb05d\``); - await queryRunner.query(`ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_6a15b051fe5050aa00a4b9ff0f6\``); - await queryRunner.query(`ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\``); - await queryRunner.query(`ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_11a0d394f8fc649c19ce5f16b59\``); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`inviter_id\` \`inviter_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`target_user_id\` \`target_user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`target_user_type\` \`target_user_type\` int NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`vanity_url\` \`vanity_url\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_03779ef216d4b0358470d9cb748\``); - await queryRunner.query(`ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_9f8d389866b40b6657edd026dd4\``); - await queryRunner.query(`ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_5fe1d5f931a67e85039c640001b\``); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`token\` \`token\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`self_stream\` \`self_stream\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`request_to_speak_timestamp\` \`request_to_speak_timestamp\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_487a7af59d189f744fe394368fc\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_df528cf77e82f8032230e7e37d8\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_c3e5305461931763b56aa905f1c\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_0d523f6f997c86e052c49b1455f\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_3a285f4f49c40e0706d3018bc9f\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`name\` \`name\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`token\` \`token\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_c253dafe5f3a03ec00cd8fb4581\``); - await queryRunner.query(`ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_3274522d14af40540b1a883fc80\``); - await queryRunner.query(`ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_3873ed438575cce703ecff4fc7b\``); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`name\` \`name\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`icon\` \`icon\` text NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`parent_id\` \`parent_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`last_pin_timestamp\` \`last_pin_timestamp\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`default_auto_archive_duration\` \`default_auto_archive_duration\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`position\` \`position\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`permission_overwrites\` \`permission_overwrites\` text NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`video_quality_mode\` \`video_quality_mode\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`bitrate\` \`bitrate\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`user_limit\` \`user_limit\` int NULL`); - await queryRunner.query(`UPDATE channels SET nsfw = 0 WHERE nsfw IS NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`rate_limit_per_user\` \`rate_limit_per_user\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`topic\` \`topic\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`retention_policy_id\` \`retention_policy_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`flags\` \`flags\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`default_thread_rate_limit_per_user\` \`default_thread_rate_limit_per_user\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`emojis\` DROP FOREIGN KEY \`FK_fa7ddd5f9a214e28ce596548421\``); - await queryRunner.query(`ALTER TABLE \`emojis\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`emojis\` CHANGE \`groups\` \`groups\` text NULL`); - await queryRunner.query(`ALTER TABLE \`notes\` DROP FOREIGN KEY \`FK_f9e103f8ae67cb1787063597925\``); - await queryRunner.query(`ALTER TABLE \`notes\` DROP FOREIGN KEY \`FK_23e08e5b4481711d573e1abecdc\``); - await queryRunner.query(`DROP INDEX \`IDX_74e6689b9568cc965b8bfc9150\` ON \`notes\``); - await queryRunner.query(`ALTER TABLE \`notes\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`notes\` CHANGE \`target_id\` \`target_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sessions\` DROP FOREIGN KEY \`FK_085d540d9f418cfbdc7bd55bb19\``); - await queryRunner.query(`ALTER TABLE \`sessions\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sessions\` CHANGE \`activities\` \`activities\` text NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_e7cfa5cefa6661b3fb8fda8ce69\``); - await queryRunner.query(`ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_193d551d852aca5347ef5c9f205\``); - await queryRunner.query(`ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_8f4ee73f2bb2325ff980502e158\``); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`available\` \`available\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`tags\` \`tags\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`pack_id\` \`pack_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` DROP FOREIGN KEY \`FK_448fafba4355ee1c837bbc865f1\``); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` CHANGE \`banner_asset_id\` \`banner_asset_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` CHANGE \`cover_sticker_id\` \`cover_sticker_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` CHANGE \`coverStickerId\` \`coverStickerId\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`templates\` DROP FOREIGN KEY \`FK_d7374b7f8f5fbfdececa4fb62e1\``); - await queryRunner.query(`ALTER TABLE \`templates\` DROP FOREIGN KEY \`FK_445d00eaaea0e60a017a5ed0c11\``); - await queryRunner.query(`ALTER TABLE \`templates\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`templates\` CHANGE \`usage_count\` \`usage_count\` int NULL`); - await queryRunner.query(`ALTER TABLE \`templates\` CHANGE \`creator_id\` \`creator_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`templates\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` DROP PRIMARY KEY`); - await queryRunner.query(`ALTER TABLE \`user_settings\` DROP COLUMN \`index\``); - await queryRunner.query(`ALTER TABLE \`user_settings\` ADD \`index\` int NOT NULL PRIMARY KEY AUTO_INCREMENT`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`afk_timeout\` \`afk_timeout\` int NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`allow_accessibility_detection\` \`allow_accessibility_detection\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`animate_emoji\` \`animate_emoji\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`animate_stickers\` \`animate_stickers\` int NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`contact_sync_enabled\` \`contact_sync_enabled\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`convert_emoticons\` \`convert_emoticons\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`custom_status\` \`custom_status\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`default_guilds_restricted\` \`default_guilds_restricted\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`detect_platform_accounts\` \`detect_platform_accounts\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`developer_mode\` \`developer_mode\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`disable_games_tab\` \`disable_games_tab\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`enable_tts_command\` \`enable_tts_command\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`explicit_content_filter\` \`explicit_content_filter\` int NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`friend_source_flags\` \`friend_source_flags\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`gateway_connected\` \`gateway_connected\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`gif_auto_play\` \`gif_auto_play\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`guild_folders\` \`guild_folders\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`guild_positions\` \`guild_positions\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`inline_attachment_media\` \`inline_attachment_media\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`inline_embed_media\` \`inline_embed_media\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`locale\` \`locale\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`message_display_compact\` \`message_display_compact\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`native_phone_integration_enabled\` \`native_phone_integration_enabled\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`render_embeds\` \`render_embeds\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`render_reactions\` \`render_reactions\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`restricted_guilds\` \`restricted_guilds\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`show_current_game\` \`show_current_game\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`status\` \`status\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`stream_notifications_enabled\` \`stream_notifications_enabled\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`theme\` \`theme\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`timezone_offset\` \`timezone_offset\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_f591a66b8019d87b0fe6c12dad6\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_e2a2f873a64a5cf62526de42325\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_fc1a451727e3643ca572a3bb394\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_8d450b016dc8bec35f36729e4b0\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_95828668aa333460582e0ca6396\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_cfc3d3ad260f8121c95b31a1fce\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_9d1d665379eefde7876a17afa99\``); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`afk_channel_id\` \`afk_channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`afk_timeout\` \`afk_timeout\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`banner\` \`banner\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`default_message_notifications\` \`default_message_notifications\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`discovery_splash\` \`discovery_splash\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`explicit_content_filter\` \`explicit_content_filter\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP COLUMN \`primary_category_id\``); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD \`primary_category_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`icon\` \`icon\` varchar(255) NULL`); - await queryRunner.query(`UPDATE guilds SET large = 0 WHERE large IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`large\` \`large\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`max_members\` \`max_members\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`max_presences\` \`max_presences\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`max_video_channel_users\` \`max_video_channel_users\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`member_count\` \`member_count\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`presence_count\` \`presence_count\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`template_id\` \`template_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`mfa_level\` \`mfa_level\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`preferred_locale\` \`preferred_locale\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`premium_subscription_count\` \`premium_subscription_count\` int NULL`); - await queryRunner.query(`UPDATE guilds SET premium_tier = 0 WHERE premium_tier IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`premium_tier\` \`premium_tier\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`public_updates_channel_id\` \`public_updates_channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`rules_channel_id\` \`rules_channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`region\` \`region\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`splash\` \`splash\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`system_channel_id\` \`system_channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`system_channel_flags\` \`system_channel_flags\` int NULL`); - await queryRunner.query(`UPDATE guilds SET unavailable = 0 WHERE unavailable IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`unavailable\` \`unavailable\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`verification_level\` \`verification_level\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`widget_channel_id\` \`widget_channel_id\` varchar(255) NULL`); - await queryRunner.query(`UPDATE guilds SET widget_enabled = 0 WHERE widget_enabled IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`widget_enabled\` \`widget_enabled\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`nsfw_level\` \`nsfw_level\` int NULL`); - await queryRunner.query(`UPDATE guilds SET nsfw = 0 WHERE nsfw IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`parent\` \`parent\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`premium_progress_bar_enabled\` \`premium_progress_bar_enabled\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`roles\` DROP FOREIGN KEY \`FK_c32c1ab1c4dc7dcb0278c4b1b8b\``); - await queryRunner.query(`ALTER TABLE \`roles\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`roles\` CHANGE \`icon\` \`icon\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`roles\` CHANGE \`unicode_emoji\` \`unicode_emoji\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`roles\` CHANGE \`tags\` \`tags\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_86b9109b155eb70c0a2ca3b4b6d\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_b193588441b085352a4c0109423\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_05535bc695e9f7ee104616459d3\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_b0525304f2262b7014245351c76\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_f83c04bcf1df4e5c0e7a52ed348\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_5d3ec1cb962de6488637fd779d6\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_61a92bb65b302a76d9c1fcd3174\``); - await queryRunner.query(`DROP INDEX \`IDX_3ed7a60fb7dbe04e1ba9332a8b\` ON \`messages\``); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`author_id\` \`author_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`member_id\` \`member_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`webhook_id\` \`webhook_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`content\` \`content\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`edited_timestamp\` \`edited_timestamp\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`tts\` \`tts\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`mention_everyone\` \`mention_everyone\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`nonce\` \`nonce\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`pinned\` \`pinned\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`activity\` \`activity\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`flags\` \`flags\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`message_reference\` \`message_reference\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`interaction\` \`interaction\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`components\` \`components\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`message_reference_id\` \`message_reference_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`nick\` \`nick\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` DROP COLUMN \`premium_since\``); - await queryRunner.query(`ALTER TABLE \`members\` ADD \`premium_since\` bigint NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`joined_by\` \`joined_by\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`banner\` \`banner\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`communication_disabled_until\` \`communication_disabled_until\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`accent_color\` \`accent_color\` int NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`banner\` \`banner\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`phone\` \`phone\` varchar(255) NULL`); + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE \`users\` DROP FOREIGN KEY \`FK_76ba283779c8441fd5ff819c8cf\``, + ); + await queryRunner.query( + `DROP INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\``, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`id\` \`index\` varchar(255) NOT NULL`, + ); + await queryRunner.query( + `CREATE TABLE \`embed_cache\` (\`id\` varchar(255) NOT NULL, \`url\` varchar(255) NOT NULL, \`embed\` text NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`, + ); + await queryRunner.query( + `CREATE TABLE \`security_settings\` (\`id\` varchar(255) NOT NULL, \`guild_id\` varchar(255) NULL, \`channel_id\` varchar(255) NULL, \`encryption_permission_mask\` int NOT NULL, \`allowed_algorithms\` text NOT NULL, \`current_algorithm\` varchar(255) NOT NULL, \`used_since_message\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` DROP COLUMN \`deb_url\``, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` DROP COLUMN \`osx_url\``, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` DROP COLUMN \`win_url\``, + ); + await queryRunner.query( + `ALTER TABLE \`users\` DROP COLUMN \`settingsId\``, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` ADD \`platform\` varchar(255) NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` ADD \`enabled\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD \`purchased_flags\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD \`premium_usage_flags\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD \`settingsIndex\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD UNIQUE INDEX \`IDX_0c14beb78d8c5ccba66072adbc\` (\`settingsIndex\`)`, + ); + await queryRunner.query( + `ALTER TABLE \`config\` CHANGE \`value\` \`value\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`relationships\` CHANGE \`nickname\` \`nickname\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`connected_accounts\` DROP FOREIGN KEY \`FK_f47244225a6a1eac04a3463dd90\``, + ); + await queryRunner.query( + `ALTER TABLE \`connected_accounts\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` DROP FOREIGN KEY \`FK_623e10eec51ada466c5038979e3\``, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` CHANGE \`height\` \`height\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` CHANGE \`width\` \`width\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` CHANGE \`content_type\` \`content_type\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` CHANGE \`message_id\` \`message_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` DROP FOREIGN KEY \`FK_bd2726fd31b35443f2245b93ba0\``, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` DROP FOREIGN KEY \`FK_3cd01cd3ae7aab010310d96ac8e\``, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` CHANGE \`options\` \`options\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` CHANGE \`reason\` \`reason\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` CHANGE \`target_id\` \`target_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`backup_codes\` DROP FOREIGN KEY \`FK_70066ea80d2f4b871beda32633b\``, + ); + await queryRunner.query( + `ALTER TABLE \`backup_codes\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_5999e8e449f80a236ff72023559\``, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_9d3ab7dd180ebdd245cdb66ecad\``, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_07ad88c86d1f290d46748410d58\``, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` CHANGE \`executor_id\` \`executor_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` CHANGE \`reason\` \`reason\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`categories\` CHANGE \`name\` \`name\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`categories\` CHANGE \`is_primary\` \`is_primary\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` DROP COLUMN \`pub_date\``, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` ADD \`pub_date\` datetime NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` CHANGE \`notes\` \`notes\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`public_ack\` \`public_ack\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`notifications_cursor\` \`notifications_cursor\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`last_pin_timestamp\` \`last_pin_timestamp\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`mention_count\` \`mention_count\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_3f4939aa1461e8af57fea3fb05d\``, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_6a15b051fe5050aa00a4b9ff0f6\``, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\``, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_11a0d394f8fc649c19ce5f16b59\``, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`inviter_id\` \`inviter_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`target_user_id\` \`target_user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`target_user_type\` \`target_user_type\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`vanity_url\` \`vanity_url\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_03779ef216d4b0358470d9cb748\``, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_9f8d389866b40b6657edd026dd4\``, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_5fe1d5f931a67e85039c640001b\``, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`token\` \`token\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`self_stream\` \`self_stream\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`request_to_speak_timestamp\` \`request_to_speak_timestamp\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_487a7af59d189f744fe394368fc\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_df528cf77e82f8032230e7e37d8\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_c3e5305461931763b56aa905f1c\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_0d523f6f997c86e052c49b1455f\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_3a285f4f49c40e0706d3018bc9f\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`name\` \`name\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`token\` \`token\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_c253dafe5f3a03ec00cd8fb4581\``, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_3274522d14af40540b1a883fc80\``, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_3873ed438575cce703ecff4fc7b\``, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`name\` \`name\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`icon\` \`icon\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`parent_id\` \`parent_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`last_pin_timestamp\` \`last_pin_timestamp\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`default_auto_archive_duration\` \`default_auto_archive_duration\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`position\` \`position\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`permission_overwrites\` \`permission_overwrites\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`video_quality_mode\` \`video_quality_mode\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`bitrate\` \`bitrate\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`user_limit\` \`user_limit\` int NULL`, + ); + await queryRunner.query( + `UPDATE channels SET nsfw = 0 WHERE nsfw IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`rate_limit_per_user\` \`rate_limit_per_user\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`topic\` \`topic\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`retention_policy_id\` \`retention_policy_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`flags\` \`flags\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`default_thread_rate_limit_per_user\` \`default_thread_rate_limit_per_user\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`emojis\` DROP FOREIGN KEY \`FK_fa7ddd5f9a214e28ce596548421\``, + ); + await queryRunner.query( + `ALTER TABLE \`emojis\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`emojis\` CHANGE \`groups\` \`groups\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` DROP FOREIGN KEY \`FK_f9e103f8ae67cb1787063597925\``, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` DROP FOREIGN KEY \`FK_23e08e5b4481711d573e1abecdc\``, + ); + await queryRunner.query( + `DROP INDEX \`IDX_74e6689b9568cc965b8bfc9150\` ON \`notes\``, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` CHANGE \`target_id\` \`target_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sessions\` DROP FOREIGN KEY \`FK_085d540d9f418cfbdc7bd55bb19\``, + ); + await queryRunner.query( + `ALTER TABLE \`sessions\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sessions\` CHANGE \`activities\` \`activities\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_e7cfa5cefa6661b3fb8fda8ce69\``, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_193d551d852aca5347ef5c9f205\``, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_8f4ee73f2bb2325ff980502e158\``, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`available\` \`available\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`tags\` \`tags\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`pack_id\` \`pack_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` DROP FOREIGN KEY \`FK_448fafba4355ee1c837bbc865f1\``, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` CHANGE \`banner_asset_id\` \`banner_asset_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` CHANGE \`cover_sticker_id\` \`cover_sticker_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` CHANGE \`coverStickerId\` \`coverStickerId\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` DROP FOREIGN KEY \`FK_d7374b7f8f5fbfdececa4fb62e1\``, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` DROP FOREIGN KEY \`FK_445d00eaaea0e60a017a5ed0c11\``, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` CHANGE \`usage_count\` \`usage_count\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` CHANGE \`creator_id\` \`creator_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` DROP PRIMARY KEY`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` DROP COLUMN \`index\``, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` ADD \`index\` int NOT NULL PRIMARY KEY AUTO_INCREMENT`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`afk_timeout\` \`afk_timeout\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`allow_accessibility_detection\` \`allow_accessibility_detection\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`animate_emoji\` \`animate_emoji\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`animate_stickers\` \`animate_stickers\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`contact_sync_enabled\` \`contact_sync_enabled\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`convert_emoticons\` \`convert_emoticons\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`custom_status\` \`custom_status\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`default_guilds_restricted\` \`default_guilds_restricted\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`detect_platform_accounts\` \`detect_platform_accounts\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`developer_mode\` \`developer_mode\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`disable_games_tab\` \`disable_games_tab\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`enable_tts_command\` \`enable_tts_command\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`explicit_content_filter\` \`explicit_content_filter\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`friend_source_flags\` \`friend_source_flags\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`gateway_connected\` \`gateway_connected\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`gif_auto_play\` \`gif_auto_play\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`guild_folders\` \`guild_folders\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`guild_positions\` \`guild_positions\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`inline_attachment_media\` \`inline_attachment_media\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`inline_embed_media\` \`inline_embed_media\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`locale\` \`locale\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`message_display_compact\` \`message_display_compact\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`native_phone_integration_enabled\` \`native_phone_integration_enabled\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`render_embeds\` \`render_embeds\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`render_reactions\` \`render_reactions\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`restricted_guilds\` \`restricted_guilds\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`show_current_game\` \`show_current_game\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`status\` \`status\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`stream_notifications_enabled\` \`stream_notifications_enabled\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`theme\` \`theme\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`timezone_offset\` \`timezone_offset\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_f591a66b8019d87b0fe6c12dad6\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_e2a2f873a64a5cf62526de42325\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_fc1a451727e3643ca572a3bb394\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_8d450b016dc8bec35f36729e4b0\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_95828668aa333460582e0ca6396\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_cfc3d3ad260f8121c95b31a1fce\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_9d1d665379eefde7876a17afa99\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`afk_channel_id\` \`afk_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`afk_timeout\` \`afk_timeout\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`banner\` \`banner\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`default_message_notifications\` \`default_message_notifications\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`discovery_splash\` \`discovery_splash\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`explicit_content_filter\` \`explicit_content_filter\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP COLUMN \`primary_category_id\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD \`primary_category_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`icon\` \`icon\` varchar(255) NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET large = 0 WHERE large IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`large\` \`large\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`max_members\` \`max_members\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`max_presences\` \`max_presences\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`max_video_channel_users\` \`max_video_channel_users\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`member_count\` \`member_count\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`presence_count\` \`presence_count\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`template_id\` \`template_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`mfa_level\` \`mfa_level\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`preferred_locale\` \`preferred_locale\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`premium_subscription_count\` \`premium_subscription_count\` int NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET premium_tier = 0 WHERE premium_tier IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`premium_tier\` \`premium_tier\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`public_updates_channel_id\` \`public_updates_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`rules_channel_id\` \`rules_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`region\` \`region\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`splash\` \`splash\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`system_channel_id\` \`system_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`system_channel_flags\` \`system_channel_flags\` int NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET unavailable = 0 WHERE unavailable IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`unavailable\` \`unavailable\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`verification_level\` \`verification_level\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`widget_channel_id\` \`widget_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET widget_enabled = 0 WHERE widget_enabled IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`widget_enabled\` \`widget_enabled\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`nsfw_level\` \`nsfw_level\` int NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET nsfw = 0 WHERE nsfw IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`parent\` \`parent\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`premium_progress_bar_enabled\` \`premium_progress_bar_enabled\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` DROP FOREIGN KEY \`FK_c32c1ab1c4dc7dcb0278c4b1b8b\``, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` CHANGE \`icon\` \`icon\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` CHANGE \`unicode_emoji\` \`unicode_emoji\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` CHANGE \`tags\` \`tags\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_86b9109b155eb70c0a2ca3b4b6d\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_b193588441b085352a4c0109423\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_05535bc695e9f7ee104616459d3\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_b0525304f2262b7014245351c76\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_f83c04bcf1df4e5c0e7a52ed348\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_5d3ec1cb962de6488637fd779d6\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_61a92bb65b302a76d9c1fcd3174\``, + ); + await queryRunner.query( + `DROP INDEX \`IDX_3ed7a60fb7dbe04e1ba9332a8b\` ON \`messages\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`author_id\` \`author_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`member_id\` \`member_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`webhook_id\` \`webhook_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`content\` \`content\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`edited_timestamp\` \`edited_timestamp\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`tts\` \`tts\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`mention_everyone\` \`mention_everyone\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`nonce\` \`nonce\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`pinned\` \`pinned\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`activity\` \`activity\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`flags\` \`flags\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`message_reference\` \`message_reference\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`interaction\` \`interaction\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`components\` \`components\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`message_reference_id\` \`message_reference_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`nick\` \`nick\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` DROP COLUMN \`premium_since\``, + ); + await queryRunner.query( + `ALTER TABLE \`members\` ADD \`premium_since\` bigint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`joined_by\` \`joined_by\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`banner\` \`banner\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`communication_disabled_until\` \`communication_disabled_until\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`accent_color\` \`accent_color\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`banner\` \`banner\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`phone\` \`phone\` varchar(255) NULL`, + ); await queryRunner.query(`UPDATE users SET bio = "" WHERE bio IS NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`bio\` \`bio\` varchar(255) NOT NULL`); - await queryRunner.query(`UPDATE users SET mfa_enabled = 0 WHERE mfa_enabled IS NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`mfa_enabled\` \`mfa_enabled\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`totp_secret\` \`totp_secret\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`totp_last_ticket\` \`totp_last_ticket\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`premium_since\` \`premium_since\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`email\` \`email\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`team_members\` DROP FOREIGN KEY \`FK_fdad7d5768277e60c40e01cdcea\``); - await queryRunner.query(`ALTER TABLE \`team_members\` DROP FOREIGN KEY \`FK_c2bf4967c8c2a6b845dadfbf3d4\``); - await queryRunner.query(`ALTER TABLE \`team_members\` CHANGE \`team_id\` \`team_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`team_members\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`teams\` DROP FOREIGN KEY \`FK_13f00abf7cb6096c43ecaf8c108\``); - await queryRunner.query(`ALTER TABLE \`teams\` CHANGE \`icon\` \`icon\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`teams\` CHANGE \`owner_user_id\` \`owner_user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_e57508958bf92b9d9d25231b5e8\``); - await queryRunner.query(`ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_2ce5a55796fe4c2f77ece57a647\``); - await queryRunner.query(`ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_a36ed02953077f408d0f3ebc424\``); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`icon\` \`icon\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`summary\` \`summary\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`type\` \`type\` text NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`redirect_uris\` \`redirect_uris\` text NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`rpc_application_state\` \`rpc_application_state\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`store_application_state\` \`store_application_state\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`verification_state\` \`verification_state\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`interactions_endpoint_url\` \`interactions_endpoint_url\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`integration_public\` \`integration_public\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`integration_require_code_grant\` \`integration_require_code_grant\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`discoverability_state\` \`discoverability_state\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`discovery_eligibility_flags\` \`discovery_eligibility_flags\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`tags\` \`tags\` text NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`cover_image\` \`cover_image\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`install_params\` \`install_params\` text NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`terms_of_service_url\` \`terms_of_service_url\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`privacy_policy_url\` \`privacy_policy_url\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`bot_user_id\` \`bot_user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`team_id\` \`team_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`name\` \`name\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`token\` \`token\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_74e6689b9568cc965b8bfc9150\` ON \`notes\` (\`owner_id\`, \`target_id\`)`); - await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_3ed7a60fb7dbe04e1ba9332a8b\` ON \`messages\` (\`channel_id\`, \`id\`)`); - await queryRunner.query(`CREATE UNIQUE INDEX \`REL_0c14beb78d8c5ccba66072adbc\` ON \`users\` (\`settingsIndex\`)`); - await queryRunner.query(`ALTER TABLE \`connected_accounts\` ADD CONSTRAINT \`FK_f47244225a6a1eac04a3463dd90\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`attachments\` ADD CONSTRAINT \`FK_623e10eec51ada466c5038979e3\` FOREIGN KEY (\`message_id\`) REFERENCES \`messages\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` ADD CONSTRAINT \`FK_3cd01cd3ae7aab010310d96ac8e\` FOREIGN KEY (\`target_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` ADD CONSTRAINT \`FK_bd2726fd31b35443f2245b93ba0\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`backup_codes\` ADD CONSTRAINT \`FK_70066ea80d2f4b871beda32633b\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_5999e8e449f80a236ff72023559\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_9d3ab7dd180ebdd245cdb66ecad\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_07ad88c86d1f290d46748410d58\` FOREIGN KEY (\`executor_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_3f4939aa1461e8af57fea3fb05d\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_6a15b051fe5050aa00a4b9ff0f6\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_11a0d394f8fc649c19ce5f16b59\` FOREIGN KEY (\`target_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_03779ef216d4b0358470d9cb748\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_9f8d389866b40b6657edd026dd4\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_5fe1d5f931a67e85039c640001b\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_487a7af59d189f744fe394368fc\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_df528cf77e82f8032230e7e37d8\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_c3e5305461931763b56aa905f1c\` FOREIGN KEY (\`application_id\`) REFERENCES \`applications\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_0d523f6f997c86e052c49b1455f\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_3a285f4f49c40e0706d3018bc9f\` FOREIGN KEY (\`source_guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_c253dafe5f3a03ec00cd8fb4581\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_3274522d14af40540b1a883fc80\` FOREIGN KEY (\`parent_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_3873ed438575cce703ecff4fc7b\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`emojis\` ADD CONSTRAINT \`FK_fa7ddd5f9a214e28ce596548421\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`notes\` ADD CONSTRAINT \`FK_f9e103f8ae67cb1787063597925\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`notes\` ADD CONSTRAINT \`FK_23e08e5b4481711d573e1abecdc\` FOREIGN KEY (\`target_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`sessions\` ADD CONSTRAINT \`FK_085d540d9f418cfbdc7bd55bb19\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_e7cfa5cefa6661b3fb8fda8ce69\` FOREIGN KEY (\`pack_id\`) REFERENCES \`sticker_packs\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_193d551d852aca5347ef5c9f205\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_8f4ee73f2bb2325ff980502e158\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` ADD CONSTRAINT \`FK_448fafba4355ee1c837bbc865f1\` FOREIGN KEY (\`coverStickerId\`) REFERENCES \`stickers\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`templates\` ADD CONSTRAINT \`FK_d7374b7f8f5fbfdececa4fb62e1\` FOREIGN KEY (\`creator_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`templates\` ADD CONSTRAINT \`FK_445d00eaaea0e60a017a5ed0c11\` FOREIGN KEY (\`source_guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_f591a66b8019d87b0fe6c12dad6\` FOREIGN KEY (\`afk_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_e2a2f873a64a5cf62526de42325\` FOREIGN KEY (\`template_id\`) REFERENCES \`templates\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_fc1a451727e3643ca572a3bb394\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_8d450b016dc8bec35f36729e4b0\` FOREIGN KEY (\`public_updates_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_95828668aa333460582e0ca6396\` FOREIGN KEY (\`rules_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_cfc3d3ad260f8121c95b31a1fce\` FOREIGN KEY (\`system_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_9d1d665379eefde7876a17afa99\` FOREIGN KEY (\`widget_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`roles\` ADD CONSTRAINT \`FK_c32c1ab1c4dc7dcb0278c4b1b8b\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_86b9109b155eb70c0a2ca3b4b6d\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_b193588441b085352a4c0109423\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_05535bc695e9f7ee104616459d3\` FOREIGN KEY (\`author_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_b0525304f2262b7014245351c76\` FOREIGN KEY (\`member_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_f83c04bcf1df4e5c0e7a52ed348\` FOREIGN KEY (\`webhook_id\`) REFERENCES \`webhooks\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_5d3ec1cb962de6488637fd779d6\` FOREIGN KEY (\`application_id\`) REFERENCES \`applications\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_61a92bb65b302a76d9c1fcd3174\` FOREIGN KEY (\`message_reference_id\`) REFERENCES \`messages\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`users\` ADD CONSTRAINT \`FK_0c14beb78d8c5ccba66072adbc7\` FOREIGN KEY (\`settingsIndex\`) REFERENCES \`user_settings\`(\`index\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`team_members\` ADD CONSTRAINT \`FK_fdad7d5768277e60c40e01cdcea\` FOREIGN KEY (\`team_id\`) REFERENCES \`teams\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`team_members\` ADD CONSTRAINT \`FK_c2bf4967c8c2a6b845dadfbf3d4\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`teams\` ADD CONSTRAINT \`FK_13f00abf7cb6096c43ecaf8c108\` FOREIGN KEY (\`owner_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_e57508958bf92b9d9d25231b5e8\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_2ce5a55796fe4c2f77ece57a647\` FOREIGN KEY (\`bot_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_a36ed02953077f408d0f3ebc424\` FOREIGN KEY (\`team_id\`) REFERENCES \`teams\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - } + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`bio\` \`bio\` varchar(255) NOT NULL`, + ); + await queryRunner.query( + `UPDATE users SET mfa_enabled = 0 WHERE mfa_enabled IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`mfa_enabled\` \`mfa_enabled\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`totp_secret\` \`totp_secret\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`totp_last_ticket\` \`totp_last_ticket\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`premium_since\` \`premium_since\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`email\` \`email\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` DROP FOREIGN KEY \`FK_fdad7d5768277e60c40e01cdcea\``, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` DROP FOREIGN KEY \`FK_c2bf4967c8c2a6b845dadfbf3d4\``, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` CHANGE \`team_id\` \`team_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`teams\` DROP FOREIGN KEY \`FK_13f00abf7cb6096c43ecaf8c108\``, + ); + await queryRunner.query( + `ALTER TABLE \`teams\` CHANGE \`icon\` \`icon\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`teams\` CHANGE \`owner_user_id\` \`owner_user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_e57508958bf92b9d9d25231b5e8\``, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_2ce5a55796fe4c2f77ece57a647\``, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_a36ed02953077f408d0f3ebc424\``, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`icon\` \`icon\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`summary\` \`summary\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`type\` \`type\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`redirect_uris\` \`redirect_uris\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`rpc_application_state\` \`rpc_application_state\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`store_application_state\` \`store_application_state\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`verification_state\` \`verification_state\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`interactions_endpoint_url\` \`interactions_endpoint_url\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`integration_public\` \`integration_public\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`integration_require_code_grant\` \`integration_require_code_grant\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`discoverability_state\` \`discoverability_state\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`discovery_eligibility_flags\` \`discovery_eligibility_flags\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`tags\` \`tags\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`cover_image\` \`cover_image\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`install_params\` \`install_params\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`terms_of_service_url\` \`terms_of_service_url\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`privacy_policy_url\` \`privacy_policy_url\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`bot_user_id\` \`bot_user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`team_id\` \`team_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`name\` \`name\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`token\` \`token\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX \`IDX_74e6689b9568cc965b8bfc9150\` ON \`notes\` (\`owner_id\`, \`target_id\`)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX \`IDX_3ed7a60fb7dbe04e1ba9332a8b\` ON \`messages\` (\`channel_id\`, \`id\`)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX \`REL_0c14beb78d8c5ccba66072adbc\` ON \`users\` (\`settingsIndex\`)`, + ); + await queryRunner.query( + `ALTER TABLE \`connected_accounts\` ADD CONSTRAINT \`FK_f47244225a6a1eac04a3463dd90\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` ADD CONSTRAINT \`FK_623e10eec51ada466c5038979e3\` FOREIGN KEY (\`message_id\`) REFERENCES \`messages\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` ADD CONSTRAINT \`FK_3cd01cd3ae7aab010310d96ac8e\` FOREIGN KEY (\`target_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` ADD CONSTRAINT \`FK_bd2726fd31b35443f2245b93ba0\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`backup_codes\` ADD CONSTRAINT \`FK_70066ea80d2f4b871beda32633b\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_5999e8e449f80a236ff72023559\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_9d3ab7dd180ebdd245cdb66ecad\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_07ad88c86d1f290d46748410d58\` FOREIGN KEY (\`executor_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_3f4939aa1461e8af57fea3fb05d\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_6a15b051fe5050aa00a4b9ff0f6\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_11a0d394f8fc649c19ce5f16b59\` FOREIGN KEY (\`target_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_03779ef216d4b0358470d9cb748\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_9f8d389866b40b6657edd026dd4\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_5fe1d5f931a67e85039c640001b\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_487a7af59d189f744fe394368fc\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_df528cf77e82f8032230e7e37d8\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_c3e5305461931763b56aa905f1c\` FOREIGN KEY (\`application_id\`) REFERENCES \`applications\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_0d523f6f997c86e052c49b1455f\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_3a285f4f49c40e0706d3018bc9f\` FOREIGN KEY (\`source_guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_c253dafe5f3a03ec00cd8fb4581\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_3274522d14af40540b1a883fc80\` FOREIGN KEY (\`parent_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_3873ed438575cce703ecff4fc7b\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`emojis\` ADD CONSTRAINT \`FK_fa7ddd5f9a214e28ce596548421\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` ADD CONSTRAINT \`FK_f9e103f8ae67cb1787063597925\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` ADD CONSTRAINT \`FK_23e08e5b4481711d573e1abecdc\` FOREIGN KEY (\`target_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`sessions\` ADD CONSTRAINT \`FK_085d540d9f418cfbdc7bd55bb19\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_e7cfa5cefa6661b3fb8fda8ce69\` FOREIGN KEY (\`pack_id\`) REFERENCES \`sticker_packs\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_193d551d852aca5347ef5c9f205\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_8f4ee73f2bb2325ff980502e158\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` ADD CONSTRAINT \`FK_448fafba4355ee1c837bbc865f1\` FOREIGN KEY (\`coverStickerId\`) REFERENCES \`stickers\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` ADD CONSTRAINT \`FK_d7374b7f8f5fbfdececa4fb62e1\` FOREIGN KEY (\`creator_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` ADD CONSTRAINT \`FK_445d00eaaea0e60a017a5ed0c11\` FOREIGN KEY (\`source_guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_f591a66b8019d87b0fe6c12dad6\` FOREIGN KEY (\`afk_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_e2a2f873a64a5cf62526de42325\` FOREIGN KEY (\`template_id\`) REFERENCES \`templates\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_fc1a451727e3643ca572a3bb394\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_8d450b016dc8bec35f36729e4b0\` FOREIGN KEY (\`public_updates_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_95828668aa333460582e0ca6396\` FOREIGN KEY (\`rules_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_cfc3d3ad260f8121c95b31a1fce\` FOREIGN KEY (\`system_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_9d1d665379eefde7876a17afa99\` FOREIGN KEY (\`widget_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` ADD CONSTRAINT \`FK_c32c1ab1c4dc7dcb0278c4b1b8b\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_86b9109b155eb70c0a2ca3b4b6d\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_b193588441b085352a4c0109423\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_05535bc695e9f7ee104616459d3\` FOREIGN KEY (\`author_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_b0525304f2262b7014245351c76\` FOREIGN KEY (\`member_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_f83c04bcf1df4e5c0e7a52ed348\` FOREIGN KEY (\`webhook_id\`) REFERENCES \`webhooks\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_5d3ec1cb962de6488637fd779d6\` FOREIGN KEY (\`application_id\`) REFERENCES \`applications\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_61a92bb65b302a76d9c1fcd3174\` FOREIGN KEY (\`message_reference_id\`) REFERENCES \`messages\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD CONSTRAINT \`FK_0c14beb78d8c5ccba66072adbc7\` FOREIGN KEY (\`settingsIndex\`) REFERENCES \`user_settings\`(\`index\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` ADD CONSTRAINT \`FK_fdad7d5768277e60c40e01cdcea\` FOREIGN KEY (\`team_id\`) REFERENCES \`teams\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` ADD CONSTRAINT \`FK_c2bf4967c8c2a6b845dadfbf3d4\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`teams\` ADD CONSTRAINT \`FK_13f00abf7cb6096c43ecaf8c108\` FOREIGN KEY (\`owner_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_e57508958bf92b9d9d25231b5e8\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_2ce5a55796fe4c2f77ece57a647\` FOREIGN KEY (\`bot_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_a36ed02953077f408d0f3ebc424\` FOREIGN KEY (\`team_id\`) REFERENCES \`teams\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } - async down(queryRunner) {} -} + async down(queryRunner) {} +}; diff --git a/scripts/stagingMigration/mysql/1672833135670-staging.js b/scripts/stagingMigration/mysql/1672833135670-staging.js index e3745f59..ce0c1ed8 100644 --- a/scripts/stagingMigration/mysql/1672833135670-staging.js +++ b/scripts/stagingMigration/mysql/1672833135670-staging.js @@ -1,375 +1,1103 @@ const { MigrationInterface, QueryRunner } = require("typeorm"); module.exports = class staging1672833135670 { - name = 'staging1672833135670' + name = "staging1672833135670"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE \`users\` DROP FOREIGN KEY \`FK_76ba283779c8441fd5ff819c8cf\``); - await queryRunner.query(`DROP INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\``); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`id\` \`index\` varchar(255) NOT NULL`); - await queryRunner.query(`CREATE TABLE \`embed_cache\` (\`id\` varchar(255) NOT NULL, \`url\` varchar(255) NOT NULL, \`embed\` text NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query(`CREATE TABLE \`security_settings\` (\`id\` varchar(255) NOT NULL, \`guild_id\` varchar(255) NULL, \`channel_id\` varchar(255) NULL, \`encryption_permission_mask\` int NOT NULL, \`allowed_algorithms\` text NOT NULL, \`current_algorithm\` varchar(255) NOT NULL, \`used_since_message\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); - await queryRunner.query(`ALTER TABLE \`client_release\` DROP COLUMN \`deb_url\``); - await queryRunner.query(`ALTER TABLE \`client_release\` DROP COLUMN \`osx_url\``); - await queryRunner.query(`ALTER TABLE \`client_release\` DROP COLUMN \`win_url\``); - await queryRunner.query(`ALTER TABLE \`users\` DROP COLUMN \`settingsId\``); - await queryRunner.query(`ALTER TABLE \`client_release\` ADD \`platform\` varchar(255) NOT NULL`); - await queryRunner.query(`ALTER TABLE \`client_release\` ADD \`enabled\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`users\` ADD \`purchased_flags\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`users\` ADD \`premium_usage_flags\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`users\` ADD \`settingsIndex\` int NULL`); - await queryRunner.query(`ALTER TABLE \`users\` ADD UNIQUE INDEX \`IDX_0c14beb78d8c5ccba66072adbc\` (\`settingsIndex\`)`); - await queryRunner.query(`ALTER TABLE \`config\` CHANGE \`value\` \`value\` text NULL`); - await queryRunner.query(`ALTER TABLE \`relationships\` CHANGE \`nickname\` \`nickname\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`connected_accounts\` DROP FOREIGN KEY \`FK_f47244225a6a1eac04a3463dd90\``); - await queryRunner.query(`ALTER TABLE \`connected_accounts\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`attachments\` DROP FOREIGN KEY \`FK_623e10eec51ada466c5038979e3\``); - await queryRunner.query(`ALTER TABLE \`attachments\` CHANGE \`height\` \`height\` int NULL`); - await queryRunner.query(`ALTER TABLE \`attachments\` CHANGE \`width\` \`width\` int NULL`); - await queryRunner.query(`ALTER TABLE \`attachments\` CHANGE \`content_type\` \`content_type\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`attachments\` CHANGE \`message_id\` \`message_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` DROP FOREIGN KEY \`FK_bd2726fd31b35443f2245b93ba0\``); - await queryRunner.query(`ALTER TABLE \`audit_logs\` DROP FOREIGN KEY \`FK_3cd01cd3ae7aab010310d96ac8e\``); - await queryRunner.query(`ALTER TABLE \`audit_logs\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` CHANGE \`options\` \`options\` text NULL`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` CHANGE \`reason\` \`reason\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` CHANGE \`target_id\` \`target_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`backup_codes\` DROP FOREIGN KEY \`FK_70066ea80d2f4b871beda32633b\``); - await queryRunner.query(`ALTER TABLE \`backup_codes\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_5999e8e449f80a236ff72023559\``); - await queryRunner.query(`ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_9d3ab7dd180ebdd245cdb66ecad\``); - await queryRunner.query(`ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_07ad88c86d1f290d46748410d58\``); - await queryRunner.query(`ALTER TABLE \`bans\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`bans\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`bans\` CHANGE \`executor_id\` \`executor_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`bans\` CHANGE \`reason\` \`reason\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`categories\` CHANGE \`name\` \`name\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`categories\` CHANGE \`is_primary\` \`is_primary\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`client_release\` DROP COLUMN \`pub_date\``); - await queryRunner.query(`ALTER TABLE \`client_release\` ADD \`pub_date\` datetime NOT NULL`); - await queryRunner.query(`ALTER TABLE \`client_release\` CHANGE \`notes\` \`notes\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`public_ack\` \`public_ack\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`notifications_cursor\` \`notifications_cursor\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`last_pin_timestamp\` \`last_pin_timestamp\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`read_states\` CHANGE \`mention_count\` \`mention_count\` int NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_3f4939aa1461e8af57fea3fb05d\``); - await queryRunner.query(`ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_6a15b051fe5050aa00a4b9ff0f6\``); - await queryRunner.query(`ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\``); - await queryRunner.query(`ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_11a0d394f8fc649c19ce5f16b59\``); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`inviter_id\` \`inviter_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`target_user_id\` \`target_user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`target_user_type\` \`target_user_type\` int NULL`); - await queryRunner.query(`ALTER TABLE \`invites\` CHANGE \`vanity_url\` \`vanity_url\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_03779ef216d4b0358470d9cb748\``); - await queryRunner.query(`ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_9f8d389866b40b6657edd026dd4\``); - await queryRunner.query(`ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_5fe1d5f931a67e85039c640001b\``); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`token\` \`token\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`self_stream\` \`self_stream\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`voice_states\` CHANGE \`request_to_speak_timestamp\` \`request_to_speak_timestamp\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_487a7af59d189f744fe394368fc\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_df528cf77e82f8032230e7e37d8\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_c3e5305461931763b56aa905f1c\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_0d523f6f997c86e052c49b1455f\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_3a285f4f49c40e0706d3018bc9f\``); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`name\` \`name\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`token\` \`token\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_c253dafe5f3a03ec00cd8fb4581\``); - await queryRunner.query(`ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_3274522d14af40540b1a883fc80\``); - await queryRunner.query(`ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_3873ed438575cce703ecff4fc7b\``); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`name\` \`name\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`icon\` \`icon\` text NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`parent_id\` \`parent_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`last_pin_timestamp\` \`last_pin_timestamp\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`default_auto_archive_duration\` \`default_auto_archive_duration\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`position\` \`position\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`permission_overwrites\` \`permission_overwrites\` text NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`video_quality_mode\` \`video_quality_mode\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`bitrate\` \`bitrate\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`user_limit\` \`user_limit\` int NULL`); - await queryRunner.query(`UPDATE channels SET nsfw = 0 WHERE nsfw IS NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`rate_limit_per_user\` \`rate_limit_per_user\` int NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`topic\` \`topic\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`retention_policy_id\` \`retention_policy_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`flags\` \`flags\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`channels\` CHANGE \`default_thread_rate_limit_per_user\` \`default_thread_rate_limit_per_user\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`emojis\` DROP FOREIGN KEY \`FK_fa7ddd5f9a214e28ce596548421\``); - await queryRunner.query(`ALTER TABLE \`emojis\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`emojis\` CHANGE \`groups\` \`groups\` text NULL`); - await queryRunner.query(`ALTER TABLE \`notes\` DROP FOREIGN KEY \`FK_f9e103f8ae67cb1787063597925\``); - await queryRunner.query(`ALTER TABLE \`notes\` DROP FOREIGN KEY \`FK_23e08e5b4481711d573e1abecdc\``); - await queryRunner.query(`DROP INDEX \`IDX_74e6689b9568cc965b8bfc9150\` ON \`notes\``); - await queryRunner.query(`ALTER TABLE \`notes\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`notes\` CHANGE \`target_id\` \`target_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sessions\` DROP FOREIGN KEY \`FK_085d540d9f418cfbdc7bd55bb19\``); - await queryRunner.query(`ALTER TABLE \`sessions\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sessions\` CHANGE \`activities\` \`activities\` text NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_e7cfa5cefa6661b3fb8fda8ce69\``); - await queryRunner.query(`ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_193d551d852aca5347ef5c9f205\``); - await queryRunner.query(`ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_8f4ee73f2bb2325ff980502e158\``); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`available\` \`available\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`tags\` \`tags\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`pack_id\` \`pack_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`stickers\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` DROP FOREIGN KEY \`FK_448fafba4355ee1c837bbc865f1\``); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` CHANGE \`banner_asset_id\` \`banner_asset_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` CHANGE \`cover_sticker_id\` \`cover_sticker_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` CHANGE \`coverStickerId\` \`coverStickerId\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`templates\` DROP FOREIGN KEY \`FK_d7374b7f8f5fbfdececa4fb62e1\``); - await queryRunner.query(`ALTER TABLE \`templates\` DROP FOREIGN KEY \`FK_445d00eaaea0e60a017a5ed0c11\``); - await queryRunner.query(`ALTER TABLE \`templates\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`templates\` CHANGE \`usage_count\` \`usage_count\` int NULL`); - await queryRunner.query(`ALTER TABLE \`templates\` CHANGE \`creator_id\` \`creator_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`templates\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` DROP PRIMARY KEY`); - await queryRunner.query(`ALTER TABLE \`user_settings\` DROP COLUMN \`index\``); - await queryRunner.query(`ALTER TABLE \`user_settings\` ADD \`index\` int NOT NULL PRIMARY KEY AUTO_INCREMENT`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`afk_timeout\` \`afk_timeout\` int NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`allow_accessibility_detection\` \`allow_accessibility_detection\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`animate_emoji\` \`animate_emoji\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`animate_stickers\` \`animate_stickers\` int NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`contact_sync_enabled\` \`contact_sync_enabled\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`convert_emoticons\` \`convert_emoticons\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`custom_status\` \`custom_status\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`default_guilds_restricted\` \`default_guilds_restricted\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`detect_platform_accounts\` \`detect_platform_accounts\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`developer_mode\` \`developer_mode\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`disable_games_tab\` \`disable_games_tab\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`enable_tts_command\` \`enable_tts_command\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`explicit_content_filter\` \`explicit_content_filter\` int NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`friend_source_flags\` \`friend_source_flags\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`gateway_connected\` \`gateway_connected\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`gif_auto_play\` \`gif_auto_play\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`guild_folders\` \`guild_folders\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`guild_positions\` \`guild_positions\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`inline_attachment_media\` \`inline_attachment_media\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`inline_embed_media\` \`inline_embed_media\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`locale\` \`locale\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`message_display_compact\` \`message_display_compact\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`native_phone_integration_enabled\` \`native_phone_integration_enabled\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`render_embeds\` \`render_embeds\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`render_reactions\` \`render_reactions\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`restricted_guilds\` \`restricted_guilds\` text NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`show_current_game\` \`show_current_game\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`status\` \`status\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`stream_notifications_enabled\` \`stream_notifications_enabled\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`theme\` \`theme\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`user_settings\` CHANGE \`timezone_offset\` \`timezone_offset\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_f591a66b8019d87b0fe6c12dad6\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_e2a2f873a64a5cf62526de42325\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_fc1a451727e3643ca572a3bb394\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_8d450b016dc8bec35f36729e4b0\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_95828668aa333460582e0ca6396\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_cfc3d3ad260f8121c95b31a1fce\``); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_9d1d665379eefde7876a17afa99\``); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`afk_channel_id\` \`afk_channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`afk_timeout\` \`afk_timeout\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`banner\` \`banner\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`default_message_notifications\` \`default_message_notifications\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`discovery_splash\` \`discovery_splash\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`explicit_content_filter\` \`explicit_content_filter\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` DROP COLUMN \`primary_category_id\``); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD \`primary_category_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`icon\` \`icon\` varchar(255) NULL`); - await queryRunner.query(`UPDATE guilds SET large = 0 WHERE large IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`large\` \`large\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`max_members\` \`max_members\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`max_presences\` \`max_presences\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`max_video_channel_users\` \`max_video_channel_users\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`member_count\` \`member_count\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`presence_count\` \`presence_count\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`template_id\` \`template_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`mfa_level\` \`mfa_level\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`preferred_locale\` \`preferred_locale\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`premium_subscription_count\` \`premium_subscription_count\` int NULL`); - await queryRunner.query(`UPDATE guilds SET premium_tier = 0 WHERE premium_tier IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`premium_tier\` \`premium_tier\` int NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`public_updates_channel_id\` \`public_updates_channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`rules_channel_id\` \`rules_channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`region\` \`region\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`splash\` \`splash\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`system_channel_id\` \`system_channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`system_channel_flags\` \`system_channel_flags\` int NULL`); - await queryRunner.query(`UPDATE guilds SET unavailable = 0 WHERE unavailable IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`unavailable\` \`unavailable\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`verification_level\` \`verification_level\` int NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`widget_channel_id\` \`widget_channel_id\` varchar(255) NULL`); - await queryRunner.query(`UPDATE guilds SET widget_enabled = 0 WHERE widget_enabled IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`widget_enabled\` \`widget_enabled\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`nsfw_level\` \`nsfw_level\` int NULL`); - await queryRunner.query(`UPDATE guilds SET nsfw = 0 WHERE nsfw IS NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`parent\` \`parent\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`guilds\` CHANGE \`premium_progress_bar_enabled\` \`premium_progress_bar_enabled\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`roles\` DROP FOREIGN KEY \`FK_c32c1ab1c4dc7dcb0278c4b1b8b\``); - await queryRunner.query(`ALTER TABLE \`roles\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`roles\` CHANGE \`icon\` \`icon\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`roles\` CHANGE \`unicode_emoji\` \`unicode_emoji\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`roles\` CHANGE \`tags\` \`tags\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_86b9109b155eb70c0a2ca3b4b6d\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_b193588441b085352a4c0109423\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_05535bc695e9f7ee104616459d3\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_b0525304f2262b7014245351c76\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_f83c04bcf1df4e5c0e7a52ed348\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_5d3ec1cb962de6488637fd779d6\``); - await queryRunner.query(`ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_61a92bb65b302a76d9c1fcd3174\``); - await queryRunner.query(`DROP INDEX \`IDX_3ed7a60fb7dbe04e1ba9332a8b\` ON \`messages\``); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`author_id\` \`author_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`member_id\` \`member_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`webhook_id\` \`webhook_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`content\` \`content\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`edited_timestamp\` \`edited_timestamp\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`tts\` \`tts\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`mention_everyone\` \`mention_everyone\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`nonce\` \`nonce\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`pinned\` \`pinned\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`activity\` \`activity\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`flags\` \`flags\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`message_reference\` \`message_reference\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`interaction\` \`interaction\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`components\` \`components\` text NULL`); - await queryRunner.query(`ALTER TABLE \`messages\` CHANGE \`message_reference_id\` \`message_reference_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`nick\` \`nick\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` DROP COLUMN \`premium_since\``); - await queryRunner.query(`ALTER TABLE \`members\` ADD \`premium_since\` bigint NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`joined_by\` \`joined_by\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`banner\` \`banner\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`members\` CHANGE \`communication_disabled_until\` \`communication_disabled_until\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`accent_color\` \`accent_color\` int NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`banner\` \`banner\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`phone\` \`phone\` varchar(255) NULL`); + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE \`users\` DROP FOREIGN KEY \`FK_76ba283779c8441fd5ff819c8cf\``, + ); + await queryRunner.query( + `DROP INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\``, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`id\` \`index\` varchar(255) NOT NULL`, + ); + await queryRunner.query( + `CREATE TABLE \`embed_cache\` (\`id\` varchar(255) NOT NULL, \`url\` varchar(255) NOT NULL, \`embed\` text NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`, + ); + await queryRunner.query( + `CREATE TABLE \`security_settings\` (\`id\` varchar(255) NOT NULL, \`guild_id\` varchar(255) NULL, \`channel_id\` varchar(255) NULL, \`encryption_permission_mask\` int NOT NULL, \`allowed_algorithms\` text NOT NULL, \`current_algorithm\` varchar(255) NOT NULL, \`used_since_message\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` DROP COLUMN \`deb_url\``, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` DROP COLUMN \`osx_url\``, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` DROP COLUMN \`win_url\``, + ); + await queryRunner.query( + `ALTER TABLE \`users\` DROP COLUMN \`settingsId\``, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` ADD \`platform\` varchar(255) NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` ADD \`enabled\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD \`purchased_flags\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD \`premium_usage_flags\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD \`settingsIndex\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD UNIQUE INDEX \`IDX_0c14beb78d8c5ccba66072adbc\` (\`settingsIndex\`)`, + ); + await queryRunner.query( + `ALTER TABLE \`config\` CHANGE \`value\` \`value\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`relationships\` CHANGE \`nickname\` \`nickname\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`connected_accounts\` DROP FOREIGN KEY \`FK_f47244225a6a1eac04a3463dd90\``, + ); + await queryRunner.query( + `ALTER TABLE \`connected_accounts\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` DROP FOREIGN KEY \`FK_623e10eec51ada466c5038979e3\``, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` CHANGE \`height\` \`height\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` CHANGE \`width\` \`width\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` CHANGE \`content_type\` \`content_type\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` CHANGE \`message_id\` \`message_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` DROP FOREIGN KEY \`FK_bd2726fd31b35443f2245b93ba0\``, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` DROP FOREIGN KEY \`FK_3cd01cd3ae7aab010310d96ac8e\``, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` CHANGE \`options\` \`options\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` CHANGE \`reason\` \`reason\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` CHANGE \`target_id\` \`target_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`backup_codes\` DROP FOREIGN KEY \`FK_70066ea80d2f4b871beda32633b\``, + ); + await queryRunner.query( + `ALTER TABLE \`backup_codes\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_5999e8e449f80a236ff72023559\``, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_9d3ab7dd180ebdd245cdb66ecad\``, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` DROP FOREIGN KEY \`FK_07ad88c86d1f290d46748410d58\``, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` CHANGE \`executor_id\` \`executor_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` CHANGE \`reason\` \`reason\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`categories\` CHANGE \`name\` \`name\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`categories\` CHANGE \`is_primary\` \`is_primary\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` DROP COLUMN \`pub_date\``, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` ADD \`pub_date\` datetime NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`client_release\` CHANGE \`notes\` \`notes\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`public_ack\` \`public_ack\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`notifications_cursor\` \`notifications_cursor\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`last_pin_timestamp\` \`last_pin_timestamp\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`read_states\` CHANGE \`mention_count\` \`mention_count\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_3f4939aa1461e8af57fea3fb05d\``, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_6a15b051fe5050aa00a4b9ff0f6\``, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\``, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_11a0d394f8fc649c19ce5f16b59\``, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`inviter_id\` \`inviter_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`target_user_id\` \`target_user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`target_user_type\` \`target_user_type\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` CHANGE \`vanity_url\` \`vanity_url\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_03779ef216d4b0358470d9cb748\``, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_9f8d389866b40b6657edd026dd4\``, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` DROP FOREIGN KEY \`FK_5fe1d5f931a67e85039c640001b\``, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`token\` \`token\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`self_stream\` \`self_stream\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` CHANGE \`request_to_speak_timestamp\` \`request_to_speak_timestamp\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_487a7af59d189f744fe394368fc\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_df528cf77e82f8032230e7e37d8\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_c3e5305461931763b56aa905f1c\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_0d523f6f997c86e052c49b1455f\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` DROP FOREIGN KEY \`FK_3a285f4f49c40e0706d3018bc9f\``, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`name\` \`name\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`token\` \`token\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_c253dafe5f3a03ec00cd8fb4581\``, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_3274522d14af40540b1a883fc80\``, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` DROP FOREIGN KEY \`FK_3873ed438575cce703ecff4fc7b\``, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`name\` \`name\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`icon\` \`icon\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`parent_id\` \`parent_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`last_pin_timestamp\` \`last_pin_timestamp\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`default_auto_archive_duration\` \`default_auto_archive_duration\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`position\` \`position\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`permission_overwrites\` \`permission_overwrites\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`video_quality_mode\` \`video_quality_mode\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`bitrate\` \`bitrate\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`user_limit\` \`user_limit\` int NULL`, + ); + await queryRunner.query( + `UPDATE channels SET nsfw = 0 WHERE nsfw IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`rate_limit_per_user\` \`rate_limit_per_user\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`topic\` \`topic\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`retention_policy_id\` \`retention_policy_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`flags\` \`flags\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` CHANGE \`default_thread_rate_limit_per_user\` \`default_thread_rate_limit_per_user\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`emojis\` DROP FOREIGN KEY \`FK_fa7ddd5f9a214e28ce596548421\``, + ); + await queryRunner.query( + `ALTER TABLE \`emojis\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`emojis\` CHANGE \`groups\` \`groups\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` DROP FOREIGN KEY \`FK_f9e103f8ae67cb1787063597925\``, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` DROP FOREIGN KEY \`FK_23e08e5b4481711d573e1abecdc\``, + ); + await queryRunner.query( + `DROP INDEX \`IDX_74e6689b9568cc965b8bfc9150\` ON \`notes\``, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` CHANGE \`target_id\` \`target_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sessions\` DROP FOREIGN KEY \`FK_085d540d9f418cfbdc7bd55bb19\``, + ); + await queryRunner.query( + `ALTER TABLE \`sessions\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sessions\` CHANGE \`activities\` \`activities\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_e7cfa5cefa6661b3fb8fda8ce69\``, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_193d551d852aca5347ef5c9f205\``, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` DROP FOREIGN KEY \`FK_8f4ee73f2bb2325ff980502e158\``, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`available\` \`available\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`tags\` \`tags\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`pack_id\` \`pack_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` DROP FOREIGN KEY \`FK_448fafba4355ee1c837bbc865f1\``, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` CHANGE \`banner_asset_id\` \`banner_asset_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` CHANGE \`cover_sticker_id\` \`cover_sticker_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` CHANGE \`coverStickerId\` \`coverStickerId\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` DROP FOREIGN KEY \`FK_d7374b7f8f5fbfdececa4fb62e1\``, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` DROP FOREIGN KEY \`FK_445d00eaaea0e60a017a5ed0c11\``, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` CHANGE \`usage_count\` \`usage_count\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` CHANGE \`creator_id\` \`creator_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` DROP PRIMARY KEY`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` DROP COLUMN \`index\``, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` ADD \`index\` int NOT NULL PRIMARY KEY AUTO_INCREMENT`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`afk_timeout\` \`afk_timeout\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`allow_accessibility_detection\` \`allow_accessibility_detection\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`animate_emoji\` \`animate_emoji\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`animate_stickers\` \`animate_stickers\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`contact_sync_enabled\` \`contact_sync_enabled\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`convert_emoticons\` \`convert_emoticons\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`custom_status\` \`custom_status\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`default_guilds_restricted\` \`default_guilds_restricted\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`detect_platform_accounts\` \`detect_platform_accounts\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`developer_mode\` \`developer_mode\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`disable_games_tab\` \`disable_games_tab\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`enable_tts_command\` \`enable_tts_command\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`explicit_content_filter\` \`explicit_content_filter\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`friend_source_flags\` \`friend_source_flags\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`gateway_connected\` \`gateway_connected\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`gif_auto_play\` \`gif_auto_play\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`guild_folders\` \`guild_folders\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`guild_positions\` \`guild_positions\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`inline_attachment_media\` \`inline_attachment_media\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`inline_embed_media\` \`inline_embed_media\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`locale\` \`locale\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`message_display_compact\` \`message_display_compact\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`native_phone_integration_enabled\` \`native_phone_integration_enabled\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`render_embeds\` \`render_embeds\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`render_reactions\` \`render_reactions\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`restricted_guilds\` \`restricted_guilds\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`show_current_game\` \`show_current_game\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`status\` \`status\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`stream_notifications_enabled\` \`stream_notifications_enabled\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`theme\` \`theme\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`user_settings\` CHANGE \`timezone_offset\` \`timezone_offset\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_f591a66b8019d87b0fe6c12dad6\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_e2a2f873a64a5cf62526de42325\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_fc1a451727e3643ca572a3bb394\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_8d450b016dc8bec35f36729e4b0\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_95828668aa333460582e0ca6396\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_cfc3d3ad260f8121c95b31a1fce\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP FOREIGN KEY \`FK_9d1d665379eefde7876a17afa99\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`afk_channel_id\` \`afk_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`afk_timeout\` \`afk_timeout\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`banner\` \`banner\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`default_message_notifications\` \`default_message_notifications\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`discovery_splash\` \`discovery_splash\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`explicit_content_filter\` \`explicit_content_filter\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` DROP COLUMN \`primary_category_id\``, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD \`primary_category_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`icon\` \`icon\` varchar(255) NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET large = 0 WHERE large IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`large\` \`large\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`max_members\` \`max_members\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`max_presences\` \`max_presences\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`max_video_channel_users\` \`max_video_channel_users\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`member_count\` \`member_count\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`presence_count\` \`presence_count\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`template_id\` \`template_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`mfa_level\` \`mfa_level\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`preferred_locale\` \`preferred_locale\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`premium_subscription_count\` \`premium_subscription_count\` int NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET premium_tier = 0 WHERE premium_tier IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`premium_tier\` \`premium_tier\` int NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`public_updates_channel_id\` \`public_updates_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`rules_channel_id\` \`rules_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`region\` \`region\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`splash\` \`splash\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`system_channel_id\` \`system_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`system_channel_flags\` \`system_channel_flags\` int NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET unavailable = 0 WHERE unavailable IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`unavailable\` \`unavailable\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`verification_level\` \`verification_level\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`widget_channel_id\` \`widget_channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET widget_enabled = 0 WHERE widget_enabled IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`widget_enabled\` \`widget_enabled\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`nsfw_level\` \`nsfw_level\` int NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET nsfw = 0 WHERE nsfw IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`parent\` \`parent\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` CHANGE \`premium_progress_bar_enabled\` \`premium_progress_bar_enabled\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` DROP FOREIGN KEY \`FK_c32c1ab1c4dc7dcb0278c4b1b8b\``, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` CHANGE \`icon\` \`icon\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` CHANGE \`unicode_emoji\` \`unicode_emoji\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` CHANGE \`tags\` \`tags\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_86b9109b155eb70c0a2ca3b4b6d\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_b193588441b085352a4c0109423\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_05535bc695e9f7ee104616459d3\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_b0525304f2262b7014245351c76\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_f83c04bcf1df4e5c0e7a52ed348\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_5d3ec1cb962de6488637fd779d6\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` DROP FOREIGN KEY \`FK_61a92bb65b302a76d9c1fcd3174\``, + ); + await queryRunner.query( + `DROP INDEX \`IDX_3ed7a60fb7dbe04e1ba9332a8b\` ON \`messages\``, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`author_id\` \`author_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`member_id\` \`member_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`webhook_id\` \`webhook_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`content\` \`content\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`edited_timestamp\` \`edited_timestamp\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`tts\` \`tts\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`mention_everyone\` \`mention_everyone\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`nonce\` \`nonce\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`pinned\` \`pinned\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`activity\` \`activity\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`flags\` \`flags\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`message_reference\` \`message_reference\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`interaction\` \`interaction\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`components\` \`components\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` CHANGE \`message_reference_id\` \`message_reference_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`nick\` \`nick\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` DROP COLUMN \`premium_since\``, + ); + await queryRunner.query( + `ALTER TABLE \`members\` ADD \`premium_since\` bigint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`last_message_id\` \`last_message_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`joined_by\` \`joined_by\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`banner\` \`banner\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`members\` CHANGE \`communication_disabled_until\` \`communication_disabled_until\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`accent_color\` \`accent_color\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`banner\` \`banner\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`phone\` \`phone\` varchar(255) NULL`, + ); await queryRunner.query(`UPDATE users SET bio = "" WHERE bio IS NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`bio\` \`bio\` varchar(255) NOT NULL`); - await queryRunner.query(`UPDATE users SET mfa_enabled = 0 WHERE mfa_enabled IS NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`mfa_enabled\` \`mfa_enabled\` tinyint NOT NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`totp_secret\` \`totp_secret\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`totp_last_ticket\` \`totp_last_ticket\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`premium_since\` \`premium_since\` datetime NULL`); - await queryRunner.query(`ALTER TABLE \`users\` CHANGE \`email\` \`email\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`team_members\` DROP FOREIGN KEY \`FK_fdad7d5768277e60c40e01cdcea\``); - await queryRunner.query(`ALTER TABLE \`team_members\` DROP FOREIGN KEY \`FK_c2bf4967c8c2a6b845dadfbf3d4\``); - await queryRunner.query(`ALTER TABLE \`team_members\` CHANGE \`team_id\` \`team_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`team_members\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`teams\` DROP FOREIGN KEY \`FK_13f00abf7cb6096c43ecaf8c108\``); - await queryRunner.query(`ALTER TABLE \`teams\` CHANGE \`icon\` \`icon\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`teams\` CHANGE \`owner_user_id\` \`owner_user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_e57508958bf92b9d9d25231b5e8\``); - await queryRunner.query(`ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_2ce5a55796fe4c2f77ece57a647\``); - await queryRunner.query(`ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_a36ed02953077f408d0f3ebc424\``); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`icon\` \`icon\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`description\` \`description\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`summary\` \`summary\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`type\` \`type\` text NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`redirect_uris\` \`redirect_uris\` text NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`rpc_application_state\` \`rpc_application_state\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`store_application_state\` \`store_application_state\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`verification_state\` \`verification_state\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`interactions_endpoint_url\` \`interactions_endpoint_url\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`integration_public\` \`integration_public\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`integration_require_code_grant\` \`integration_require_code_grant\` tinyint NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`discoverability_state\` \`discoverability_state\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`discovery_eligibility_flags\` \`discovery_eligibility_flags\` int NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`tags\` \`tags\` text NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`cover_image\` \`cover_image\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`install_params\` \`install_params\` text NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`terms_of_service_url\` \`terms_of_service_url\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`privacy_policy_url\` \`privacy_policy_url\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`bot_user_id\` \`bot_user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`applications\` CHANGE \`team_id\` \`team_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`name\` \`name\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`token\` \`token\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`); - await queryRunner.query(`ALTER TABLE \`webhooks\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`); - await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_74e6689b9568cc965b8bfc9150\` ON \`notes\` (\`owner_id\`, \`target_id\`)`); - await queryRunner.query(`CREATE UNIQUE INDEX \`IDX_3ed7a60fb7dbe04e1ba9332a8b\` ON \`messages\` (\`channel_id\`, \`id\`)`); - await queryRunner.query(`CREATE UNIQUE INDEX \`REL_0c14beb78d8c5ccba66072adbc\` ON \`users\` (\`settingsIndex\`)`); - await queryRunner.query(`ALTER TABLE \`connected_accounts\` ADD CONSTRAINT \`FK_f47244225a6a1eac04a3463dd90\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`attachments\` ADD CONSTRAINT \`FK_623e10eec51ada466c5038979e3\` FOREIGN KEY (\`message_id\`) REFERENCES \`messages\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` ADD CONSTRAINT \`FK_3cd01cd3ae7aab010310d96ac8e\` FOREIGN KEY (\`target_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`audit_logs\` ADD CONSTRAINT \`FK_bd2726fd31b35443f2245b93ba0\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`backup_codes\` ADD CONSTRAINT \`FK_70066ea80d2f4b871beda32633b\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_5999e8e449f80a236ff72023559\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_9d3ab7dd180ebdd245cdb66ecad\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_07ad88c86d1f290d46748410d58\` FOREIGN KEY (\`executor_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_3f4939aa1461e8af57fea3fb05d\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_6a15b051fe5050aa00a4b9ff0f6\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_11a0d394f8fc649c19ce5f16b59\` FOREIGN KEY (\`target_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_03779ef216d4b0358470d9cb748\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_9f8d389866b40b6657edd026dd4\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_5fe1d5f931a67e85039c640001b\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_487a7af59d189f744fe394368fc\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_df528cf77e82f8032230e7e37d8\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_c3e5305461931763b56aa905f1c\` FOREIGN KEY (\`application_id\`) REFERENCES \`applications\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_0d523f6f997c86e052c49b1455f\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_3a285f4f49c40e0706d3018bc9f\` FOREIGN KEY (\`source_guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_c253dafe5f3a03ec00cd8fb4581\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_3274522d14af40540b1a883fc80\` FOREIGN KEY (\`parent_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_3873ed438575cce703ecff4fc7b\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`emojis\` ADD CONSTRAINT \`FK_fa7ddd5f9a214e28ce596548421\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`notes\` ADD CONSTRAINT \`FK_f9e103f8ae67cb1787063597925\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`notes\` ADD CONSTRAINT \`FK_23e08e5b4481711d573e1abecdc\` FOREIGN KEY (\`target_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`sessions\` ADD CONSTRAINT \`FK_085d540d9f418cfbdc7bd55bb19\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_e7cfa5cefa6661b3fb8fda8ce69\` FOREIGN KEY (\`pack_id\`) REFERENCES \`sticker_packs\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_193d551d852aca5347ef5c9f205\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_8f4ee73f2bb2325ff980502e158\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`sticker_packs\` ADD CONSTRAINT \`FK_448fafba4355ee1c837bbc865f1\` FOREIGN KEY (\`coverStickerId\`) REFERENCES \`stickers\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`templates\` ADD CONSTRAINT \`FK_d7374b7f8f5fbfdececa4fb62e1\` FOREIGN KEY (\`creator_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`templates\` ADD CONSTRAINT \`FK_445d00eaaea0e60a017a5ed0c11\` FOREIGN KEY (\`source_guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_f591a66b8019d87b0fe6c12dad6\` FOREIGN KEY (\`afk_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_e2a2f873a64a5cf62526de42325\` FOREIGN KEY (\`template_id\`) REFERENCES \`templates\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_fc1a451727e3643ca572a3bb394\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_8d450b016dc8bec35f36729e4b0\` FOREIGN KEY (\`public_updates_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_95828668aa333460582e0ca6396\` FOREIGN KEY (\`rules_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_cfc3d3ad260f8121c95b31a1fce\` FOREIGN KEY (\`system_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_9d1d665379eefde7876a17afa99\` FOREIGN KEY (\`widget_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`roles\` ADD CONSTRAINT \`FK_c32c1ab1c4dc7dcb0278c4b1b8b\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_86b9109b155eb70c0a2ca3b4b6d\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_b193588441b085352a4c0109423\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_05535bc695e9f7ee104616459d3\` FOREIGN KEY (\`author_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_b0525304f2262b7014245351c76\` FOREIGN KEY (\`member_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_f83c04bcf1df4e5c0e7a52ed348\` FOREIGN KEY (\`webhook_id\`) REFERENCES \`webhooks\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_5d3ec1cb962de6488637fd779d6\` FOREIGN KEY (\`application_id\`) REFERENCES \`applications\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_61a92bb65b302a76d9c1fcd3174\` FOREIGN KEY (\`message_reference_id\`) REFERENCES \`messages\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`users\` ADD CONSTRAINT \`FK_0c14beb78d8c5ccba66072adbc7\` FOREIGN KEY (\`settingsIndex\`) REFERENCES \`user_settings\`(\`index\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`team_members\` ADD CONSTRAINT \`FK_fdad7d5768277e60c40e01cdcea\` FOREIGN KEY (\`team_id\`) REFERENCES \`teams\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`team_members\` ADD CONSTRAINT \`FK_c2bf4967c8c2a6b845dadfbf3d4\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`teams\` ADD CONSTRAINT \`FK_13f00abf7cb6096c43ecaf8c108\` FOREIGN KEY (\`owner_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_e57508958bf92b9d9d25231b5e8\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_2ce5a55796fe4c2f77ece57a647\` FOREIGN KEY (\`bot_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_a36ed02953077f408d0f3ebc424\` FOREIGN KEY (\`team_id\`) REFERENCES \`teams\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`); - } + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`bio\` \`bio\` varchar(255) NOT NULL`, + ); + await queryRunner.query( + `UPDATE users SET mfa_enabled = 0 WHERE mfa_enabled IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`mfa_enabled\` \`mfa_enabled\` tinyint NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`totp_secret\` \`totp_secret\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`totp_last_ticket\` \`totp_last_ticket\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`premium_since\` \`premium_since\` datetime NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` CHANGE \`email\` \`email\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` DROP FOREIGN KEY \`FK_fdad7d5768277e60c40e01cdcea\``, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` DROP FOREIGN KEY \`FK_c2bf4967c8c2a6b845dadfbf3d4\``, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` CHANGE \`team_id\` \`team_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`teams\` DROP FOREIGN KEY \`FK_13f00abf7cb6096c43ecaf8c108\``, + ); + await queryRunner.query( + `ALTER TABLE \`teams\` CHANGE \`icon\` \`icon\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`teams\` CHANGE \`owner_user_id\` \`owner_user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_e57508958bf92b9d9d25231b5e8\``, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_2ce5a55796fe4c2f77ece57a647\``, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` DROP FOREIGN KEY \`FK_a36ed02953077f408d0f3ebc424\``, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`icon\` \`icon\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`description\` \`description\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`summary\` \`summary\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`type\` \`type\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`redirect_uris\` \`redirect_uris\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`rpc_application_state\` \`rpc_application_state\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`store_application_state\` \`store_application_state\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`verification_state\` \`verification_state\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`interactions_endpoint_url\` \`interactions_endpoint_url\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`integration_public\` \`integration_public\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`integration_require_code_grant\` \`integration_require_code_grant\` tinyint NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`discoverability_state\` \`discoverability_state\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`discovery_eligibility_flags\` \`discovery_eligibility_flags\` int NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`tags\` \`tags\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`cover_image\` \`cover_image\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`install_params\` \`install_params\` text NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`terms_of_service_url\` \`terms_of_service_url\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`privacy_policy_url\` \`privacy_policy_url\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`owner_id\` \`owner_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`bot_user_id\` \`bot_user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` CHANGE \`team_id\` \`team_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`name\` \`name\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`avatar\` \`avatar\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`token\` \`token\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`guild_id\` \`guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`channel_id\` \`channel_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`application_id\` \`application_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`user_id\` \`user_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` CHANGE \`source_guild_id\` \`source_guild_id\` varchar(255) NULL`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX \`IDX_74e6689b9568cc965b8bfc9150\` ON \`notes\` (\`owner_id\`, \`target_id\`)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX \`IDX_3ed7a60fb7dbe04e1ba9332a8b\` ON \`messages\` (\`channel_id\`, \`id\`)`, + ); + await queryRunner.query( + `CREATE UNIQUE INDEX \`REL_0c14beb78d8c5ccba66072adbc\` ON \`users\` (\`settingsIndex\`)`, + ); + await queryRunner.query( + `ALTER TABLE \`connected_accounts\` ADD CONSTRAINT \`FK_f47244225a6a1eac04a3463dd90\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`attachments\` ADD CONSTRAINT \`FK_623e10eec51ada466c5038979e3\` FOREIGN KEY (\`message_id\`) REFERENCES \`messages\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` ADD CONSTRAINT \`FK_3cd01cd3ae7aab010310d96ac8e\` FOREIGN KEY (\`target_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`audit_logs\` ADD CONSTRAINT \`FK_bd2726fd31b35443f2245b93ba0\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`backup_codes\` ADD CONSTRAINT \`FK_70066ea80d2f4b871beda32633b\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_5999e8e449f80a236ff72023559\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_9d3ab7dd180ebdd245cdb66ecad\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`bans\` ADD CONSTRAINT \`FK_07ad88c86d1f290d46748410d58\` FOREIGN KEY (\`executor_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_3f4939aa1461e8af57fea3fb05d\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_6a15b051fe5050aa00a4b9ff0f6\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`invites\` ADD CONSTRAINT \`FK_11a0d394f8fc649c19ce5f16b59\` FOREIGN KEY (\`target_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_03779ef216d4b0358470d9cb748\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_9f8d389866b40b6657edd026dd4\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`voice_states\` ADD CONSTRAINT \`FK_5fe1d5f931a67e85039c640001b\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_487a7af59d189f744fe394368fc\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_df528cf77e82f8032230e7e37d8\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_c3e5305461931763b56aa905f1c\` FOREIGN KEY (\`application_id\`) REFERENCES \`applications\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_0d523f6f997c86e052c49b1455f\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`webhooks\` ADD CONSTRAINT \`FK_3a285f4f49c40e0706d3018bc9f\` FOREIGN KEY (\`source_guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_c253dafe5f3a03ec00cd8fb4581\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_3274522d14af40540b1a883fc80\` FOREIGN KEY (\`parent_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`channels\` ADD CONSTRAINT \`FK_3873ed438575cce703ecff4fc7b\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`emojis\` ADD CONSTRAINT \`FK_fa7ddd5f9a214e28ce596548421\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` ADD CONSTRAINT \`FK_f9e103f8ae67cb1787063597925\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`notes\` ADD CONSTRAINT \`FK_23e08e5b4481711d573e1abecdc\` FOREIGN KEY (\`target_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`sessions\` ADD CONSTRAINT \`FK_085d540d9f418cfbdc7bd55bb19\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_e7cfa5cefa6661b3fb8fda8ce69\` FOREIGN KEY (\`pack_id\`) REFERENCES \`sticker_packs\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_193d551d852aca5347ef5c9f205\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`stickers\` ADD CONSTRAINT \`FK_8f4ee73f2bb2325ff980502e158\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`sticker_packs\` ADD CONSTRAINT \`FK_448fafba4355ee1c837bbc865f1\` FOREIGN KEY (\`coverStickerId\`) REFERENCES \`stickers\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` ADD CONSTRAINT \`FK_d7374b7f8f5fbfdececa4fb62e1\` FOREIGN KEY (\`creator_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`templates\` ADD CONSTRAINT \`FK_445d00eaaea0e60a017a5ed0c11\` FOREIGN KEY (\`source_guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_f591a66b8019d87b0fe6c12dad6\` FOREIGN KEY (\`afk_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_e2a2f873a64a5cf62526de42325\` FOREIGN KEY (\`template_id\`) REFERENCES \`templates\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_fc1a451727e3643ca572a3bb394\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_8d450b016dc8bec35f36729e4b0\` FOREIGN KEY (\`public_updates_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_95828668aa333460582e0ca6396\` FOREIGN KEY (\`rules_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_cfc3d3ad260f8121c95b31a1fce\` FOREIGN KEY (\`system_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`guilds\` ADD CONSTRAINT \`FK_9d1d665379eefde7876a17afa99\` FOREIGN KEY (\`widget_channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`roles\` ADD CONSTRAINT \`FK_c32c1ab1c4dc7dcb0278c4b1b8b\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_86b9109b155eb70c0a2ca3b4b6d\` FOREIGN KEY (\`channel_id\`) REFERENCES \`channels\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_b193588441b085352a4c0109423\` FOREIGN KEY (\`guild_id\`) REFERENCES \`guilds\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_05535bc695e9f7ee104616459d3\` FOREIGN KEY (\`author_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_b0525304f2262b7014245351c76\` FOREIGN KEY (\`member_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_f83c04bcf1df4e5c0e7a52ed348\` FOREIGN KEY (\`webhook_id\`) REFERENCES \`webhooks\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_5d3ec1cb962de6488637fd779d6\` FOREIGN KEY (\`application_id\`) REFERENCES \`applications\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`messages\` ADD CONSTRAINT \`FK_61a92bb65b302a76d9c1fcd3174\` FOREIGN KEY (\`message_reference_id\`) REFERENCES \`messages\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`users\` ADD CONSTRAINT \`FK_0c14beb78d8c5ccba66072adbc7\` FOREIGN KEY (\`settingsIndex\`) REFERENCES \`user_settings\`(\`index\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` ADD CONSTRAINT \`FK_fdad7d5768277e60c40e01cdcea\` FOREIGN KEY (\`team_id\`) REFERENCES \`teams\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`team_members\` ADD CONSTRAINT \`FK_c2bf4967c8c2a6b845dadfbf3d4\` FOREIGN KEY (\`user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`teams\` ADD CONSTRAINT \`FK_13f00abf7cb6096c43ecaf8c108\` FOREIGN KEY (\`owner_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_e57508958bf92b9d9d25231b5e8\` FOREIGN KEY (\`owner_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_2ce5a55796fe4c2f77ece57a647\` FOREIGN KEY (\`bot_user_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE \`applications\` ADD CONSTRAINT \`FK_a36ed02953077f408d0f3ebc424\` FOREIGN KEY (\`team_id\`) REFERENCES \`teams\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } - async down(queryRunner) {} -} + async down(queryRunner) {} +}; diff --git a/scripts/stagingMigration/postgres/1672815835837-staging.js b/scripts/stagingMigration/postgres/1672815835837-staging.js index 8ccf16da..60609dae 100644 --- a/scripts/stagingMigration/postgres/1672815835837-staging.js +++ b/scripts/stagingMigration/postgres/1672815835837-staging.js @@ -1,58 +1,149 @@ const { MigrationInterface, QueryRunner } = require("typeorm"); module.exports = class staging1672815835837 { - name = 'staging1672815835837' + name = "staging1672815835837"; - async up(queryRunner) { - await queryRunner.query(`ALTER TABLE "users" DROP CONSTRAINT IF EXISTS "FK_76ba283779c8441fd5ff819c8cf"`); - await queryRunner.query(`ALTER TABLE "user_settings" RENAME COLUMN "id" TO "index"`); - await queryRunner.query(`ALTER TABLE "user_settings" RENAME CONSTRAINT "PK_00f004f5922a0744d174530d639" TO "PK_e81f8bb92802737337d35c00981"`); - await queryRunner.query(`CREATE TABLE "embed_cache" ("id" character varying NOT NULL, "url" character varying NOT NULL, "embed" text NOT NULL, CONSTRAINT "PK_0abb7581d4efc5a8b1361389c5e" PRIMARY KEY ("id"))`); - await queryRunner.query(`CREATE TABLE "security_settings" ("id" character varying NOT NULL, "guild_id" character varying, "channel_id" character varying, "encryption_permission_mask" integer NOT NULL, "allowed_algorithms" text NOT NULL, "current_algorithm" character varying NOT NULL, "used_since_message" character varying, CONSTRAINT "PK_4aec436cf81177ae97a1bcec3c7" PRIMARY KEY ("id"))`); - await queryRunner.query(`ALTER TABLE "client_release" DROP COLUMN IF EXISTS "deb_url"`); - await queryRunner.query(`ALTER TABLE "client_release" DROP COLUMN IF EXISTS "osx_url"`); - await queryRunner.query(`ALTER TABLE "client_release" DROP COLUMN IF EXISTS "win_url"`); - await queryRunner.query(`ALTER TABLE "users" DROP CONSTRAINT IF EXISTS "REL_76ba283779c8441fd5ff819c8c"`); - await queryRunner.query(`ALTER TABLE "users" DROP COLUMN IF EXISTS "settingsId"`); - await queryRunner.query(`ALTER TABLE "client_release" ADD "platform" character varying NOT NULL`); - await queryRunner.query(`ALTER TABLE "client_release" ADD "enabled" boolean NOT NULL`); - await queryRunner.query(`ALTER TABLE "users" ADD "purchased_flags" integer NOT NULL DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "users" ADD "premium_usage_flags" integer NOT NULl DEFAULT 0`); - await queryRunner.query(`ALTER TABLE "users" ADD "settingsIndex" integer`); - await queryRunner.query(`ALTER TABLE "users" ADD CONSTRAINT "UQ_0c14beb78d8c5ccba66072adbc7" UNIQUE ("settingsIndex")`); - await queryRunner.query(`ALTER TABLE "client_release" DROP COLUMN IF EXISTS "pub_date"`); - await queryRunner.query(`ALTER TABLE "client_release" ADD "pub_date" TIMESTAMP NOT NULL`); - await queryRunner.query(`UPDATE channels SET nsfw = false WHERE nsfw IS NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "nsfw" SET NOT NULL`); - await queryRunner.query(`UPDATE channels SET flags = 0 WHERE flags IS NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "flags" SET NOT NULL`); - await queryRunner.query(`UPDATE channels SET default_thread_rate_limit_per_user = 0 WHERE default_thread_rate_limit_per_user IS NULL`); - await queryRunner.query(`ALTER TABLE "channels" ALTER COLUMN "default_thread_rate_limit_per_user" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "user_settings" DROP CONSTRAINT IF EXISTS "PK_e81f8bb92802737337d35c00981"`); - await queryRunner.query(`ALTER TABLE "user_settings" DROP COLUMN IF EXISTS "index"`); - await queryRunner.query(`ALTER TABLE "user_settings" ADD "index" SERIAL NOT NULL`); - await queryRunner.query(`ALTER TABLE "user_settings" ADD CONSTRAINT "PK_e81f8bb92802737337d35c00981" PRIMARY KEY ("index")`); - await queryRunner.query(`ALTER TABLE "guilds" DROP COLUMN IF EXISTS "primary_category_id"`); - await queryRunner.query(`ALTER TABLE "guilds" ADD "primary_category_id" character varying`); - await queryRunner.query(`UPDATE guilds SET large = false WHERE large IS NULL`); - await queryRunner.query(`ALTER TABLE "guilds" ALTER COLUMN "large" SET NOT NULL`); - await queryRunner.query(`UPDATE guilds SET premium_tier = 0 WHERE premium_tier IS NULL`); - await queryRunner.query(`ALTER TABLE "guilds" ALTER COLUMN "premium_tier" SET NOT NULL`); - await queryRunner.query(`UPDATE guilds SET unavailable = false WHERE unavailable IS NULL`); - await queryRunner.query(`ALTER TABLE "guilds" ALTER COLUMN "unavailable" SET NOT NULL`); - await queryRunner.query(`UPDATE guilds SET widget_enabled = false WHERE widget_enabled IS NULL`); - await queryRunner.query(`ALTER TABLE "guilds" ALTER COLUMN "widget_enabled" SET NOT NULL`); - await queryRunner.query(`UPDATE guilds SET nsfw = false WHERE nsfw IS NULL`); - await queryRunner.query(`ALTER TABLE "guilds" ALTER COLUMN "nsfw" SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "members" DROP COLUMN IF EXISTS "premium_since"`); - await queryRunner.query(`ALTER TABLE "members" ADD "premium_since" bigint`); + async up(queryRunner) { + await queryRunner.query( + `ALTER TABLE "users" DROP CONSTRAINT IF EXISTS "FK_76ba283779c8441fd5ff819c8cf"`, + ); + await queryRunner.query( + `ALTER TABLE "user_settings" RENAME COLUMN "id" TO "index"`, + ); + await queryRunner.query( + `ALTER TABLE "user_settings" RENAME CONSTRAINT "PK_00f004f5922a0744d174530d639" TO "PK_e81f8bb92802737337d35c00981"`, + ); + await queryRunner.query( + `CREATE TABLE "embed_cache" ("id" character varying NOT NULL, "url" character varying NOT NULL, "embed" text NOT NULL, CONSTRAINT "PK_0abb7581d4efc5a8b1361389c5e" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "security_settings" ("id" character varying NOT NULL, "guild_id" character varying, "channel_id" character varying, "encryption_permission_mask" integer NOT NULL, "allowed_algorithms" text NOT NULL, "current_algorithm" character varying NOT NULL, "used_since_message" character varying, CONSTRAINT "PK_4aec436cf81177ae97a1bcec3c7" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `ALTER TABLE "client_release" DROP COLUMN IF EXISTS "deb_url"`, + ); + await queryRunner.query( + `ALTER TABLE "client_release" DROP COLUMN IF EXISTS "osx_url"`, + ); + await queryRunner.query( + `ALTER TABLE "client_release" DROP COLUMN IF EXISTS "win_url"`, + ); + await queryRunner.query( + `ALTER TABLE "users" DROP CONSTRAINT IF EXISTS "REL_76ba283779c8441fd5ff819c8c"`, + ); + await queryRunner.query( + `ALTER TABLE "users" DROP COLUMN IF EXISTS "settingsId"`, + ); + await queryRunner.query( + `ALTER TABLE "client_release" ADD "platform" character varying NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "client_release" ADD "enabled" boolean NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "users" ADD "purchased_flags" integer NOT NULL DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "users" ADD "premium_usage_flags" integer NOT NULl DEFAULT 0`, + ); + await queryRunner.query( + `ALTER TABLE "users" ADD "settingsIndex" integer`, + ); + await queryRunner.query( + `ALTER TABLE "users" ADD CONSTRAINT "UQ_0c14beb78d8c5ccba66072adbc7" UNIQUE ("settingsIndex")`, + ); + await queryRunner.query( + `ALTER TABLE "client_release" DROP COLUMN IF EXISTS "pub_date"`, + ); + await queryRunner.query( + `ALTER TABLE "client_release" ADD "pub_date" TIMESTAMP NOT NULL`, + ); + await queryRunner.query( + `UPDATE channels SET nsfw = false WHERE nsfw IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE "channels" ALTER COLUMN "nsfw" SET NOT NULL`, + ); + await queryRunner.query( + `UPDATE channels SET flags = 0 WHERE flags IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE "channels" ALTER COLUMN "flags" SET NOT NULL`, + ); + await queryRunner.query( + `UPDATE channels SET default_thread_rate_limit_per_user = 0 WHERE default_thread_rate_limit_per_user IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE "channels" ALTER COLUMN "default_thread_rate_limit_per_user" SET NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "user_settings" DROP CONSTRAINT IF EXISTS "PK_e81f8bb92802737337d35c00981"`, + ); + await queryRunner.query( + `ALTER TABLE "user_settings" DROP COLUMN IF EXISTS "index"`, + ); + await queryRunner.query( + `ALTER TABLE "user_settings" ADD "index" SERIAL NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "user_settings" ADD CONSTRAINT "PK_e81f8bb92802737337d35c00981" PRIMARY KEY ("index")`, + ); + await queryRunner.query( + `ALTER TABLE "guilds" DROP COLUMN IF EXISTS "primary_category_id"`, + ); + await queryRunner.query( + `ALTER TABLE "guilds" ADD "primary_category_id" character varying`, + ); + await queryRunner.query( + `UPDATE guilds SET large = false WHERE large IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE "guilds" ALTER COLUMN "large" SET NOT NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET premium_tier = 0 WHERE premium_tier IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE "guilds" ALTER COLUMN "premium_tier" SET NOT NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET unavailable = false WHERE unavailable IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE "guilds" ALTER COLUMN "unavailable" SET NOT NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET widget_enabled = false WHERE widget_enabled IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE "guilds" ALTER COLUMN "widget_enabled" SET NOT NULL`, + ); + await queryRunner.query( + `UPDATE guilds SET nsfw = false WHERE nsfw IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE "guilds" ALTER COLUMN "nsfw" SET NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "members" DROP COLUMN IF EXISTS "premium_since"`, + ); + await queryRunner.query( + `ALTER TABLE "members" ADD "premium_since" bigint`, + ); await queryRunner.query(`UPDATE users SET bio = '' WHERE bio IS NULL`); - await queryRunner.query(`ALTER TABLE users ALTER COLUMN bio SET NOT NULL`); - await queryRunner.query(`UPDATE users SET mfa_enabled = false WHERE mfa_enabled IS NULL`); - await queryRunner.query(`ALTER TABLE users ALTER COLUMN mfa_enabled SET NOT NULL`); - await queryRunner.query(`ALTER TABLE "users" ADD CONSTRAINT "FK_0c14beb78d8c5ccba66072adbc7" FOREIGN KEY ("settingsIndex") REFERENCES "user_settings"("index") ON DELETE NO ACTION ON UPDATE NO ACTION`); - } + await queryRunner.query( + `ALTER TABLE users ALTER COLUMN bio SET NOT NULL`, + ); + await queryRunner.query( + `UPDATE users SET mfa_enabled = false WHERE mfa_enabled IS NULL`, + ); + await queryRunner.query( + `ALTER TABLE users ALTER COLUMN mfa_enabled SET NOT NULL`, + ); + await queryRunner.query( + `ALTER TABLE "users" ADD CONSTRAINT "FK_0c14beb78d8c5ccba66072adbc7" FOREIGN KEY ("settingsIndex") REFERENCES "user_settings"("index") ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + } - async down(queryRunner) { - } -} + async down(queryRunner) {} +}; diff --git a/scripts/syncronise.js b/scripts/syncronise.js index 3ecb516e..38895662 100644 --- a/scripts/syncronise.js +++ b/scripts/syncronise.js @@ -17,4 +17,4 @@ const { initDatabase } = require(".."); await db.synchronize(); console.log("done"); db.destroy(); -})(); \ No newline at end of file +})(); -- cgit 1.4.1