Giter Site home page Giter Site logo

kishore007k / nestjs-restapi-sequelize-template Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 172 KB

A basic CRUD app backend created using NestJS, Sequelize, Sequelize-Migration & Swagger for Documentation.

Shell 2.36% JavaScript 13.76% TypeScript 83.88%
nestjs nestjs-sequelize-postgres sequelize-migrations swagger umzug

nestjs-restapi-sequelize-template's Introduction

NestJs-Sequelize-RestAPI

This is a template for NestJs, which contains Sequelize with postgres Database, sequelize migration and Swagger API Documentation.

How to create Migration:

Open a new terminal and enter the following command npx sequelize-cli migration:generate --name <migration-name> then press Enter.

A migration file will be created inside the database/migration folder.

Example:

npx sequelize-cli migration:generate --name add-firstname

This command will create a migration file inside the database/migration folder with the name 20220415042414-add-firstname with the timestamp at the front.

For more Migration related doubts go to the Sequelize Migration page.

Migration Features:

  1. To run the migration, open a new terminal and enter the command npm run migrate status first to check is there any pending migrations that should be run or not.

  2. Running this command will give you a object with keys ex (executed) and pd (pending).

  3. If there is any Migrations pending enter the following command to migrate npm run migrate up.

  4. to revert all the migrations use npm run migrate down. This will revert all the migration that was ever done.

  5. To run more than one migration at a time use the npm run migrate next, this will run all the migrations.

  6. If there was any error in the previous migration you can undo it by npm run migration prev or npm run migrate reset-prev. This will revert only the last migration.

  7. npm run migrate reset-hard, this will drops and creates a new table with the same name.

nestjs-restapi-sequelize-template's People

Watchers

 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.