-
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.
create script migrate and tables on database
- Loading branch information
1 parent
33e2742
commit b323130
Showing
4 changed files
with
19 additions
and
3 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 |
---|---|---|
@@ -1,2 +1 @@ | ||
node_modules | ||
db/migrate | ||
node_modules |
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,15 @@ | ||
const db = require('../db'); | ||
|
||
db.query('DROP TABLE contacts;'); | ||
db.query(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`) | ||
db.query(`CREATE TABLE IF NOT EXISTS contacts( | ||
id UUID NOT NULL UNIQUE DEFAULT uuid_generate_v4(), | ||
email VARCHAR NOT NULL UNIQUE, | ||
name VARCHAR NOT NULL, | ||
phone VARCHAR NOT NULL, | ||
gender VARCHAR NOT NULL, | ||
birthday DATE NOT NULL, | ||
picture VARCHAR NOT NULL | ||
);`); | ||
|
||
|
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 @@ | ||
console.log("Hello") |
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