Skip to content

Instantly share code, notes, and snippets.

@rapala61
Last active April 10, 2016 01:12
Show Gist options
  • Save rapala61/53a839da838afd674e3b to your computer and use it in GitHub Desktop.
Save rapala61/53a839da838afd674e3b to your computer and use it in GitHub Desktop.
Generate Migrations.

Migrations Tasks Lab (35m)

Description

You are tasked with creating a table in your freshly created reservations database. This table will hold plane tickets detail information.

Be mindful of the data types you will choose for your table columns. Being told you don't have enough fuel to reach your destination mid flight is no joke!

Remember that to create an Active Record migration, you need to use Rake and its tasks: Example:

cheese@McNCheese$ bundle exec rake db:create
cheese@McNCheese$ bundle exec rake db:create_migration NAME=create_mac_and_cheese_stock_table

Requirements

Make sure you are following the right naming conventions for your table and columns.

  • Run the rake task to create the reservations database. NOTE: Remember your database name should be in the database.yml file.
  • Create a migration for the airplane_tickets table.
  • The following information is to be saved in this table:
    • The Airline name
    • Flight number
    • Destination
    • Origin
    • The first name of the flyer
    • The last name of the flyer
    • The time of the flight
    • The price

Bonus

  • Create a bare bones Sinatra app that ONLY displays all tickets in the page.
  • Create 5 individual tickets through SQL using psql
  • NOTE: It is only complete if you can see all 5 tickets in the page.

Deliverables

  • Slack me your migration(s) file (should be inside the db/ folder).
  • If completed Bonus: Add a screenshot of all the tickets displayed in the page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment