-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
87 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ DB_USERNAME=nest | |
DB_PASSWORD=nest | ||
DB_HOST=db | ||
DB_PORT=3306 | ||
DB_DATABASE=nest | ||
DB_DATABASE=nest | ||
DB_SYNC=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const dotenv = require('dotenv'); | ||
|
||
dotenv.config(); | ||
|
||
const { | ||
DB_TYPE, | ||
DB_HOST, | ||
DB_USERNAME, | ||
DB_PASSWORD, | ||
DB_PORT, | ||
DB_DATABASE, | ||
} = process.env; | ||
|
||
module.exports = { | ||
type: DB_TYPE, | ||
host: DB_HOST, | ||
port: DB_PORT, | ||
username: DB_USERNAME, | ||
password: DB_PASSWORD, | ||
database: DB_DATABASE, | ||
migrations: [__dirname + '/src/migrations/*{.ts,.js}'], | ||
entities: [__dirname + '/src/**/*.entity.{ts,js}'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class CreateUsersTable1611484925515 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE users ( | ||
id int(11) NOT NULL AUTO_INCREMENT, | ||
firstName varchar(255) NOT NULL, | ||
lastName varchar(255) NOT NULL, | ||
email varchar(255) NOT NULL, | ||
password varchar(255) NOT NULL, | ||
PRIMARY KEY (id) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP TABLE IF EXISTS users;`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters