You need to set up your development environment before you can do anything.
-
On OSX: Open your terminal and run the following command to install Node.js and NPM using Homebrew:
brew install node
-
On Windows: Open Command Prompt or PowerShell and run the following command to install Node.js and NPM using Chocolatey:
choco install nodejs
Once Node.js and NPM are installed, navigate to your project directory and run the following command to install all dependencies using Yarn:
yarn install
Migrations are used to set up your database schema. Here are the steps to create and run migrations.
Run the following command to generate a new migration file. Replace create-namatable
with the name of your migration:
npx sequelize-cli migration:generate --name create-namatable
After creating your migration files, run the following command to apply all pending migrations to the database:
npx sequelize-cli db:migrate
Seeders are used to populate your database with initial data. Here are the steps to create and run seeders.
Run the following command to generate a new seeder file. Replace nama_seeder
with the name of your seeder:
npx sequelize-cli seed:generate --name nama_seeder
After creating your seeder files, run the following command to execute all seeders and populate your database with initial data:
npx sequelize-cli db:seed:all
- Install Node.js and NPM using Homebrew (OSX) or Chocolatey (Windows).
- Install Dependencies with
yarn install
. - Create a Migration with
npx sequelize-cli migration:generate --name create-namatable
. - Run Migrations with
npx sequelize-cli db:migrate
. - Create a Seeder with
npx sequelize-cli seed:generate --name nama_seeder
. - Run Seeders with
npx sequelize-cli db:seed:all
.