Skip to content

falmanna/directus-migrator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version code style: prettier


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 -init

cli-init

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>"
    }
  ]
}
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 and schema ]
permissions boolean --permissions or -p Only migrate permissions [ can be combined with roles and schema ]
schema boolean --schema or -c Only migrate permissions [ can be combined with roles and permissions ]
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

About

A cli tool for migrating directus environments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 73.8%
  • JavaScript 26.2%