Add Starboard plugin
This commit is contained in:
parent
33d2026556
commit
0c8efedb8c
7 changed files with 550 additions and 5 deletions
85
src/migrations/1544887946307-CreateStarboardTable.ts
Normal file
85
src/migrations/1544887946307-CreateStarboardTable.ts
Normal file
|
@ -0,0 +1,85 @@
|
|||
import { MigrationInterface, QueryRunner, Table } from "typeorm";
|
||||
|
||||
export class CreateStarboardTable1544887946307 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.createTable(
|
||||
new Table({
|
||||
name: "starboards",
|
||||
columns: [
|
||||
{
|
||||
name: "id",
|
||||
type: "int",
|
||||
unsigned: true,
|
||||
isGenerated: true,
|
||||
generationStrategy: "increment",
|
||||
isPrimary: true
|
||||
},
|
||||
{
|
||||
name: "guild_id",
|
||||
type: "bigint",
|
||||
unsigned: true
|
||||
},
|
||||
{
|
||||
name: "channel_id",
|
||||
type: "bigint",
|
||||
unsigned: true
|
||||
},
|
||||
{
|
||||
name: "channel_whitelist",
|
||||
type: "text",
|
||||
isNullable: true,
|
||||
default: null
|
||||
},
|
||||
{
|
||||
name: "emoji",
|
||||
type: "varchar",
|
||||
length: "64"
|
||||
},
|
||||
{
|
||||
name: "reactions_required",
|
||||
type: "smallint",
|
||||
unsigned: true
|
||||
}
|
||||
],
|
||||
indices: [
|
||||
{
|
||||
columnNames: ["guild_id", "emoji"]
|
||||
},
|
||||
{
|
||||
columnNames: ["guild_id", "channel_id"],
|
||||
isUnique: true
|
||||
}
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
await queryRunner.createTable(
|
||||
new Table({
|
||||
name: "starboard_messages",
|
||||
columns: [
|
||||
{
|
||||
name: "starboard_id",
|
||||
type: "int",
|
||||
unsigned: true
|
||||
},
|
||||
{
|
||||
name: "message_id",
|
||||
type: "bigint",
|
||||
unsigned: true
|
||||
},
|
||||
{
|
||||
name: "starboard_message_id",
|
||||
type: "bigint",
|
||||
unsigned: true
|
||||
}
|
||||
]
|
||||
})
|
||||
);
|
||||
await queryRunner.createPrimaryKey("starboard_messages", ["starboard_id", "message_id"]);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.dropTable("starboards", true);
|
||||
await queryRunner.dropTable("starboard_messages", true);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue