mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 04:32:35 +01:00
Update package, sync migrations
This commit is contained in:
parent
fcef1f4d27
commit
551fa530cf
43
package-lock.json
generated
43
package-lock.json
generated
@ -24,11 +24,11 @@
|
||||
"canvas": "^2.9.3",
|
||||
"cheerio": "^1.0.0-rc.10",
|
||||
"dotenv": "^16.0.1",
|
||||
"exif-be-gone": "^1.3.0",
|
||||
"exif-be-gone": "^1.3.1",
|
||||
"express": "^4.17.1",
|
||||
"file-type": "16.5",
|
||||
"form-data": "^4.0.0",
|
||||
"i18next": "^21.8.14",
|
||||
"i18next": "^21.9.0",
|
||||
"i18next-http-middleware": "^3.1.3",
|
||||
"i18next-node-fs-backend": "^2.1.3",
|
||||
"image-size": "^1.0.0",
|
||||
@ -38,6 +38,7 @@
|
||||
"missing-native-js-functions": "^1.2.18",
|
||||
"morgan": "^1.10.0",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"mysql2": "^2.3.3",
|
||||
"node-2fa": "^2.0.3",
|
||||
"node-fetch": "^2.6.7",
|
||||
"patch-package": "^6.4.7",
|
||||
@ -61,7 +62,7 @@
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"@types/morgan": "^1.9.3",
|
||||
"@types/multer": "^1.4.7",
|
||||
"@types/node": "^18.0.6",
|
||||
"@types/node": "^18.7.3",
|
||||
"@types/node-os-utils": "^1.3.0",
|
||||
"@types/ws": "^8.5.3",
|
||||
"jest": "^28.1.3",
|
||||
@ -4281,9 +4282,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.3.tgz",
|
||||
"integrity": "sha512-6qKpDtoaYLM+5+AFChLhHermMQxc3TOEFIDzrZLPRGHPrLEwqFkkT5Kx3ju05g6X7uDPazz3jHbKPX0KzCjntg=="
|
||||
"version": "18.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.3.tgz",
|
||||
"integrity": "sha512-LJgzOEwWuMTBxHzgBR/fhhBOWrvBjvO+zPteUgbbuQi80rYIZHrk1mNbRUqPZqSLP2H7Rwt1EFLL/tNLD1Xx/w=="
|
||||
},
|
||||
"node_modules/@types/node-fetch": {
|
||||
"version": "2.6.2",
|
||||
@ -6261,9 +6262,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/exif-be-gone": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/exif-be-gone/-/exif-be-gone-1.3.0.tgz",
|
||||
"integrity": "sha512-6s/SnuWviwtP6TB3Gc2Nc2GIWYCIs3N9V4Md773EWIfC4uOR+O3thZXO4ElbJJOvjtDNR4FVoMVNKgZWRKiQNQ==",
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/exif-be-gone/-/exif-be-gone-1.3.1.tgz",
|
||||
"integrity": "sha512-lHvNqbaTsH0WzhzfxxiTh9KwmXjAfiiTfY6UVmUZXJsaU62ccURy8beEVYFKSmNfvf0n6srLIFi0NDBWvhYUlQ==",
|
||||
"dependencies": {
|
||||
"@types/stream-buffers": "^3.0.3"
|
||||
},
|
||||
@ -6965,9 +6966,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/i18next": {
|
||||
"version": "21.8.14",
|
||||
"resolved": "https://registry.npmjs.org/i18next/-/i18next-21.8.14.tgz",
|
||||
"integrity": "sha512-4Yi+DtexvMm/Yw3Q9fllzY12SgLk+Mcmar+rCAccsOPul/2UmnBzoHbTGn/L48IPkFcmrNaH7xTLboBWIbH6pw==",
|
||||
"version": "21.9.0",
|
||||
"resolved": "https://registry.npmjs.org/i18next/-/i18next-21.9.0.tgz",
|
||||
"integrity": "sha512-B+6/yd7rCpJidyPuBaEApUECx7G8Ai6+tqYhrChsY4MmQqJhG7qJ4eT6Lm1OnRhieVelEtfxh4aAQktdNVZtDA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
@ -16254,9 +16255,9 @@
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "18.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.3.tgz",
|
||||
"integrity": "sha512-6qKpDtoaYLM+5+AFChLhHermMQxc3TOEFIDzrZLPRGHPrLEwqFkkT5Kx3ju05g6X7uDPazz3jHbKPX0KzCjntg=="
|
||||
"version": "18.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.3.tgz",
|
||||
"integrity": "sha512-LJgzOEwWuMTBxHzgBR/fhhBOWrvBjvO+zPteUgbbuQi80rYIZHrk1mNbRUqPZqSLP2H7Rwt1EFLL/tNLD1Xx/w=="
|
||||
},
|
||||
"@types/node-fetch": {
|
||||
"version": "2.6.2",
|
||||
@ -17793,9 +17794,9 @@
|
||||
}
|
||||
},
|
||||
"exif-be-gone": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/exif-be-gone/-/exif-be-gone-1.3.0.tgz",
|
||||
"integrity": "sha512-6s/SnuWviwtP6TB3Gc2Nc2GIWYCIs3N9V4Md773EWIfC4uOR+O3thZXO4ElbJJOvjtDNR4FVoMVNKgZWRKiQNQ==",
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/exif-be-gone/-/exif-be-gone-1.3.1.tgz",
|
||||
"integrity": "sha512-lHvNqbaTsH0WzhzfxxiTh9KwmXjAfiiTfY6UVmUZXJsaU62ccURy8beEVYFKSmNfvf0n6srLIFi0NDBWvhYUlQ==",
|
||||
"requires": {
|
||||
"@types/stream-buffers": "^3.0.3"
|
||||
}
|
||||
@ -18339,9 +18340,9 @@
|
||||
}
|
||||
},
|
||||
"i18next": {
|
||||
"version": "21.8.14",
|
||||
"resolved": "https://registry.npmjs.org/i18next/-/i18next-21.8.14.tgz",
|
||||
"integrity": "sha512-4Yi+DtexvMm/Yw3Q9fllzY12SgLk+Mcmar+rCAccsOPul/2UmnBzoHbTGn/L48IPkFcmrNaH7xTLboBWIbH6pw==",
|
||||
"version": "21.9.0",
|
||||
"resolved": "https://registry.npmjs.org/i18next/-/i18next-21.9.0.tgz",
|
||||
"integrity": "sha512-B+6/yd7rCpJidyPuBaEApUECx7G8Ai6+tqYhrChsY4MmQqJhG7qJ4eT6Lm1OnRhieVelEtfxh4aAQktdNVZtDA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.17.2"
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"@types/morgan": "^1.9.3",
|
||||
"@types/multer": "^1.4.7",
|
||||
"@types/node": "^18.0.6",
|
||||
"@types/node": "^18.7.3",
|
||||
"@types/node-os-utils": "^1.3.0",
|
||||
"@types/ws": "^8.5.3",
|
||||
"jest": "^28.1.3",
|
||||
@ -68,11 +68,11 @@
|
||||
"canvas": "^2.9.3",
|
||||
"cheerio": "^1.0.0-rc.10",
|
||||
"dotenv": "^16.0.1",
|
||||
"exif-be-gone": "^1.3.0",
|
||||
"exif-be-gone": "^1.3.1",
|
||||
"express": "^4.17.1",
|
||||
"file-type": "16.5",
|
||||
"form-data": "^4.0.0",
|
||||
"i18next": "^21.8.14",
|
||||
"i18next": "^21.9.0",
|
||||
"i18next-http-middleware": "^3.1.3",
|
||||
"i18next-node-fs-backend": "^2.1.3",
|
||||
"image-size": "^1.0.0",
|
||||
|
@ -15,7 +15,7 @@ Arguments:
|
||||
exit(0);
|
||||
}
|
||||
|
||||
let steps = 3, i = 0;
|
||||
let steps = 1, i = 0;
|
||||
if (argv.includes("clean")) steps++;
|
||||
|
||||
const verbose = argv.includes("verbose") || argv.includes("v");
|
||||
@ -34,11 +34,6 @@ if (argv.includes("clean")) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`[${++i}/${steps}] Checking if dependencies were installed correctly...`);
|
||||
//exif-be-gone v1.3.0 doesnt build js, known bug
|
||||
if(!fs.existsSync(path.join(__dirname, "..", "node_modules", "exif-be-gone", "index.js")))
|
||||
execIn("npm run build", path.join(__dirname, "..", "node_modules", "exif-be-gone"));
|
||||
|
||||
console.log(`[${++i}/${steps}] Compiling src files ...`);
|
||||
|
||||
let buildFlags = ''
|
||||
|
@ -9,16 +9,17 @@ else
|
||||
fi
|
||||
|
||||
[ -f ".env" ] && (
|
||||
mv .env .env.tmp
|
||||
source .env.tmp
|
||||
mv .env .env.tmp 2>/dev/null
|
||||
source .env.tmp 2>/dev/null
|
||||
)
|
||||
npm run build clean logerrors pretty-errors
|
||||
|
||||
make_migration() {
|
||||
echo "Creating migrations for $2"
|
||||
mkdir "src/util/migrations/$2"
|
||||
mkdir "src/util/migrations/$2" 2>/dev/null
|
||||
# npm run build clean logerrors pretty-errors
|
||||
# THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
|
||||
THREADS=1 DATABASE="$1" DB_MIGRATE=a npx typeorm-ts-node-commonjs migration:generate "src/migrations/$2/$FILENAME" -d ../util/src/util/Database.ts -p
|
||||
THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
|
||||
THREADS=1 DATABASE="$1" DB_MIGRATE=a npx typeorm-ts-node-commonjs migration:generate "src/migrations/$2/$FILENAME" -d src/util/util/Database.ts -p
|
||||
npm run build clean logerrors pretty-errors
|
||||
THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
|
||||
}
|
||||
@ -36,5 +37,5 @@ make_migration "database.db" "sqlite"
|
||||
make_migration "$FC_DB_MARIADB" "mariadb"
|
||||
)
|
||||
|
||||
[ -f ".env.tmp" ] && mv .env.tmp .env
|
||||
[ -f ".env.tmp" ] && mv .env.tmp .env 2>/dev/null
|
||||
|
||||
|
127
src/migrations/mariadb/1660540527213-sync_migrations.ts
Normal file
127
src/migrations/mariadb/1660540527213-sync_migrations.ts
Normal file
@ -0,0 +1,127 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class syncMigrations1660540527213 implements MigrationInterface {
|
||||
name = 'syncMigrations1660540527213'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\` CHANGE \`settings\` \`settingsId\` text NOT NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE \`user_settings\` (
|
||||
\`id\` varchar(255) NOT NULL,
|
||||
\`afk_timeout\` int NULL,
|
||||
\`allow_accessibility_detection\` tinyint NULL,
|
||||
\`animate_emoji\` tinyint NULL,
|
||||
\`animate_stickers\` int NULL,
|
||||
\`contact_sync_enabled\` tinyint NULL,
|
||||
\`convert_emoticons\` tinyint NULL,
|
||||
\`custom_status\` text NULL,
|
||||
\`default_guilds_restricted\` tinyint NULL,
|
||||
\`detect_platform_accounts\` tinyint NULL,
|
||||
\`developer_mode\` tinyint NULL,
|
||||
\`disable_games_tab\` tinyint NULL,
|
||||
\`enable_tts_command\` tinyint NULL,
|
||||
\`explicit_content_filter\` int NULL,
|
||||
\`friend_source_flags\` text NULL,
|
||||
\`gateway_connected\` tinyint NULL,
|
||||
\`gif_auto_play\` tinyint NULL,
|
||||
\`guild_folders\` text NULL,
|
||||
\`guild_positions\` text NULL,
|
||||
\`inline_attachment_media\` tinyint NULL,
|
||||
\`inline_embed_media\` tinyint NULL,
|
||||
\`locale\` varchar(255) NULL,
|
||||
\`message_display_compact\` tinyint NULL,
|
||||
\`native_phone_integration_enabled\` tinyint NULL,
|
||||
\`render_embeds\` tinyint NULL,
|
||||
\`render_reactions\` tinyint NULL,
|
||||
\`restricted_guilds\` text NULL,
|
||||
\`show_current_game\` tinyint NULL,
|
||||
\`status\` varchar(255) NULL,
|
||||
\`stream_notifications_enabled\` tinyint NULL,
|
||||
\`theme\` varchar(255) NULL,
|
||||
\`timezone_offset\` int NULL,
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE = InnoDB
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`channels\`
|
||||
ADD \`flags\` int NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`channels\`
|
||||
ADD \`default_thread_rate_limit_per_user\` int NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`guilds\`
|
||||
ADD \`premium_progress_bar_enabled\` tinyint NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\` DROP COLUMN \`settingsId\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\`
|
||||
ADD \`settingsId\` varchar(255) NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\`
|
||||
ADD UNIQUE INDEX \`IDX_76ba283779c8441fd5ff819c8c\` (\`settingsId\`)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE UNIQUE INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\` (\`settingsId\`)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\`
|
||||
ADD CONSTRAINT \`FK_76ba283779c8441fd5ff819c8cf\` FOREIGN KEY (\`settingsId\`) REFERENCES \`user_settings\`(\`id\`) ON DELETE NO ACTION 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
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\`
|
||||
`);
|
||||
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 \`users\` DROP INDEX \`IDX_76ba283779c8441fd5ff819c8c\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\` DROP COLUMN \`settingsId\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\`
|
||||
ADD \`settingsId\` text NOT NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`guilds\` DROP COLUMN \`premium_progress_bar_enabled\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`channels\` DROP COLUMN \`default_thread_rate_limit_per_user\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`channels\` DROP COLUMN \`flags\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
DROP TABLE \`user_settings\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\` CHANGE \`settingsId\` \`settings\` text NOT NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`invites\`
|
||||
ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
`);
|
||||
}
|
||||
|
||||
}
|
172
src/migrations/sqlite/1660538628956-sync_migrations.ts
Normal file
172
src/migrations/sqlite/1660538628956-sync_migrations.ts
Normal file
@ -0,0 +1,172 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class syncMigrations1660538628956 implements MigrationInterface {
|
||||
name = 'syncMigrations1660538628956'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE "temporary_channels" (
|
||||
"id" varchar PRIMARY KEY NOT NULL,
|
||||
"created_at" datetime NOT NULL,
|
||||
"name" varchar,
|
||||
"icon" text,
|
||||
"type" integer NOT NULL,
|
||||
"last_message_id" varchar,
|
||||
"guild_id" varchar,
|
||||
"parent_id" varchar,
|
||||
"owner_id" varchar,
|
||||
"last_pin_timestamp" integer,
|
||||
"default_auto_archive_duration" integer,
|
||||
"position" integer,
|
||||
"permission_overwrites" text,
|
||||
"video_quality_mode" integer,
|
||||
"bitrate" integer,
|
||||
"user_limit" integer,
|
||||
"nsfw" boolean,
|
||||
"rate_limit_per_user" integer,
|
||||
"topic" varchar,
|
||||
"retention_policy_id" varchar,
|
||||
"flags" integer,
|
||||
"default_thread_rate_limit_per_user" integer,
|
||||
CONSTRAINT "FK_3873ed438575cce703ecff4fc7b" FOREIGN KEY ("owner_id") REFERENCES "users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT "FK_3274522d14af40540b1a883fc80" FOREIGN KEY ("parent_id") REFERENCES "channels" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT "FK_c253dafe5f3a03ec00cd8fb4581" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
INSERT INTO "temporary_channels"(
|
||||
"id",
|
||||
"created_at",
|
||||
"name",
|
||||
"icon",
|
||||
"type",
|
||||
"last_message_id",
|
||||
"guild_id",
|
||||
"parent_id",
|
||||
"owner_id",
|
||||
"last_pin_timestamp",
|
||||
"default_auto_archive_duration",
|
||||
"position",
|
||||
"permission_overwrites",
|
||||
"video_quality_mode",
|
||||
"bitrate",
|
||||
"user_limit",
|
||||
"nsfw",
|
||||
"rate_limit_per_user",
|
||||
"topic",
|
||||
"retention_policy_id"
|
||||
)
|
||||
SELECT "id",
|
||||
"created_at",
|
||||
"name",
|
||||
"icon",
|
||||
"type",
|
||||
"last_message_id",
|
||||
"guild_id",
|
||||
"parent_id",
|
||||
"owner_id",
|
||||
"last_pin_timestamp",
|
||||
"default_auto_archive_duration",
|
||||
"position",
|
||||
"permission_overwrites",
|
||||
"video_quality_mode",
|
||||
"bitrate",
|
||||
"user_limit",
|
||||
"nsfw",
|
||||
"rate_limit_per_user",
|
||||
"topic",
|
||||
"retention_policy_id"
|
||||
FROM "channels"
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
DROP TABLE "channels"
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE "temporary_channels"
|
||||
RENAME TO "channels"
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE "channels"
|
||||
RENAME TO "temporary_channels"
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE "channels" (
|
||||
"id" varchar PRIMARY KEY NOT NULL,
|
||||
"created_at" datetime NOT NULL,
|
||||
"name" varchar,
|
||||
"icon" text,
|
||||
"type" integer NOT NULL,
|
||||
"last_message_id" varchar,
|
||||
"guild_id" varchar,
|
||||
"parent_id" varchar,
|
||||
"owner_id" varchar,
|
||||
"last_pin_timestamp" integer,
|
||||
"default_auto_archive_duration" integer,
|
||||
"position" integer,
|
||||
"permission_overwrites" text,
|
||||
"video_quality_mode" integer,
|
||||
"bitrate" integer,
|
||||
"user_limit" integer,
|
||||
"nsfw" boolean,
|
||||
"rate_limit_per_user" integer,
|
||||
"topic" varchar,
|
||||
"retention_policy_id" varchar,
|
||||
CONSTRAINT "FK_3873ed438575cce703ecff4fc7b" FOREIGN KEY ("owner_id") REFERENCES "users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT "FK_3274522d14af40540b1a883fc80" FOREIGN KEY ("parent_id") REFERENCES "channels" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT "FK_c253dafe5f3a03ec00cd8fb4581" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
INSERT INTO "channels"(
|
||||
"id",
|
||||
"created_at",
|
||||
"name",
|
||||
"icon",
|
||||
"type",
|
||||
"last_message_id",
|
||||
"guild_id",
|
||||
"parent_id",
|
||||
"owner_id",
|
||||
"last_pin_timestamp",
|
||||
"default_auto_archive_duration",
|
||||
"position",
|
||||
"permission_overwrites",
|
||||
"video_quality_mode",
|
||||
"bitrate",
|
||||
"user_limit",
|
||||
"nsfw",
|
||||
"rate_limit_per_user",
|
||||
"topic",
|
||||
"retention_policy_id"
|
||||
)
|
||||
SELECT "id",
|
||||
"created_at",
|
||||
"name",
|
||||
"icon",
|
||||
"type",
|
||||
"last_message_id",
|
||||
"guild_id",
|
||||
"parent_id",
|
||||
"owner_id",
|
||||
"last_pin_timestamp",
|
||||
"default_auto_archive_duration",
|
||||
"position",
|
||||
"permission_overwrites",
|
||||
"video_quality_mode",
|
||||
"bitrate",
|
||||
"user_limit",
|
||||
"nsfw",
|
||||
"rate_limit_per_user",
|
||||
"topic",
|
||||
"retention_policy_id"
|
||||
FROM "temporary_channels"
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
DROP TABLE "temporary_channels"
|
||||
`);
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class CodeCleanup41660260587556 implements MigrationInterface {
|
||||
name = 'CodeCleanup41660260587556'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\`
|
||||
ADD \`settingsId\` varchar(255) NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\`
|
||||
ADD UNIQUE INDEX \`IDX_76ba283779c8441fd5ff819c8c\` (\`settingsId\`)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE UNIQUE INDEX \`REL_76ba283779c8441fd5ff819c8c\` ON \`users\` (\`settingsId\`)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\`
|
||||
ADD CONSTRAINT \`FK_76ba283779c8441fd5ff819c8cf\` FOREIGN KEY (\`settingsId\`) REFERENCES \`user_settings\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
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 \`users\` DROP INDEX \`IDX_76ba283779c8441fd5ff819c8c\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`users\` DROP COLUMN \`settingsId\`
|
||||
`);
|
||||
}
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class InvitersAreDeletable1660416072362 implements MigrationInterface {
|
||||
name = 'InvitersAreDeletable1660416072362'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
DROP INDEX \`IDX_76ba283779c8441fd5ff819c8c\` ON \`users\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE \`plugin_config\` (
|
||||
\`key\` varchar(255) NOT NULL,
|
||||
\`value\` text NULL,
|
||||
PRIMARY KEY (\`key\`)
|
||||
) ENGINE = InnoDB
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`channels\`
|
||||
ADD \`flags\` int NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`channels\`
|
||||
ADD \`default_thread_rate_limit_per_user\` int NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`invites\`
|
||||
ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`invites\` DROP FOREIGN KEY \`FK_15c35422032e0b22b4ada95f48f\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`channels\` DROP COLUMN \`default_thread_rate_limit_per_user\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`channels\` DROP COLUMN \`flags\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
DROP TABLE \`plugin_config\`
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
CREATE UNIQUE INDEX \`IDX_76ba283779c8441fd5ff819c8c\` ON \`users\` (\`settingsId\`)
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE \`invites\`
|
||||
ADD CONSTRAINT \`FK_15c35422032e0b22b4ada95f48f\` FOREIGN KEY (\`inviter_id\`) REFERENCES \`users\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
`);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user