https://github.com/h44z/lightmigrate-mongodb
Lightweight database migragtion library for Golang - MongoDB driver
https://github.com/h44z/lightmigrate-mongodb
database golang migration mongodb
Last synced: 3 months ago
JSON representation
Lightweight database migragtion library for Golang - MongoDB driver
- Host: GitHub
- URL: https://github.com/h44z/lightmigrate-mongodb
- Owner: h44z
- License: mit
- Created: 2022-01-13T15:22:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-14T16:20:14.000Z (over 4 years ago)
- Last Synced: 2025-01-28T01:26:15.613Z (over 1 year ago)
- Topics: database, golang, migration, mongodb
- Language: Go
- Homepage: https://github.com/h44z/lightmigrate
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# LightMigrate - MongoDB migration driver (v2 alpha)
[](https://codecov.io/gh/h44z/lightmigrate-mongodb)
[](https://opensource.org/licenses/MIT)
[](https://pkg.go.dev/github.com/h44z/lightmigrate-mongodb/mongodb)

[](https://goreportcard.com/report/github.com/h44z/lightmigrate-mongodb)


[](https://github.com/h44z/lightmigrate-mongodb/releases)
This module is part of the [LightMigrate](https://github.com/h44z/lightmigrate) library.
It provides a migration driver for MongoDB.
## Features
* Driver work with mongo through [db.runCommands](https://docs.mongodb.com/manual/reference/command/)
* Migrations support json format. It contains array of commands for `db.runCommand`. Every command is executed in separate request to the database.
* All json keys have to be in quotes `"`
* [Examples](./examples)
## Configuration Options
Configuration options can be passed to the constructor using the `With` functions.
| Config Value | Defaults | Description |
|------------------------|-------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `MigrationsCollection` | schema_migrations | Name of the migrations collection. |
| `Transactions` | false | If set to `true` wrap commands in [transaction](https://docs.mongodb.com/manual/core/transactions). Available only for replica set. |
| `Locking` | disabled / empty | The locking configuration, see Locking Config table below. |
| `Logger` | log.Default() | The logger instance that should be used. |
| `VerboseLogging` | false | If set to true, more log messages will be printed. |
| Locking Config Value | Defaults | Description |
|------------------------|-----------------------|------------------------------------------------------|
| `MigrationsCollection` | migrate_advisory_lock | Name of the locking collection. |
| `IndexName` | lock_unique_key | Name of the unique index for the locking collection. |
| `Enabled` | false | A boolean flag to enable the database locking. |