Migrations

Overview

Neurelo's schema migration feature enables you to apply the changes to the database for the changes in the schema in your definitions. This feature allows users to modify, update, or enhance their database schema such as adding or modifying tables (or collection) and fields and instantiate those changes in the database. The goal is to keep your database in sync with any changes your application might need over time, providing flexibility and maintaining a well-organized data model. This is crucial for evolving your database along with your application requirements

Using Migrations

Neurelo Schema Migrations is an optional feature that needs to enabled at the Project level. This feature is only supported for Relational Databases such as PostgreSQL and MySQL.

This feature is currently in preview and not intended for production use. Use with caution and provide feedback to help us improve.

Note - this feature can only be enabled during Project Creation. It cannot be re-enabled if this was disabled during project creation or subsequently

Once enabled at the Project level, this feature has two capabilities.

  • Generating Migrations for every commit of the definition with schema changes. This is always enabled for every environment, once it has been enabled at the project level

  • Applying Migrations directly from Neurelo to your data source. This setting needs to be enabled at the Environment level. You can do this while creating a new environment for a project or later from Environment settings page for an existing environment.

Neurelo's definitions capability keeps a record of data model changes using its version control capabilities. This enables Neurelo to automatically generate all the required database migrations in the specific order they were made.

How to access Migrations for an envrionment

  • For a project, access the environment page by clicking "Environments" option from the left sidebar panel. This will load the page with the list of environments deployed for that project.

  • Click on any specific environment and open the detailed environment page. From here, click on "Migrations" tab on this page. This will load the detailed migration page for this environment

This page will show the current schema in the data source (the "Source Schema") and the schema that will need to be migrated to based on the selected commit for the environment (the "Target Schema") and it will list all the commits between the source schema and the target schema. Each commit with a schema change will have one more migrations associated with it. If a commit does not have a schema change (e.g. only has changes for custom query endpoints), then it will not have a migration associated with it.

Each commit can be selected or unselected from the Migrations process.

It is recommended to select all migrations. Please be very careful when unselecting a specific migration, as generally all migrations need to be applied in the sequence they were generated in

Users can -

  • Validate Migrations - This will validate migrations between the source and target schema to see if they can be applied cleanly without possible data loss.

  • Download Migrations - This allows users to download all the migrations across the commits in SQL format. They can then edit these migrations as needed and then apply them directly to the database using a schema migrations tool

  • Mark as Applied - If users want to download migrations and apply them outside of Neurelo, or if Automatic migrations have been disabled for the environment users can use this option to indicate to Neurelo that the migrations have been applied

  • Apply Migrations - If Automatic migrations have been enabled, users can apply migrations directly from Neurelo to the data source

When the user applies a specific commit to the environment (can only be done with the runners stopped), it is recommended to do the following -

  1. Check in the Migrations tab of the environment, if any migrations are needed after the commit has been changed

  2. If Migrations show as pending, then validate the migrations and apply them (manually or through Neurelo, depending on your preference and configuration)

  3. If Migrations have been applied manually, mark them as Applied in Neurelo

  4. Start the Runners

Last updated