mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-18 23:09:59 +00:00
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
![]() |
import { MigrationInterface, QueryRunner, Table } from "typeorm";
|
||
|
|
||
|
export class CreateUsernameHistoryTable1556908589679 implements MigrationInterface {
|
||
|
public async up(queryRunner: QueryRunner): Promise<any> {
|
||
|
await queryRunner.createTable(
|
||
|
new Table({
|
||
|
name: "username_history",
|
||
|
columns: [
|
||
|
{
|
||
|
name: "id",
|
||
|
type: "int",
|
||
|
unsigned: true,
|
||
|
isGenerated: true,
|
||
|
generationStrategy: "increment",
|
||
|
isPrimary: true,
|
||
|
},
|
||
|
{
|
||
|
name: "user_id",
|
||
|
type: "bigint",
|
||
|
unsigned: true,
|
||
|
},
|
||
|
{
|
||
|
name: "username",
|
||
|
type: "varchar",
|
||
|
length: "160",
|
||
|
isNullable: true,
|
||
|
},
|
||
|
{
|
||
|
name: "timestamp",
|
||
|
type: "datetime",
|
||
|
default: "CURRENT_TIMESTAMP",
|
||
|
},
|
||
|
],
|
||
|
indices: [
|
||
|
{
|
||
|
columnNames: ["user_id"],
|
||
|
},
|
||
|
],
|
||
|
}),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
public async down(queryRunner: QueryRunner): Promise<any> {
|
||
|
await queryRunner.dropTable("username_history", true);
|
||
|
}
|
||
|
}
|