Skip to content

Commit dfbbef3

Browse files
committed
"engine" const value shared
1 parent 99c75d3 commit dfbbef3

39 files changed

+82
-41
lines changed

src/util/entities/Application.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
2121
import { Team } from "./Team";
2222
import { User } from "./User";
23+
import { dbEngine } from "../util/Database";
2324

2425
@Entity({
2526
name: "applications",
26-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
27+
engine: dbEngine,
2728
})
2829
export class Application extends BaseClass {
2930
@Column()

src/util/entities/Attachment.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ import {
2727
import { URL } from "url";
2828
import { deleteFile } from "../util/cdn";
2929
import { BaseClass } from "./BaseClass";
30+
import { dbEngine } from "../util/Database";
3031

3132
@Entity({
3233
name: "attachments",
33-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
34+
engine: dbEngine,
3435
})
3536
export class Attachment extends BaseClass {
3637
@Column()

src/util/entities/AuditLog.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
2121
import { ChannelPermissionOverwrite } from "./Channel";
2222
import { User } from "./User";
23+
import { dbEngine } from "../util/Database";
2324

2425
export enum AuditLogEvents {
2526
// guild level
@@ -113,7 +114,7 @@ export enum AuditLogEvents {
113114

114115
@Entity({
115116
name: "audit_logs",
116-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
117+
engine: dbEngine,
117118
})
118119
export class AuditLog extends BaseClass {
119120
@JoinColumn({ name: "target_id" })

src/util/entities/BackupCodes.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
2121
import { User } from "./User";
2222
import crypto from "crypto";
23+
import { dbEngine } from "../util/Database";
2324

2425
@Entity({
2526
name: "backup_codes",
26-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
27+
engine: dbEngine,
2728
})
2829
export class BackupCode extends BaseClass {
2930
@JoinColumn({ name: "user_id" })

src/util/entities/Badge.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
import { Column, Entity } from "typeorm";
2020
import { BaseClassWithoutId } from "./BaseClass";
21+
import { dbEngine } from "../util/Database";
2122

2223
@Entity({
2324
name: "badges",
24-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
25+
engine: dbEngine,
2526
})
2627
export class Badge extends BaseClassWithoutId {
2728
@Column({ primary: true })

src/util/entities/Ban.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
2121
import { Guild } from "./Guild";
2222
import { User } from "./User";
23+
import { dbEngine } from "../util/Database";
2324

2425
@Entity({
2526
name: "bans",
26-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
27+
engine: dbEngine,
2728
})
2829
export class Ban extends BaseClass {
2930
@Column({ nullable: true })

src/util/entities/Categories.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import { Column, Entity } from "typeorm";
2020
import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
21+
import { dbEngine } from "../util/Database";
2122

2223
// TODO: categories:
2324
// [{
@@ -35,7 +36,7 @@ import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
3536

3637
@Entity({
3738
name: "categories",
38-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
39+
engine: dbEngine,
3940
})
4041
export class Categories extends BaseClassWithoutId {
4142
// Not using snowflake

src/util/entities/Channel.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { Recipient } from "./Recipient";
4444
import { PublicUserProjection, User } from "./User";
4545
import { VoiceState } from "./VoiceState";
4646
import { Webhook } from "./Webhook";
47+
import { dbEngine } from "../util/Database";
4748

4849
export enum ChannelType {
4950
GUILD_TEXT = 0, // a text channel within a guild
@@ -71,7 +72,7 @@ export enum ChannelType {
7172

7273
@Entity({
7374
name: "channels",
74-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
75+
engine: dbEngine,
7576
})
7677
export class Channel extends BaseClass {
7778
@Column()

src/util/entities/ClientRelease.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
import { Column, Entity } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
21+
import { dbEngine } from "../util/Database";
2122

2223
@Entity({
2324
name: "client_release",
24-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
25+
engine: dbEngine,
2526
})
2627
export class Release extends BaseClass {
2728
@Column()

src/util/entities/Config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
import { Column, Entity } from "typeorm";
2020
import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
21+
import { dbEngine } from "../util/Database";
2122

2223
@Entity({
2324
name: "config",
24-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
25+
engine: dbEngine,
2526
})
2627
export class ConfigEntity extends BaseClassWithoutId {
2728
@PrimaryIdColumn()

src/util/entities/ConnectedAccount.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
2020
import { ConnectedAccountTokenData } from "../interfaces";
2121
import { BaseClass } from "./BaseClass";
2222
import { User } from "./User";
23+
import { dbEngine } from "../util/Database";
2324

2425
export type PublicConnectedAccount = Pick<
2526
ConnectedAccount,
@@ -28,7 +29,7 @@ export type PublicConnectedAccount = Pick<
2829

2930
@Entity({
3031
name: "connected_accounts",
31-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
32+
engine: dbEngine,
3233
})
3334
export class ConnectedAccount extends BaseClass {
3435
@Column()

src/util/entities/ConnectionConfigEntity.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
import { Column, Entity } from "typeorm";
2020
import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
21+
import { dbEngine } from "../util/Database";
2122

2223
@Entity({
2324
name: "connection_config",
24-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
25+
engine: dbEngine,
2526
})
2627
export class ConnectionConfigEntity extends BaseClassWithoutId {
2728
@PrimaryIdColumn()

src/util/entities/EmbedCache.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
import { BaseClass } from "./BaseClass";
2020
import { Entity, Column } from "typeorm";
2121
import { Embed } from "./Message";
22+
import { dbEngine } from "../util/Database";
2223

2324
@Entity({
2425
name: "embed_cache",
25-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
26+
engine: dbEngine,
2627
})
2728
export class EmbedCache extends BaseClass {
2829
@Column()

src/util/entities/Emoji.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
2020
import { User } from ".";
2121
import { BaseClass } from "./BaseClass";
2222
import { Guild } from "./Guild";
23+
import { dbEngine } from "../util/Database";
2324

2425
@Entity({
2526
name: "emojis",
26-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
27+
engine: dbEngine,
2728
})
2829
export class Emoji extends BaseClass {
2930
@Column()

src/util/entities/Encryption.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
import { Column, Entity } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
21+
import { dbEngine } from "../util/Database";
2122

2223
@Entity({
2324
name: "security_settings",
24-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
25+
engine: dbEngine,
2526
})
2627
export class SecuritySettings extends BaseClass {
2728
@Column({ nullable: true })

src/util/entities/Guild.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { Template } from "./Template";
3737
import { User } from "./User";
3838
import { VoiceState } from "./VoiceState";
3939
import { Webhook } from "./Webhook";
40+
import { dbEngine } from "../util/Database";
4041

4142
// TODO: application_command_count, application_command_counts: {1: 0, 2: 0, 3: 0}
4243
// TODO: guild_scheduled_events
@@ -68,7 +69,7 @@ export const PublicGuildRelations = [
6869

6970
@Entity({
7071
name: "guilds",
71-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
72+
engine: dbEngine,
7273
})
7374
export class Guild extends BaseClass {
7475
@Column({ nullable: true })

src/util/entities/Invite.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ import { Channel } from "./Channel";
2222
import { Guild } from "./Guild";
2323
import { Member } from "./Member";
2424
import { User } from "./User";
25+
import { dbEngine } from "../util/Database";
2526

2627
export const PublicInviteRelation = ["inviter", "guild", "channel"];
2728

2829
@Entity({
2930
name: "invites",
30-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
31+
engine: dbEngine,
3132
})
3233
export class Invite extends BaseClassWithoutId {
3334
@PrimaryIdColumn()

src/util/entities/Member.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { Guild } from "./Guild";
4848
import { Message } from "./Message";
4949
import { Role } from "./Role";
5050
import { PublicUser, User } from "./User";
51+
import { dbEngine } from "../util/Database";
5152

5253
export const MemberPrivateProjection: (keyof Member)[] = [
5354
"id",
@@ -67,7 +68,7 @@ export const MemberPrivateProjection: (keyof Member)[] = [
6768

6869
@Entity({
6970
name: "members",
70-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
71+
engine: dbEngine,
7172
})
7273
@Index(["id", "guild_id"], { unique: true })
7374
export class Member extends BaseClassWithoutId {

src/util/entities/Message.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { Guild } from "./Guild";
3939
import { Webhook } from "./Webhook";
4040
import { Sticker } from "./Sticker";
4141
import { Attachment } from "./Attachment";
42+
import { dbEngine } from "../util/Database";
4243

4344
export enum MessageType {
4445
DEFAULT = 0,
@@ -70,7 +71,7 @@ export enum MessageType {
7071

7172
@Entity({
7273
name: "messages",
73-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
74+
engine: dbEngine,
7475
})
7576
@Index(["channel_id", "id"], { unique: true })
7677
export class Message extends BaseClass {

src/util/entities/Migration.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
PrimaryGeneratedColumn,
2424
BaseEntity,
2525
} from "typeorm";
26+
import { dbEngine } from "../util/Database";
2627

2728
export const PrimaryIdAutoGenerated = process.env.DATABASE?.startsWith(
2829
"mongodb",
@@ -32,7 +33,7 @@ export const PrimaryIdAutoGenerated = process.env.DATABASE?.startsWith(
3233

3334
@Entity({
3435
name: "migrations",
35-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
36+
engine: dbEngine,
3637
})
3738
export class Migration extends BaseEntity {
3839
@PrimaryIdAutoGenerated()

src/util/entities/Note.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
import { Column, Entity, JoinColumn, ManyToOne, Unique } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
2121
import { User } from "./User";
22+
import { dbEngine } from "../util/Database";
2223

2324
@Entity({
2425
name: "notes",
25-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
26+
engine: dbEngine,
2627
})
2728
@Unique(["owner", "target"])
2829
export class Note extends BaseClass {

src/util/entities/RateLimit.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
import { Column, Entity } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
21+
import { dbEngine } from "../util/Database";
2122

2223
@Entity({
2324
name: "rate_limits",
24-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
25+
engine: dbEngine,
2526
})
2627
export class RateLimit extends BaseClass {
2728
@Column() // no relation as it also

src/util/entities/ReadState.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ import {
2727
import { BaseClass } from "./BaseClass";
2828
import { Channel } from "./Channel";
2929
import { User } from "./User";
30+
import { dbEngine } from "../util/Database";
3031

3132
// for read receipts
3233
// notification cursor and public read receipt need to be forwards-only (the former to prevent re-pinging when marked as unread, and the latter to be acceptable as a legal acknowledgement in criminal proceedings), and private read marker needs to be advance-rewind capable
3334
// public read receipt ≥ notification cursor ≥ private fully read marker
3435

3536
@Entity({
3637
name: "read_states",
37-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
38+
engine: dbEngine,
3839
})
3940
@Index(["channel_id", "user_id"], { unique: true })
4041
export class ReadState extends BaseClass {

src/util/entities/Recipient.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
21+
import { dbEngine } from "../util/Database";
2122

2223
@Entity({
2324
name: "recipients",
24-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
25+
engine: dbEngine,
2526
})
2627
export class Recipient extends BaseClass {
2728
@Column()

src/util/entities/Relationship.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
} from "typeorm";
2727
import { BaseClass } from "./BaseClass";
2828
import { User } from "./User";
29+
import { dbEngine } from "../util/Database";
2930

3031
export enum RelationshipType {
3132
outgoing = 4,
@@ -36,7 +37,7 @@ export enum RelationshipType {
3637

3738
@Entity({
3839
name: "relationships",
39-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
40+
engine: dbEngine,
4041
})
4142
@Index(["from_id", "to_id"], { unique: true })
4243
export class Relationship extends BaseClass {

src/util/entities/Role.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
2020

2121
import { BaseClass } from "./BaseClass";
2222
import { Guild } from "./Guild";
23+
import { dbEngine } from "../util/Database";
2324

2425
@Entity({
2526
name: "roles",
26-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
27+
engine: dbEngine,
2728
})
2829
export class Role extends BaseClass {
2930
@Column()

src/util/entities/SecurityKey.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
2020
import { BaseClass } from "./BaseClass";
2121
import { User } from "./User";
22+
import { dbEngine } from "../util/Database";
2223

2324
@Entity({
2425
name: "security_keys",
25-
engine: "InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
26+
engine: dbEngine,
2627
})
2728
export class SecurityKey extends BaseClass {
2829
@Column({ nullable: true })

0 commit comments

Comments
 (0)