18 lines
653 B
TypeScript
18 lines
653 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 user_passwords(' +
|
|
'id INT NOT NULL AUTO_INCREMENT,' +
|
|
'user_id INT NOT NULL,' +
|
|
'password VARCHAR(256) NOT NULL,' +
|
|
'PRIMARY KEY(id),' +
|
|
'FOREIGN KEY user_pwd_fk (user_id) REFERENCES users (id) ON DELETE CASCADE' +
|
|
')');
|
|
}
|
|
|
|
public async rollback(): Promise<void> {
|
|
await query('DROP TABLE user_passwords');
|
|
}
|
|
} |