I am trying to find the best way to update one environment with the data from another. I tested the new migration command ‘8base migration commit’ but it seems to work only for migrations that have been generated in the same environment.
We are working on ci/cd documentation and will release it soon.
8base migration is a file with the code that would be executed during performing commit command.
They are placed in the directory migrations in your project. Each migration has to export a string with the name ‘version’ and function with the name ‘up’.
For now, the version equals ‘v1’. In function ‘up’ you describe the migration’s code. You can use generated migration as an template.
There are several migration commands
‘8base migration status’. The command shows the difference between local migrations in directory <project_path>/migrations and already enrolled migrations. Before each commit command, we recommend performing this command to see which migrations would be committed.
‘8base migration generate’. The command generates migrations on changes which have been applied to schema or system data before.
There are two types of data: system and custom. System data is a schema, auth profiles, roles, permissions. Custom data is data from user’s tables.
‘8base migration commit’. Command commits new migrations to the current environment.
‘8base environment branch -n -m FULL/SYSTEM’. If you need to clone the environment with only system data you need to choose ‘SYSTEM’. If you need to clone the whole environment choose “FULL” mode.
There are new migrations for specified tables with code to create data. If tables have relations command will generate update migration to bind the table’s data.
Switch environment.
Perform ‘8base migration status’. Check new migrations to commit.
Perform ‘8base migration commit’ to commit custom data to another environment.
Be careful. Migrations generate data with record id. If you have cloned environment with FULL mode target environment may to have values with the same id. To avoid this problem you have to destroy the record on the target branch.
If you just delete the record it still will not be able to commit new migrations because of duplicate id.
Alse we recommend to create backup any time before you perform the ‘commit’ command to have opporunity to rollback the environment’s state.
As I understand, you want to clone custom data between environments. Try to follow the actions described above.