20 lines
720 B
TypeScript
20 lines
720 B
TypeScript
import {Connection} from "mysql";
|
|
import Migration from "wms-core/db/Migration";
|
|
|
|
export default class CreateFilesTable extends Migration {
|
|
public async install(connection: Connection): Promise<void> {
|
|
await this.query('CREATE TABLE files(' +
|
|
'id INT NOT NULL AUTO_INCREMENT,' +
|
|
'slug VARCHAR(259) UNIQUE NOT NULL,' +
|
|
'real_name VARCHAR(259) NOT NULL,' +
|
|
'storage_type VARCHAR(64) NOT NULL,' +
|
|
'storage_path VARCHAR(1745) NOT NULL,' +
|
|
'PRIMARY KEY (id)' +
|
|
')', connection);
|
|
}
|
|
|
|
public async rollback(connection: Connection): Promise<void> {
|
|
await this.query('DROP TABLE IF EXISTS files', connection);
|
|
}
|
|
|
|
} |