18 lines
657 B
TypeScript
18 lines
657 B
TypeScript
import Migration from "wms-core/db/Migration";
|
|
import {query} from "wms-core/db/MysqlConnectionManager";
|
|
|
|
export default class CreateUserPasswordsTable extends Migration {
|
|
public async install(): Promise<void> {
|
|
await query('CREATE TABLE usernames(' +
|
|
'id INT NOT NULL AUTO_INCREMENT,' +
|
|
'user_id INT UNIQUE NOT NULL,' +
|
|
'username VARCHAR(64) UNIQUE NOT NULL,' +
|
|
'PRIMARY KEY(id),' +
|
|
'FOREIGN KEY user_name_fk (user_id) REFERENCES users (id) ON DELETE CASCADE' +
|
|
')');
|
|
}
|
|
|
|
public async rollback(): Promise<void> {
|
|
await query('DROP TABLE usernames');
|
|
}
|
|
} |