-
Notifications
You must be signed in to change notification settings - Fork 20
Migration
Migration is a process in which we can add some data to the Database, design schema of DB, indexes etc. Migration scripts are run before starting the application. You can also use these scripts to migrate data from one database to another one.
Migrations are needed when an application needs some pre-loaded data to get started. Elevate services need email templates, forms, and entities. This data is added to DB through migration which the frontend app can utilize.
You can create Migrations inside the migration folder.
Each service has a modules folder within which you can find a migration folder for creating a migration. If this migration folder is present in modules, add the following line in the package.json file:
levate-migrations": "module/migrations/bin/migrations.js
To create a migration, run the following command:
npm run elevate-migrations create <migration-file-name>
The migration-file-name should change to the filename after the above command is successfully executed. A command file will be created in src/migrations named -migration-file-name For example, 20220726145008-categoryEntity
Migration for specific operations can be written in -migration-file-name. For example, you can create a migration to create an index on a collection, or to update existing data.
npm run elevate-migrations create migration-file-name
npm run elevate-migrations status
npm run elevate-migrations up
npm run elevate-migrations down