nestjs-address-module v1.0.0
Git
$ npm run commit
Installation
$ npm install
Running the app
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Migration
All files related migration can be found in the folder migrations.
The config.js file is used to setup various environment where the migration is run.
A fresh migration can be done by removing the schema and creatnig a new one. Step is optional if you are working on a new database.
# Drop the existing schema completely
DROP SCHEMA public CASCADE;
# Create a new schema
CREATE SCHEMA public;
# Set Time Zone
SHOW timezone;
SET timezone = 'Asia/Kolkata';
Migrating all tables to the new schema.
# Migrate all files in the main folder migrations/migrations
npx sequelize-cli db:migrate
# Migrate all files in a sub folder migrations/migrations/autoincrement
npx sequelize-cli db:migrate --migrations-path migrations/migrations/autoincrement
Note: If you want to migrate a specific file, delete name of the table from the table SequelizeMeta and run the migration for that folder.
Run Migration in Production Environment
Give Permission to db user using PgAdmin
npx sequelize-cli db:migrate --env prod
Seeding
Seed all files in the following folders:
- Main Folder
- Features
- Holidays (Need to Publish once migrated)
- Roles
# Run all seeders in the main directory migrations/migrations/seeders
npx sequelize-cli db:seed:all
npx sequelize-cli db:seed:all --env prod
# Run a single seeder in the main directory migrations/migrations/seeders
npx sequelize-cli db:seed --seed 20230509081829-employmentType.js
# Run all seeders in the directory migrations/migrations\seeders\features
npx sequelize-cli db:seed:all --seeders-path migrations\seeders\features
# Run a specific seeder in the directory migrations/migrations\seeders\features
npx sequelize-cli db:seed --seed 20230822102234-feature-user.js --seeders-path migrations\seeders\features
Data Import
Download Employee file from Google Drive as CSV Create RM buddy file from the employee csv by removing all other columns and changing column names
Clear the following Tables
DELETE FROM "PreviousExperiences";
DELETE FROM "LeaveRequests";
DELETE FROM "LeaveMasters";
DELETE FROM "Payscales";
DELETE FROM "RmBuddies";
DELETE FROM "UserFeatures";
DELETE FROM "Onboardings";
DELETE FROM "Profiles";
DELETE FROM "Employees";
DELETE FROM "Users" WHERE "Users"."type" != 'Developer';
Delopyment
serverless deploy --stage prod --aws-profile savi-cloud
- Author - Shiju S S
- Website - https://techtaliya.com
4 months ago