diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/entities/Member.ts | 15 | ||||
-rw-r--r-- | src/util/migrations/mariadb/1661885910534-guild-member-profiles.ts | 27 | ||||
-rw-r--r-- | src/util/migrations/postgres/1661885830688-guild-member-profiles.ts | 27 | ||||
-rw-r--r-- | src/util/migrations/sqlite/1661885742207-guild-member-profiles.ts | 35 | ||||
-rw-r--r-- | src/util/schemas/BackupCodesChallengeSchema.ts | 2 | ||||
-rw-r--r-- | src/util/schemas/CodesVerificationSchema.ts | 2 | ||||
-rw-r--r-- | src/util/schemas/index.ts | 2 |
7 files changed, 57 insertions, 53 deletions
diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts index 9e9131fe..da0b240e 100644 --- a/src/util/entities/Member.ts +++ b/src/util/entities/Member.ts @@ -1,6 +1,13 @@ import { Column, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, PrimaryGeneratedColumn, RelationId } from "typeorm"; -import { Ban, PublicGuildRelations, Message } from "."; -import { GuildCreateEvent, GuildDeleteEvent, GuildMemberAddEvent, GuildMemberRemoveEvent, GuildMemberUpdateEvent, MessageCreateEvent } from "../interfaces"; +import { Ban, Message, PublicGuildRelations } from "."; +import { + GuildCreateEvent, + GuildDeleteEvent, + GuildMemberAddEvent, + GuildMemberRemoveEvent, + GuildMemberUpdateEvent, + MessageCreateEvent +} from "../interfaces"; import { Config, emitEvent } from "../util"; import { DiscordApiErrors } from "../util/Constants"; import { HTTPError } from "../util/imports/HTTPError"; @@ -301,7 +308,7 @@ export class Member extends BaseClassWithoutId { presences: [], stage_instances: [], threads: [], - embedded_activities: [], + embedded_activities: [] }, user_id } as GuildCreateEvent) @@ -320,7 +327,7 @@ export class Member extends BaseClassWithoutId { attachments: [], embeds: [], sticker_items: [], - edited_timestamp: undefined, + edited_timestamp: undefined }); await Promise.all([ message.save(), diff --git a/src/util/migrations/mariadb/1661885910534-guild-member-profiles.ts b/src/util/migrations/mariadb/1661885910534-guild-member-profiles.ts index 6e1ac3f8..21ee2027 100644 --- a/src/util/migrations/mariadb/1661885910534-guild-member-profiles.ts +++ b/src/util/migrations/mariadb/1661885910534-guild-member-profiles.ts @@ -1,40 +1,39 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class guildMemberProfiles1661885910534 implements MigrationInterface { - name = 'guildMemberProfiles1661885910534' + name = "guildMemberProfiles1661885910534"; - public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE \`members\` ADD \`avatar\` varchar(255) NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`members\` ADD \`banner\` varchar(255) NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`members\` ADD \`bio\` varchar(255) NOT NULL `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`members\` ADD \`communication_disabled_until\` datetime NULL `); - } + } - public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE \`members\` DROP COLUMN \`communication_disabled_until\` `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`members\` DROP COLUMN \`bio\` `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`members\` DROP COLUMN \`banner\` `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE \`members\` DROP COLUMN \`avatar\` `); - } - + } } diff --git a/src/util/migrations/postgres/1661885830688-guild-member-profiles.ts b/src/util/migrations/postgres/1661885830688-guild-member-profiles.ts index 81671250..c6b69234 100644 --- a/src/util/migrations/postgres/1661885830688-guild-member-profiles.ts +++ b/src/util/migrations/postgres/1661885830688-guild-member-profiles.ts @@ -1,40 +1,39 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class guildMemberProfiles1661885830688 implements MigrationInterface { - name = 'guildMemberProfiles1661885830688' + name = "guildMemberProfiles1661885830688"; - public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE "members" ADD "avatar" character varying `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "members" ADD "banner" character varying `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "members" ADD "bio" character varying NOT NULL default '' `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "members" ADD "communication_disabled_until" TIMESTAMP `); - } + } - public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE "members" DROP COLUMN "communication_disabled_until" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "members" DROP COLUMN "bio" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "members" DROP COLUMN "banner" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "members" DROP COLUMN "avatar" `); - } - + } } diff --git a/src/util/migrations/sqlite/1661885742207-guild-member-profiles.ts b/src/util/migrations/sqlite/1661885742207-guild-member-profiles.ts index 24ec9c72..03932c3a 100644 --- a/src/util/migrations/sqlite/1661885742207-guild-member-profiles.ts +++ b/src/util/migrations/sqlite/1661885742207-guild-member-profiles.ts @@ -1,13 +1,13 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class guildMemberProfiles1661885742207 implements MigrationInterface { - name = 'guildMemberProfiles1661885742207' + name = "guildMemberProfiles1661885742207"; - public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` DROP INDEX "IDX_bb2bf9386ac443afbbbf9f12d3" `); - await queryRunner.query(` + await queryRunner.query(` CREATE TABLE "temporary_members" ( "index" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "id" varchar NOT NULL, @@ -29,7 +29,7 @@ export class guildMemberProfiles1661885742207 implements MigrationInterface { CONSTRAINT "FK_16aceddd5b89825b8ed6029ad1c" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "temporary_members"( "index", "id", @@ -58,27 +58,27 @@ export class guildMemberProfiles1661885742207 implements MigrationInterface { "joined_by" FROM "members" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "members" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "temporary_members" RENAME TO "members" `); - await queryRunner.query(` + await queryRunner.query(` CREATE UNIQUE INDEX "IDX_bb2bf9386ac443afbbbf9f12d3" ON "members" ("id", "guild_id") `); - } + } - public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` DROP INDEX "IDX_bb2bf9386ac443afbbbf9f12d3" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "members" RENAME TO "temporary_members" `); - await queryRunner.query(` + await queryRunner.query(` CREATE TABLE "members" ( "index" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "id" varchar NOT NULL, @@ -96,7 +96,7 @@ export class guildMemberProfiles1661885742207 implements MigrationInterface { CONSTRAINT "FK_16aceddd5b89825b8ed6029ad1c" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "members"( "index", "id", @@ -125,12 +125,11 @@ export class guildMemberProfiles1661885742207 implements MigrationInterface { "joined_by" FROM "temporary_members" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "temporary_members" `); - await queryRunner.query(` + await queryRunner.query(` CREATE UNIQUE INDEX "IDX_bb2bf9386ac443afbbbf9f12d3" ON "members" ("id", "guild_id") `); - } - + } } diff --git a/src/util/schemas/BackupCodesChallengeSchema.ts b/src/util/schemas/BackupCodesChallengeSchema.ts index d6b519b7..8e2f0649 100644 --- a/src/util/schemas/BackupCodesChallengeSchema.ts +++ b/src/util/schemas/BackupCodesChallengeSchema.ts @@ -1,3 +1,3 @@ export interface BackupCodesChallengeSchema { password: string; -} \ No newline at end of file +} diff --git a/src/util/schemas/CodesVerificationSchema.ts b/src/util/schemas/CodesVerificationSchema.ts index e8e2e7b4..73c371eb 100644 --- a/src/util/schemas/CodesVerificationSchema.ts +++ b/src/util/schemas/CodesVerificationSchema.ts @@ -2,4 +2,4 @@ export interface CodesVerificationSchema { key: string; nonce: string; regenerate?: boolean; -} \ No newline at end of file +} diff --git a/src/util/schemas/index.ts b/src/util/schemas/index.ts index 320593ec..4e0acb22 100644 --- a/src/util/schemas/index.ts +++ b/src/util/schemas/index.ts @@ -44,4 +44,4 @@ export * from "./UserSettingsSchema"; export * from "./VanityUrlSchema"; export * from "./VoiceStateUpdateSchema"; export * from "./WebhookCreateSchema"; -export * from "./WidgetModifySchema"; \ No newline at end of file +export * from "./WidgetModifySchema"; |