DbShift Core provides simple and light logic for the management of database-schema migrations. You will be able to create migrations, check the current db status, decide to upgrade or downgrade easily. It can be easily implemented with specific database clients.
DbShift Core aims to provide logic and not an installable command. You can use a DbShift Client implementation according to your database:
Set your configuration
It creates two files ($timestamp.down.sql
and $timestamp.up.sql
) at your migrations folder.
dbshift create my-migration-description
Check status of your migrations.
dbshift status
Upgrade migrations.
dbshift upgrade
dbshift upgrade <toInclusiveMigrationVersion>
Downgrade migrations.
dbshift downgrade
dbshift downgrade <toInclusiveMigrationVersion>
Key | Description | Value example |
---|---|---|
DBSHIFT_ABS_FOLDER_MIGRATIONS |
Where migrations are created and stored. | /srv/app/migrations |
DBSHIFT_OPTION_IS_CREATE_DISABLED |
Disable create command (useful on production). | true / false (default) |
DBSHIFT_OPTION_IS_DOWNGRADE_DISABLED |
Disable downgrade command (useful on production). | true / false (default) |
DBSHIFT_OPTION_IS_UPGRADE_DISABLED |
Disable upgrade command (useful on production). | true / false (default) |
This configuration represents the basic configuration for the DbShift Core. More configurations can be offered by the single DbShift Client.
- Queries must be database name agnostic
- SRP according to your description
- Write both upgrade and downgrade migrations
The following error-codes interval is reserved for core usage: [1, 90]
.
Code | Description |
---|---|
1 |
When no command is passed in the no-interactive mode. |
The client implementation interval is [100,255]
.
The environment variables must have the following prefix: DBSHIFT_CLI_<DBTYPE>
.
Example for MySQL
:
- Prefix:
DBSHIFT_CLI_MYSQL
- Variables:
DBSHIFT_CLI_MYSQL_X
,DBSHIFT_CLI_MYSQL_Y
,DBSHIFT_CLI_MYSQL_Z