Skip to content

fiosman/sequelize-migrations-model-seeders

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Long Practice: Sequelize Foundations

In this long practice, you will be adding Sequelize to an Express server, creating a model, and seeding the database.

Getting started

Download the starter. cd into server folder, and install dependencies using npm install.

Create a server/.env file in order to store environment variables. Add a variable DB_FILE with a value of db/dev.db. This will be the location where the SQLITE database will be created (as specified in config/database.js).

To save you some time, the starter includes server/.sequelizerc, server/config/database.js, and server/db/ with migrations, models, and seeders. This means Sequelize has already been initialized.

Run the migration using the appropriate sequelize command. This should create the (empty) database. If successful, it will end with No migrations were executed, database schema was already up to date. and you should now see that the db/dev.db file was created.

Remember: You'll need dotenv before npx in order to set the environment variable for the database file location.

If you encounter any errors or do not see the db file, go back and check that your .env file has been accurately set up. Then rerun the migration.

Phases

This project has been broken down into phases. Complete as much as you can in the time allotted. You can complete any remaining work for additional practice during assessment prep.

If you get stuck, you can formulate good questions, and reach out to your instructors for assistance.

References

You may refer to your previous work, the Sequelize documentation, the documentation for Sequelize CLI, or online resources to assist you in completing this practice.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published