Created
July 22, 2018 08:51
-
-
Save kabaros/da063015ec5cb4f9c298836369e69b84 to your computer and use it in GitHub Desktop.
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
-- Add this file under your project /database folder (create it if it doesn't exist) | |
-- then to execute it, run the command: | |
-- sqlite3 database.sqlite < schema.sql | |
-- Run it from your terminal after navigating to /database folder | |
-- this will create a database file called database.sqlite | |
DROP TABLE IF EXISTS customers; | |
CREATE TABLE customers ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, | |
title VARCHAR(10), | |
firstname VARCHAR (50), | |
surname VARCHAR (50), | |
email VARCHAR (255) | |
); | |
DROP TABLE IF EXISTS invoices; | |
CREATE TABLE invoices ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, | |
reservation_id INTEGER, | |
total INTEGER, | |
surcharges INTEGER, | |
invoice_date_time DATETIME, | |
paid BOOLEAN DEFAULT false | |
); | |
DROP TABLE IF EXISTS room_types; | |
CREATE TABLE room_types ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, | |
type_name VARCHAR (50), | |
original_price INTEGER, | |
current_price INT | |
); | |
DROP TABLE IF EXISTS rooms; | |
CREATE TABLE rooms ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, | |
room_type_id INTEGER, | |
sea_view BOOLEAN | |
); | |
INSERT INTO customers (title, firstname, surname, email) VALUES ('Mr.', 'Laurie', 'Ainley', 'laurie@ainley.com'); | |
INSERT INTO customers (title, firstname, surname, email) VALUES ('Mr.', 'Donald', 'Trump', 'don@twitter.com'); | |
INSERT INTO customers (title, firstname, surname, email) VALUES ('Ms.', 'Beyonce', 'Knowles', 'beyonce@queen.gov'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment