x/exodus@0.1.7
Exodus is a MongoDB data migration tool for the Deno runtime environment.
The following flags should be used before running any command:
deno run -A --unstable
Followed by the version of the cli.ts file:https://deno.land/x/exodus@0.1.7/cli.ts
deno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts
It will also run with the following flags --unstable --allow-read --allow-write --allow-net
if you wish to be more specific about permissions
deno run --unstable --allow-read --allow-write --allow-net https://deno.land/x/exodus@0.1.7/cli.ts
init
: Initializes a new Exodus migration project by generating a /migrations
directory and a setup.ts
file in the current working directory. Modify the setup.ts
with your MongoDB database connection information. Exodus uses the settings in this file to connect to your database.deno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts init
create
[commitMessage]
: Creates a new migration file in the /migrations
directory containing a template for fwd
and back
functionalitydeno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts create commitMessage
You may choose to apply migrations incrementally or all at once using the fwd
or full
commands respectively. For every successful migration file a log document will be created and stored in a 'migrationLog' collection within the database. Avoid manually altering these log files if possible, as exodus uses them to keep track of the current state of the migrations.
fwd
: Applies the next pending migrationdeno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts fwd
full
: Applies all pending migrationsdeno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts full
Rollingback changes is done incrementally. Successful rollbacks will delete the associated log file from the migrationLog collection.
back
: Rollback changes of last applied migrationdeno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts back
You can display the current status of your migrations
log
: Displays a table of current migrations pending and migrations applied. This log data is retrieved from the migrationLog collections in your database.deno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts log
Migrations will create an exodusLog.txt
locally (cwd) that will keep a complete history of all migrations applied / rolled back. Unlike the migrationLog documents this file is non-essential to exodus and can be removed without affecting any features.
dbInit
: Initializes a new Exodus migration by generating a /database-migration
directory and a setupExtract.ts
and setupApply.ts
file in the current working directory. Modify the setupExtract.ts
with your MongoDB database connection information inorder to pull the data you would like to migrate. Modify the setupApply.ts
with your second MongoDB database connection information in order to apply the data you would like to migrate. Exodus uses the settings in these files to connect to your database.deno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts dbInit
extract
: Extracts the data of an existing MongoDB database and creates a directory with a corresponding name to the extracted database. Within said directory, a data
folder is generated populated by files containing the data of each collection in the extracted database.deno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts extract
apply
: Applies the extracted data to the database specified in the setupApply.ts
file. During application to the new database, apply removes the MongoDB given id from each document, however if the user would like to keep a custom id simply add the argument of apply [ keepId ]
to do so.deno run -A --unstable https://deno.land/x/exodus@0.1.7/cli.ts apply