diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-12 03:24:51 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-13 21:57:51 +0200 |
commit | 1d52b0d0721094d7f8dfaabddedd9f08a5e456a5 (patch) | |
tree | 1136d2550f7f47f4eebd560251353f9c0cd98a6f | |
parent | Push local state... (diff) | |
download | server-1d52b0d0721094d7f8dfaabddedd9f08a5e456a5.tar.xz |
Fix updated client stuff...
-rw-r--r-- | api/assets/schemas.json | 162 | ||||
-rw-r--r-- | api/src/routes/channels/#channel_id/index.ts | 2 | ||||
-rw-r--r-- | api/src/routes/channels/#channel_id/invites.ts | 2 | ||||
-rw-r--r-- | api/src/routes/channels/#channel_id/webhooks.ts | 3 | ||||
-rw-r--r-- | api/src/util/handlers/route.ts | 5 | ||||
-rw-r--r-- | bundle/package.json | 3 | ||||
-rw-r--r-- | bundle/scripts/update_schemas.js | 2 | ||||
-rw-r--r-- | env-vars.md | 3 | ||||
-rw-r--r-- | gateway/src/opcodes/Identify.ts | 3 | ||||
-rw-r--r-- | util/src/entities/BaseClass.ts | 2 | ||||
-rw-r--r-- | util/src/entities/Channel.ts | 7 | ||||
-rw-r--r-- | util/src/entities/User.ts | 6 | ||||
-rw-r--r-- | util/src/migrations/mariadb/1660265930624-CodeCleanup5.ts | 53 | ||||
-rw-r--r-- | util/src/migrations/postgres/1660265907544-CodeCleanup5.ts | 26 | ||||
-rw-r--r-- | util/src/migrations/sqlite/1660260539853-CodeCleanup4.ts | 459 |
15 files changed, 218 insertions, 520 deletions
diff --git a/api/assets/schemas.json b/api/assets/schemas.json index 00819e7c..d8576514 100644 --- a/api/assets/schemas.json +++ b/api/assets/schemas.json @@ -552,6 +552,12 @@ }, "default_auto_archive_duration": { "type": "integer" + }, + "flags": { + "type": "integer" + }, + "default_thread_rate_limit_per_user": { + "type": "integer" } }, "additionalProperties": false, @@ -695,7 +701,6 @@ }, "additionalProperties": false, "required": [ - "avatar", "name" ], "$schema": "http://json-schema.org/draft-07/schema#" @@ -1028,6 +1033,12 @@ }, "default_auto_archive_duration": { "type": "integer" + }, + "flags": { + "type": "integer" + }, + "default_thread_rate_limit_per_user": { + "type": "integer" } }, "additionalProperties": false @@ -1094,6 +1105,9 @@ "preferred_locale": { "type": "string" }, + "premium_progress_bar_enabled": { + "type": "boolean" + }, "region": { "type": "string" }, @@ -1651,6 +1665,9 @@ "UserSettingsSchema": { "type": "object", "properties": { + "id": { + "type": "string" + }, "afk_timeout": { "type": "integer" }, @@ -1672,22 +1689,7 @@ "custom_status": { "anyOf": [ { - "type": "object", - "properties": { - "emoji_id": { - "type": "string" - }, - "emoji_name": { - "type": "string" - }, - "expires_at": { - "type": "integer" - }, - "text": { - "type": "string" - } - }, - "additionalProperties": false + "$ref": "#/definitions/CustomStatus" }, { "type": "null" @@ -1713,16 +1715,7 @@ "type": "integer" }, "friend_source_flags": { - "type": "object", - "properties": { - "all": { - "type": "boolean" - } - }, - "additionalProperties": false, - "required": [ - "all" - ] + "$ref": "#/definitions/FriendSourceFlags" }, "gateway_connected": { "type": "boolean" @@ -1733,31 +1726,7 @@ "guild_folders": { "type": "array", "items": { - "type": "object", - "properties": { - "color": { - "type": "integer" - }, - "guild_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "type": "integer" - }, - "name": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "color", - "guild_ids", - "id", - "name" - ] + "$ref": "#/definitions/GuildFolder" } }, "guild_positions": { @@ -1818,9 +1787,98 @@ }, "timezone_offset": { "type": "integer" + }, + "hasId": { + "description": "Checks if entity has an id.\nIf entity composite compose ids, it will check them all.", + "type": "object", + "additionalProperties": false + }, + "save": { + "description": "Saves current entity in the database.\nIf entity does not exist in the database then inserts, otherwise updates.", + "type": "object", + "additionalProperties": false + }, + "remove": { + "description": "Removes current entity from the database.", + "type": "object", + "additionalProperties": false + }, + "softRemove": { + "description": "Records the delete date of current entity.", + "type": "object", + "additionalProperties": false + }, + "recover": { + "description": "Recovers a given entity in the database.", + "type": "object", + "additionalProperties": false + }, + "reload": { + "description": "Reloads entity data from the database.", + "type": "object", + "additionalProperties": false } }, "additionalProperties": false, + "definitions": { + "CustomStatus": { + "type": "object", + "properties": { + "emoji_id": { + "type": "string" + }, + "emoji_name": { + "type": "string" + }, + "expires_at": { + "type": "integer" + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false + }, + "FriendSourceFlags": { + "type": "object", + "properties": { + "all": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "all" + ] + }, + "GuildFolder": { + "type": "object", + "properties": { + "color": { + "type": "integer" + }, + "guild_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "color", + "guild_ids", + "id", + "name" + ] + } + }, "$schema": "http://json-schema.org/draft-07/schema#" } } \ No newline at end of file diff --git a/api/src/routes/channels/#channel_id/index.ts b/api/src/routes/channels/#channel_id/index.ts index 68b52be6..70c34f05 100644 --- a/api/src/routes/channels/#channel_id/index.ts +++ b/api/src/routes/channels/#channel_id/index.ts @@ -71,6 +71,8 @@ export interface ChannelModifySchema { nsfw?: boolean; rtc_region?: string; default_auto_archive_duration?: number; + flags?: number; + default_thread_rate_limit_per_user?: number; } router.patch("/", route({ body: "ChannelModifySchema", permission: "MANAGE_CHANNELS" }), async (req: Request, res: Response) => { diff --git a/api/src/routes/channels/#channel_id/invites.ts b/api/src/routes/channels/#channel_id/invites.ts index a53b1de4..c0279f49 100644 --- a/api/src/routes/channels/#channel_id/invites.ts +++ b/api/src/routes/channels/#channel_id/invites.ts @@ -36,7 +36,7 @@ router.post("/", route({ body: "InviteCreateSchema", permission: "CREATE_INSTANT const invite = await OrmUtils.mergeDeep(new Invite(),{ code: random(), - temporary: req.body.temporary, + temporary: req.body.temporary || true, uses: 0, max_uses: req.body.max_uses, max_age: req.body.max_age, diff --git a/api/src/routes/channels/#channel_id/webhooks.ts b/api/src/routes/channels/#channel_id/webhooks.ts index 8f0e0a7f..00bf4619 100644 --- a/api/src/routes/channels/#channel_id/webhooks.ts +++ b/api/src/routes/channels/#channel_id/webhooks.ts @@ -12,7 +12,7 @@ export interface WebhookCreateSchema { * @maxLength 80 */ name: string; - avatar: string; + avatar?: string; } //TODO: implement webhooks router.get("/", route({}), async (req: Request, res: Response) => { @@ -36,6 +36,7 @@ router.post("/", route({ body: "WebhookCreateSchema", permission: "MANAGE_WEBHOO if (name === "clyde") throw new HTTPError("Invalid name", 400); // TODO: save webhook in database and send response + res.json(new Webhook()); }); export default router; diff --git a/api/src/util/handlers/route.ts b/api/src/util/handlers/route.ts index eaf7dc91..f8130f3c 100644 --- a/api/src/util/handlers/route.ts +++ b/api/src/util/handlers/route.ts @@ -117,6 +117,11 @@ export function route(opts: RouteOptions) { const valid = validate(normalizeBody(req.body)); if (!valid) { const fields: Record<string, { code?: string; message: string }> = {}; + if(process.env.LOG_INVALID_BODY) { + console.log(`Got invalid request: ${req.method} ${req.originalUrl}`) + console.log(req.body) + validate.errors?.forEach(x => console.log(x.params)) + } validate.errors?.forEach((x) => (fields[x.instancePath.slice(1)] = { code: x.keyword, message: x.message || "" })); throw FieldErrors(fields); } diff --git a/bundle/package.json b/bundle/package.json index b67598b8..7431a96f 100644 --- a/bundle/package.json +++ b/bundle/package.json @@ -9,10 +9,11 @@ "depcheck": "node scripts/depcheck.js", "syncdeps": "node scripts/install.js", "build": "node scripts/build.js", + "genschemas": "node scripts/update_schemas.js", "start": "node scripts/build.js && node --enable-source-maps dist/bundle/src/start.js", "start:bundle": "node --enable-source-maps dist/bundle/src/start.js", "start:bundle:dbg": "node --enable-source-maps --inspect dist/bundle/src/start.js", - "start:bundle:vscode-dbg": "npm run build clean logerrors pretty-errors && node --enable-source-maps --inspect dist/bundle/src/start.js", + "start:bundle:vscode-dbg": "npm run genschemas && npm run build clean logerrors pretty-errors && node --enable-source-maps --inspect dist/bundle/src/start.js", "test": "echo \"Error: no test specified\" && exit 1", "migrate": "cd ../util/ && npm i && node --require ts-node/register node_modules/typeorm/cli.js -f ../util/ormconfig.json migration:run", "tsnode": "npx ts-node --transpile-only -P tsnode.tsconfig.json src/start.ts" diff --git a/bundle/scripts/update_schemas.js b/bundle/scripts/update_schemas.js index 516b9592..a018120b 100644 --- a/bundle/scripts/update_schemas.js +++ b/bundle/scripts/update_schemas.js @@ -6,4 +6,4 @@ const { argv, stdout, exit } = require("process"); const { execIn, getLines, parts } = require("./utils"); -execIn("node scripts/generate_schema.js", path.join("..", "..", "api")); \ No newline at end of file +execIn("node scripts/generate_schema.js", path.join("..", "api")); \ No newline at end of file diff --git a/env-vars.md b/env-vars.md index c24ea1a2..6c56c184 100644 --- a/env-vars.md +++ b/env-vars.md @@ -14,4 +14,5 @@ |STORAGE\_BUCKET|s3 bucket name|S3 bucket name| |DB\_UNSAFE|any|Ignores migrations for database, enabled if defined| |DB\_VERBOSE|any|Log database queries, enabled if defined| -|DB\_MIGRATE|any|Exit fosscord after connecting to and migrating database, used internally| \ No newline at end of file +|DB\_MIGRATE|any|Exit fosscord after connecting to and migrating database, used internally| +|LOG\_INVALID\_BODY|any|Log request method, path and body if invalid| diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts index 4e275592..ce4385a3 100644 --- a/gateway/src/opcodes/Identify.ts +++ b/gateway/src/opcodes/Identify.ts @@ -102,8 +102,9 @@ export async function onIdentify(this: WebSocket, data: Payload) { ]); if (!user) return this.close(CLOSECODES.Authentication_failed); - if (!user.settings) { + if (!user.settings) { //settings may not exist after updating... user.settings = new UserSettings(); + user.settings.id = user.id; await user.settings.save(); } diff --git a/util/src/entities/BaseClass.ts b/util/src/entities/BaseClass.ts index c872e7f1..aecc2465 100644 --- a/util/src/entities/BaseClass.ts +++ b/util/src/entities/BaseClass.ts @@ -1,5 +1,5 @@ import "reflect-metadata"; -import { BaseEntity, EntityMetadata, ObjectIdColumn, PrimaryColumn, FindOptionsWhere, Generated, SaveOptions } from "typeorm"; +import { BaseEntity, ObjectIdColumn, PrimaryColumn, SaveOptions } from "typeorm"; import { Snowflake } from "../util/Snowflake"; export class BaseClassWithoutId extends BaseEntity { diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts index ade0fb39..a576d7af 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts @@ -151,6 +151,13 @@ export class Channel extends BaseClass { }) webhooks?: Webhook[]; + @Column({ nullable: true }) + flags?: number = 0; + + @Column({ nullable: true }) + default_thread_rate_limit_per_user?: number = 0; + + // TODO: DM channel static async createChannel( channel: Partial<Channel>, diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index 6edcda97..61343e81 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -185,8 +185,10 @@ export class User extends BaseClass { notes: { [key: string]: string } = {}; //key is ID of user async save(): Promise<any> { - await this.settings.save(); - return this.save(); + if(!this.settings) this.settings = new UserSettings(); + this.settings.id = this.id; + //await this.settings.save(); + return super.save(); } toPublicUser() { diff --git a/util/src/migrations/mariadb/1660265930624-CodeCleanup5.ts b/util/src/migrations/mariadb/1660265930624-CodeCleanup5.ts new file mode 100644 index 00000000..04f8e6af --- /dev/null +++ b/util/src/migrations/mariadb/1660265930624-CodeCleanup5.ts @@ -0,0 +1,53 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class CodeCleanup51660265930624 implements MigrationInterface { + name = 'CodeCleanup51660265930624' + + 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(` + 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(` + 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 \`channels\` DROP COLUMN \`default_thread_rate_limit_per_user\` + `); + await queryRunner.query(` + ALTER TABLE \`channels\` DROP COLUMN \`flags\` + `); + await queryRunner.query(` + ALTER TABLE \`users\` DROP INDEX \`IDX_76ba283779c8441fd5ff819c8c\` + `); + await queryRunner.query(` + ALTER TABLE \`users\` DROP COLUMN \`settingsId\` + `); + } + +} diff --git a/util/src/migrations/postgres/1660265907544-CodeCleanup5.ts b/util/src/migrations/postgres/1660265907544-CodeCleanup5.ts new file mode 100644 index 00000000..157d686a --- /dev/null +++ b/util/src/migrations/postgres/1660265907544-CodeCleanup5.ts @@ -0,0 +1,26 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class CodeCleanup51660265907544 implements MigrationInterface { + name = 'CodeCleanup51660265907544' + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` + ALTER TABLE "channels" + ADD "flags" integer + `); + await queryRunner.query(` + ALTER TABLE "channels" + ADD "default_thread_rate_limit_per_user" integer + `); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` + ALTER TABLE "channels" DROP COLUMN "default_thread_rate_limit_per_user" + `); + await queryRunner.query(` + ALTER TABLE "channels" DROP COLUMN "flags" + `); + } + +} diff --git a/util/src/migrations/sqlite/1660260539853-CodeCleanup4.ts b/util/src/migrations/sqlite/1660260539853-CodeCleanup4.ts deleted file mode 100644 index d3f2a40d..00000000 --- a/util/src/migrations/sqlite/1660260539853-CodeCleanup4.ts +++ /dev/null @@ -1,459 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class CodeCleanup41660260539853 implements MigrationInterface { - name = 'CodeCleanup41660260539853' - - public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` - CREATE TABLE "temporary_users" ( - "id" varchar PRIMARY KEY NOT NULL, - "username" varchar NOT NULL, - "discriminator" varchar NOT NULL, - "avatar" varchar, - "accent_color" integer, - "banner" varchar, - "phone" varchar, - "desktop" boolean NOT NULL, - "mobile" boolean NOT NULL, - "premium" boolean NOT NULL, - "premium_type" integer NOT NULL, - "bot" boolean NOT NULL, - "bio" varchar NOT NULL, - "system" boolean NOT NULL, - "nsfw_allowed" boolean NOT NULL, - "mfa_enabled" boolean NOT NULL, - "totp_secret" varchar, - "totp_last_ticket" varchar, - "created_at" datetime NOT NULL, - "premium_since" datetime, - "verified" boolean NOT NULL, - "disabled" boolean NOT NULL, - "deleted" boolean NOT NULL, - "email" varchar, - "flags" varchar NOT NULL, - "public_flags" integer NOT NULL, - "rights" bigint NOT NULL, - "data" text NOT NULL, - "fingerprints" text NOT NULL, - "extended_settings" text NOT NULL, - "notes" text NOT NULL, - "settingsId" varchar, - CONSTRAINT "UQ_b1dd13b6ed980004a795ca184a6" UNIQUE ("settingsId") - ) - `); - await queryRunner.query(` - INSERT INTO "temporary_users"( - "id", - "username", - "discriminator", - "avatar", - "accent_color", - "banner", - "phone", - "desktop", - "mobile", - "premium", - "premium_type", - "bot", - "bio", - "system", - "nsfw_allowed", - "mfa_enabled", - "totp_secret", - "totp_last_ticket", - "created_at", - "premium_since", - "verified", - "disabled", - "deleted", - "email", - "flags", - "public_flags", - "rights", - "data", - "fingerprints", - "extended_settings", - "notes" - ) - SELECT "id", - "username", - "discriminator", - "avatar", - "accent_color", - "banner", - "phone", - "desktop", - "mobile", - "premium", - "premium_type", - "bot", - "bio", - "system", - "nsfw_allowed", - "mfa_enabled", - "totp_secret", - "totp_last_ticket", - "created_at", - "premium_since", - "verified", - "disabled", - "deleted", - "email", - "flags", - "public_flags", - "rights", - "data", - "fingerprints", - "extended_settings", - "notes" - FROM "users" - `); - await queryRunner.query(` - DROP TABLE "users" - `); - await queryRunner.query(` - ALTER TABLE "temporary_users" - RENAME TO "users" - `); - await queryRunner.query(` - CREATE TABLE "temporary_users" ( - "id" varchar PRIMARY KEY NOT NULL, - "username" varchar NOT NULL, - "discriminator" varchar NOT NULL, - "avatar" varchar, - "accent_color" integer, - "banner" varchar, - "phone" varchar, - "desktop" boolean NOT NULL, - "mobile" boolean NOT NULL, - "premium" boolean NOT NULL, - "premium_type" integer NOT NULL, - "bot" boolean NOT NULL, - "bio" varchar NOT NULL, - "system" boolean NOT NULL, - "nsfw_allowed" boolean NOT NULL, - "mfa_enabled" boolean NOT NULL, - "totp_secret" varchar, - "totp_last_ticket" varchar, - "created_at" datetime NOT NULL, - "premium_since" datetime, - "verified" boolean NOT NULL, - "disabled" boolean NOT NULL, - "deleted" boolean NOT NULL, - "email" varchar, - "flags" varchar NOT NULL, - "public_flags" integer NOT NULL, - "rights" bigint NOT NULL, - "data" text NOT NULL, - "fingerprints" text NOT NULL, - "extended_settings" text NOT NULL, - "notes" text NOT NULL, - "settingsId" varchar, - CONSTRAINT "UQ_b1dd13b6ed980004a795ca184a6" UNIQUE ("settingsId"), - CONSTRAINT "FK_76ba283779c8441fd5ff819c8cf" FOREIGN KEY ("settingsId") REFERENCES "user_settings" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION - ) - `); - await queryRunner.query(` - INSERT INTO "temporary_users"( - "id", - "username", - "discriminator", - "avatar", - "accent_color", - "banner", - "phone", - "desktop", - "mobile", - "premium", - "premium_type", - "bot", - "bio", - "system", - "nsfw_allowed", - "mfa_enabled", - "totp_secret", - "totp_last_ticket", - "created_at", - "premium_since", - "verified", - "disabled", - "deleted", - "email", - "flags", - "public_flags", - "rights", - "data", - "fingerprints", - "extended_settings", - "notes", - "settingsId" - ) - SELECT "id", - "username", - "discriminator", - "avatar", - "accent_color", - "banner", - "phone", - "desktop", - "mobile", - "premium", - "premium_type", - "bot", - "bio", - "system", - "nsfw_allowed", - "mfa_enabled", - "totp_secret", - "totp_last_ticket", - "created_at", - "premium_since", - "verified", - "disabled", - "deleted", - "email", - "flags", - "public_flags", - "rights", - "data", - "fingerprints", - "extended_settings", - "notes", - "settingsId" - FROM "users" - `); - await queryRunner.query(` - DROP TABLE "users" - `); - await queryRunner.query(` - ALTER TABLE "temporary_users" - RENAME TO "users" - `); - } - - public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` - ALTER TABLE "users" - RENAME TO "temporary_users" - `); - await queryRunner.query(` - CREATE TABLE "users" ( - "id" varchar PRIMARY KEY NOT NULL, - "username" varchar NOT NULL, - "discriminator" varchar NOT NULL, - "avatar" varchar, - "accent_color" integer, - "banner" varchar, - "phone" varchar, - "desktop" boolean NOT NULL, - "mobile" boolean NOT NULL, - "premium" boolean NOT NULL, - "premium_type" integer NOT NULL, - "bot" boolean NOT NULL, - "bio" varchar NOT NULL, - "system" boolean NOT NULL, - "nsfw_allowed" boolean NOT NULL, - "mfa_enabled" boolean NOT NULL, - "totp_secret" varchar, - "totp_last_ticket" varchar, - "created_at" datetime NOT NULL, - "premium_since" datetime, - "verified" boolean NOT NULL, - "disabled" boolean NOT NULL, - "deleted" boolean NOT NULL, - "email" varchar, - "flags" varchar NOT NULL, - "public_flags" integer NOT NULL, - "rights" bigint NOT NULL, - "data" text NOT NULL, - "fingerprints" text NOT NULL, - "extended_settings" text NOT NULL, - "notes" text NOT NULL, - "settingsId" varchar, - CONSTRAINT "UQ_b1dd13b6ed980004a795ca184a6" UNIQUE ("settingsId") - ) - `); - await queryRunner.query(` - INSERT INTO "users"( - "id", - "username", - "discriminator", - "avatar", - "accent_color", - "banner", - "phone", - "desktop", - "mobile", - "premium", - "premium_type", - "bot", - "bio", - "system", - "nsfw_allowed", - "mfa_enabled", - "totp_secret", - "totp_last_ticket", - "created_at", - "premium_since", - "verified", - "disabled", - "deleted", - "email", - "flags", - "public_flags", - "rights", - "data", - "fingerprints", - "extended_settings", - "notes", - "settingsId" - ) - SELECT "id", - "username", - "discriminator", - "avatar", - "accent_color", - "banner", - "phone", - "desktop", - "mobile", - "premium", - "premium_type", - "bot", - "bio", - "system", - "nsfw_allowed", - "mfa_enabled", - "totp_secret", - "totp_last_ticket", - "created_at", - "premium_since", - "verified", - "disabled", - "deleted", - "email", - "flags", - "public_flags", - "rights", - "data", - "fingerprints", - "extended_settings", - "notes", - "settingsId" - FROM "temporary_users" - `); - await queryRunner.query(` - DROP TABLE "temporary_users" - `); - await queryRunner.query(` - ALTER TABLE "users" - RENAME TO "temporary_users" - `); - await queryRunner.query(` - CREATE TABLE "users" ( - "id" varchar PRIMARY KEY NOT NULL, - "username" varchar NOT NULL, - "discriminator" varchar NOT NULL, - "avatar" varchar, - "accent_color" integer, - "banner" varchar, - "phone" varchar, - "desktop" boolean NOT NULL, - "mobile" boolean NOT NULL, - "premium" boolean NOT NULL, - "premium_type" integer NOT NULL, - "bot" boolean NOT NULL, - "bio" varchar NOT NULL, - "system" boolean NOT NULL, - "nsfw_allowed" boolean NOT NULL, - "mfa_enabled" boolean NOT NULL, - "totp_secret" varchar, - "totp_last_ticket" varchar, - "created_at" datetime NOT NULL, - "premium_since" datetime, - "verified" boolean NOT NULL, - "disabled" boolean NOT NULL, - "deleted" boolean NOT NULL, - "email" varchar, - "flags" varchar NOT NULL, - "public_flags" integer NOT NULL, - "rights" bigint NOT NULL, - "data" text NOT NULL, - "fingerprints" text NOT NULL, - "extended_settings" text NOT NULL, - "notes" text NOT NULL - ) - `); - await queryRunner.query(` - INSERT INTO "users"( - "id", - "username", - "discriminator", - "avatar", - "accent_color", - "banner", - "phone", - "desktop", - "mobile", - "premium", - "premium_type", - "bot", - "bio", - "system", - "nsfw_allowed", - "mfa_enabled", - "totp_secret", - "totp_last_ticket", - "created_at", - "premium_since", - "verified", - "disabled", - "deleted", - "email", - "flags", - "public_flags", - "rights", - "data", - "fingerprints", - "extended_settings", - "notes" - ) - SELECT "id", - "username", - "discriminator", - "avatar", - "accent_color", - "banner", - "phone", - "desktop", - "mobile", - "premium", - "premium_type", - "bot", - "bio", - "system", - "nsfw_allowed", - "mfa_enabled", - "totp_secret", - "totp_last_ticket", - "created_at", - "premium_since", - "verified", - "disabled", - "deleted", - "email", - "flags", - "public_flags", - "rights", - "data", - "fingerprints", - "extended_settings", - "notes" - FROM "temporary_users" - `); - await queryRunner.query(` - DROP TABLE "temporary_users" - `); - } - -} |