All Projects → oslabs-beta → exodus.ts

oslabs-beta / exodus.ts

Licence: other
The first MongoDB compatible data migration tool built on for the Deno runtime environment, allowing users to perform complete schema and database migrations.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to exodus.ts

logrocket deno api
A functional CRUD-like API with Deno and Postgres
Stars: ✭ 23 (-45.24%)
Mutual labels:  deno
vscode-deno-extensionpack
Deno VS Code Extension Pack
Stars: ✭ 12 (-71.43%)
Mutual labels:  deno
swagger2ts
💗 从 Swagger 生成优雅的 Typescript 代码. Generate elegant typescript code from swagger.
Stars: ✭ 17 (-59.52%)
Mutual labels:  deno
database
towards a common interface for SQL databases in Deno TypeScript
Stars: ✭ 15 (-64.29%)
Mutual labels:  deno
merlin
Testing and Benchmarking framework for deno 🧙‍♂️
Stars: ✭ 46 (+9.52%)
Mutual labels:  deno
denoffi
Deno Foreign Function Interface.
Stars: ✭ 37 (-11.9%)
Mutual labels:  deno
iam-policies
Iam policies implementation for create roles and manage permissions
Stars: ✭ 20 (-52.38%)
Mutual labels:  deno
optionals
Rust-like error handling and options for TypeScript and Deno!
Stars: ✭ 97 (+130.95%)
Mutual labels:  deno
deno-fetch-event-adapter
Dispatches global fetch events using Deno's native http server.
Stars: ✭ 18 (-57.14%)
Mutual labels:  deno
espresso
Minimal web framework for Deno
Stars: ✭ 43 (+2.38%)
Mutual labels:  deno
i18next-http-backend
i18next-http-backend is a backend layer for i18next using in Node.js, in the browser and for Deno.
Stars: ✭ 270 (+542.86%)
Mutual labels:  deno
deno install
Deno 安装器(国内加速)
Stars: ✭ 58 (+38.1%)
Mutual labels:  deno
erc20-balance
💎 Get 2000+ ERC-20 token balances with JavaScript. Supports Node.js and Deno
Stars: ✭ 18 (-57.14%)
Mutual labels:  deno
deno-drash-realworld-example-app
Deno + Drash RealWorld example app
Stars: ✭ 56 (+33.33%)
Mutual labels:  deno
event
📆 Strictly typed event emitter with asynciterator support
Stars: ✭ 30 (-28.57%)
Mutual labels:  deno
rippledb
Embeddable key-value database engine in pure TypeScript, based on LSM-Tree
Stars: ✭ 33 (-21.43%)
Mutual labels:  deno
progress
ProgressBar in terminal for deno
Stars: ✭ 39 (-7.14%)
Mutual labels:  deno
rhum
A test double library
Stars: ✭ 92 (+119.05%)
Mutual labels:  deno
api-deno-compiler
This is an api that execute your deno code and send you the output
Stars: ✭ 13 (-69.05%)
Mutual labels:  deno
deno bindgen
Simplified glue code generation for Deno FFI libraries written in Rust.
Stars: ✭ 142 (+238.1%)
Mutual labels:  deno

Exodus

Exodus logo

Exodus is a MongoDB data migration tool for the Deno runtime environment.

Usage

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/[email protected]/cli.ts

deno run -A --unstable https://deno.land/x/[email protected]/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/[email protected]/cli.ts

Initializing a Project

  • 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/[email protected]/cli.ts init

Creating Migrations

  • create [commitMessage]: Creates a new migration file in the /migrations directory containing a template for fwd and back functionality
deno run -A --unstable https://deno.land/x/[email protected]/cli.ts create commitMessage

Defining Migrations

Exodus uses deno_mongo drivers to interact with MongoDB, which has methods/commands similar to the mongoDB shell or node drivers. Use the passed in client and db objects to interact with the database.

Deno_mongo built-in methods:

  • Refer to https://github.com/denodrivers/deno_mongo for built in methods. Most methods are listed in their readme and function the same as the node drivers/MongoDB shell methods. Deno_mongo driver is still in development though so not all methods from node drivers / shell are implemented. HOWEVER

MongoDB database commands:

  • If you want to access MongoDB database commands directly then use client.runCommand( '<databaseName>' , <databaseCommand> ). Use this if the deno_mongo methods aren't enough and you need more actions.
  • e.g. client.runCommand( 'Database1' , { ping: 1} )

Running Migrations

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 migration
deno run -A --unstable https://deno.land/x/[email protected]/cli.ts fwd
  • full : Applies all pending migrations
deno run -A --unstable https://deno.land/x/[email protected]/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 migration
deno run -A --unstable https://deno.land/x/[email protected]/cli.ts back

Checking Applied Migrations

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/[email protected]/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.

Full Database Migration Usage

Initializing a Migration

  • 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/[email protected]/cli.ts dbInit

Extracting Data

  • 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/[email protected]/cli.ts extract

Applying/Migrating Data

  • 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/[email protected]/cli.ts apply
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].