Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeated schema #22

Open
Angham116 opened this issue Aug 21, 2019 · 0 comments
Open

repeated schema #22

Angham116 opened this issue Aug 21, 2019 · 0 comments

Comments

@Angham116
Copy link

Angham116 commented Aug 21, 2019

You have made 2 SQL files for your schema (db_build.sql & test_db.sql)

Suggestion :

you can make 1 SQL file to your schema

    BEGIN;
    DROP TABLE IF EXISTS users, places CASCADE;
   CREATE TABLE users (
     user_id SERIAL PRIMARY KEY,
     user_name VARCHAR(20) NOT NULL,
     email  VARCHAR UNIQUE,
     phone  INT UNIQUE
   ); & so on

then you don't need to repeat the same commands to create tables and add constraints on db_test.js file

you can add the fake_data just.
As :

 INSERT INTO users(user_name,email,phone) VALUES ('Sajeda','[email protected]',0599789523);
 INSERT INTO users(user_name,email,phone) VALUES ('Fares','[email protected]',0599289523);
 INSERT INTO places(place_name,location,service,delivery,image,user_id) VALUES ('take-break','gaza','food',true,'https://images.unsplash.com/photo-1541745537411-b8046dc6d66c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80',1);
 INSERT INTO places(place_name,location,service,delivery,image,user_id) VALUES ('abdallah','gaza','food',true,'https://images.unsplash.com/photo-1541745537411-b8046dc6d66c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80',2);


JUST

@Angham116 Angham116 changed the title 2 sql files !! repeated schema Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant