Guest User

Untitled

a guest
Jul 22nd, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. -- Add this file under your project /database folder (create it if it doesn't exist)
  2. -- then to execute it, run the command:
  3. -- sqlite3 database.sqlite < schema.sql
  4. -- Run it from your terminal after navigating to /database folder
  5. -- this will create a database file called database.sqlite
  6.  
  7. DROP TABLE IF EXISTS customers;
  8.  
  9. CREATE TABLE customers (
  10. id INTEGER PRIMARY KEY AUTOINCREMENT,
  11. title VARCHAR(10),
  12. firstname VARCHAR (50),
  13. surname VARCHAR (50),
  14. email VARCHAR (255)
  15. );
  16.  
  17. DROP TABLE IF EXISTS invoices;
  18.  
  19. CREATE TABLE invoices (
  20. id INTEGER PRIMARY KEY AUTOINCREMENT,
  21. reservation_id INTEGER,
  22. total INTEGER,
  23. surcharges INTEGER,
  24. invoice_date_time DATETIME,
  25. paid BOOLEAN DEFAULT false
  26. );
  27.  
  28. DROP TABLE IF EXISTS room_types;
  29.  
  30. CREATE TABLE room_types (
  31. id INTEGER PRIMARY KEY AUTOINCREMENT,
  32. type_name VARCHAR (50),
  33. original_price INTEGER,
  34. current_price INT
  35. );
  36.  
  37. DROP TABLE IF EXISTS rooms;
  38.  
  39. CREATE TABLE rooms (
  40. id INTEGER PRIMARY KEY AUTOINCREMENT,
  41. room_type_id INTEGER,
  42. sea_view BOOLEAN
  43. );
  44.  
  45. INSERT INTO customers (title, firstname, surname, email) VALUES ('Mr.', 'Laurie', 'Ainley', 'laurie@ainley.com');
  46. INSERT INTO customers (title, firstname, surname, email) VALUES ('Mr.', 'Donald', 'Trump', 'don@twitter.com');
  47. INSERT INTO customers (title, firstname, surname, email) VALUES ('Ms.', 'Beyonce', 'Knowles', 'beyonce@queen.gov');
Add Comment
Please, Sign In to add comment