Directus Migrator
A Command-Line tool to simply migrate Directus Schemas,Roles and Permissions between different environments within your project
Table of contents
Warning
As of right now directus-migrator does not migrate from sqlite to postgress
Getting Started
These instructions will explain how to use the basic directus-migrator command and which arguments are required
Initilization
No installation neccessary. just run the following command from within the project root
npx directus-migrator -i
directus-migrator.config.js
example
const config = {
environments:[
{
"name": "development",
"endpoint": "<development-url>",
"accessToken": "<development_admin_token>"
},
{
"name": "staging",
"endpoint": "<staging-url>",
"accessToken": "<staging_admin_token>"
},
{
"name": "production",
"endpoint": "<production-url>",
"accessToken": "<production_admin_token>",
"production":true
},
]
}
export default config
Usage
Basic
npx directus-migrator -s development -t production
Force Migration
If your environments are not on the exact same version of directus you may need to force the migration with the -force flag
npx directus-migrator -f -s development -t staging
API
Supported options
Options
npx directus-migrator --argument [value]
when adding boolean flags make sure to use --fullFlagName
or -alias
(eg. --init or -i)
Name | Type | usage | Description |
---|---|---|---|
init |
boolean | --init or -i |
Initialize config file |
force |
boolean | --force or -f |
Force migration between directus versions |
roles |
boolean | --roles or -r |
Only migrates roles [ can be combined with permissions,schema,flows ] |
permissions |
boolean | --permissions or -p |
Only migrate permissions [ can be combined with roles,schema,flows ] |
schema |
boolean | --schema or -c |
Only migrate schema [ can be combined with roles,permissions,flows ] |
flows |
boolean | --flows or -l |
Only migrate flows [ can be combined with roles,permissions,schema ] |
help |
boolean | --help or -h |
Display help menu |
source |
string | --source envname or -s envname |
Environment to migrate from |
target |
string | --target envname or -t envname |
Environment to migrate to |
Authors
CodingButter - Initial work - CodingButter
See also the list of contributors who participated in this project.
License
MIT License © CodingButter