2018-11-24 14:01:06 +02:00
|
|
|
import { MigrationInterface, QueryRunner, Table } from "typeorm";
|
|
|
|
|
|
|
|
export class CreateMessagesTable1543053430712 implements MigrationInterface {
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<any> {
|
|
|
|
await queryRunner.createTable(
|
|
|
|
new Table({
|
|
|
|
name: "messages",
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
name: "id",
|
|
|
|
type: "bigint",
|
|
|
|
unsigned: true,
|
2019-11-02 22:11:26 +02:00
|
|
|
isPrimary: true,
|
2018-11-24 14:01:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "guild_id",
|
|
|
|
type: "bigint",
|
2019-11-02 22:11:26 +02:00
|
|
|
unsigned: true,
|
2018-11-24 14:01:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "channel_id",
|
|
|
|
type: "bigint",
|
2019-11-02 22:11:26 +02:00
|
|
|
unsigned: true,
|
2018-11-24 14:01:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "user_id",
|
|
|
|
type: "bigint",
|
2019-11-02 22:11:26 +02:00
|
|
|
unsigned: true,
|
2018-11-24 14:01:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "is_bot",
|
|
|
|
type: "tinyint",
|
2019-11-02 22:11:26 +02:00
|
|
|
unsigned: true,
|
2018-11-24 14:01:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "data",
|
2019-11-02 22:11:26 +02:00
|
|
|
type: "mediumtext",
|
2018-11-24 14:01:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "posted_at",
|
2019-11-02 22:11:26 +02:00
|
|
|
type: "datetime(3)",
|
2018-11-24 14:01:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "deleted_at",
|
|
|
|
type: "datetime(3)",
|
|
|
|
isNullable: true,
|
2019-11-02 22:11:26 +02:00
|
|
|
default: null,
|
2018-11-24 14:01:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "is_permanent",
|
|
|
|
type: "tinyint",
|
|
|
|
unsigned: true,
|
2019-11-02 22:11:26 +02:00
|
|
|
default: 0,
|
|
|
|
},
|
2018-11-24 14:01:06 +02:00
|
|
|
],
|
|
|
|
indices: [
|
|
|
|
{ columnNames: ["guild_id"] },
|
|
|
|
{ columnNames: ["channel_id"] },
|
|
|
|
{ columnNames: ["user_id"] },
|
|
|
|
{ columnNames: ["is_bot"] },
|
|
|
|
{ columnNames: ["posted_at"] },
|
|
|
|
{ columnNames: ["deleted_at"] },
|
2019-11-02 22:11:26 +02:00
|
|
|
{ columnNames: ["is_permanent"] },
|
|
|
|
],
|
|
|
|
}),
|
2018-11-24 14:01:06 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<any> {
|
|
|
|
await queryRunner.dropTable("messages");
|
|
|
|
}
|
|
|
|
}
|