Skip to content

Commit de7f70b

Browse files
committed
add migration
1 parent fc032f0 commit de7f70b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { MigrationInterface, QueryRunner } from 'typeorm';
2+
3+
export class CreateUsersTable1611484925515 implements MigrationInterface {
4+
public async up(queryRunner: QueryRunner): Promise<void> {
5+
await queryRunner.query(
6+
`CREATE TABLE users (
7+
id int(11) NOT NULL AUTO_INCREMENT,
8+
firstName varchar(255) NOT NULL,
9+
lastName varchar(255) NOT NULL,
10+
email varchar(255) NOT NULL,
11+
password varchar(255) NOT NULL,
12+
PRIMARY KEY (id)
13+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`,
14+
);
15+
}
16+
17+
public async down(queryRunner: QueryRunner): Promise<void> {
18+
await queryRunner.query(`DROP TABLE IF EXISTS users;`);
19+
}
20+
}

0 commit comments

Comments
 (0)