/LightBnB

Primary LanguageJavaScript

  • write all statements in the 01_schema.sql file.
  • The 01_schema.sql file will end up containing the entire DDL for all of the tables in the ERD we designed in the LighthouseBnB ERD Challenge.

erd

Create Database: CREATE DATABASE IF NOT EXISTS lightbnb;

cd lightBnB

// enter postgresql
psql

Inside the psql terminal, enter the following commands:

\l           -- list all databases
\c lightbnb  -- connect to lightbnb database

In psql terminal, run the following to include the 01_schema.sql file within the migration folder:

\i migrations/01_schema.sql

Should be able to see the new tables in the database.

lightbnb=# \dt
        List of relations
 Schema | Name  | Type  |  Owner  
--------+-------+-------+---------
 public | users | table | vagrant
(1 row)

Seeds

user's password (it's the word "password" hashed with bcrypt):

$2a$10$FB/BOAVhpuLvpOREQVmvmezD4ED/.JBIDRh70tGevYzYzQgFId2u.