Git Product home page Git Product logo

u3_lab_sequelize_migrations_exercise's Introduction

Sequelize Migrations Exercise

Objectives

  • Practice running migrations
  • Fixing schema errors
  • Renaming columns, tables and changing field types

Getting Started

  • Fork and Clone

Step 1: Installing Dependencies

npm install

Ensure our tests run correctly:

npm run test

Step 2: Setting Up Our Database

sequelize db:create
sequelize db:migrate
psql sequelize_migrations_lab_development

\dt

Lab

READ ALL THE INSTRUCTIONS BEFORE PERFORMING ANY ACTIONS, DOING OTHERWISE WILL ENSURE THAT YOU HAVE TO START OVER

All operations need to be completed in order! You'll be creating migrations for each step. Run sequelize db:migrate after each step unless directed otherwise. Check your work often using npm run test and psql to check the table names and columns.

  1. Businesses has a huge problem, the table is uppercased! Fix the table name to be lowercased and plural. HINT: Look at the Business model for the correct tableName.

  2. Locations shares the same problem as Businesses, correct the table naming conflict.

If you've completed steps 1 and 2, at this point you can run the provided seed files, sequelize db:seed:all.

  1. The businesses table phoneNmber column is spelled incorrectly, the column should be phoneNumber, create a migration to rename the column name. Once the migration is successful, you'll need to make sure to update the Business model.

  2. The businesses table has another problem, the businessName column is redundant, rename this field to just name. Run your migration and make the necessary modifications in the Business model. Remember the businessName key should reference the new name column.

At this point you should have 4 passing tests

Resources

u3_lab_sequelize_migrations_exercise's People

Contributors

anpato avatar marveldylan avatar gophereverett avatar nobodyslackey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.