Skip to content
This repository was archived by the owner on Jun 28, 2018. It is now read-only.

Conversation

@dimag-jfrog
Copy link
Contributor

Support for MongoDB driver by custom app-logic golang methods.

Users of the driver should pre-register their golang method receiver (struct) with methods in a fixed format - in a similiar fashion to how drivers are pre-registered before running Migrate().

MongoDB eval() operation is deprecated starting from MongoDB 3, so I couldn't use .json files and pass them to eval like .sql files are used for relational databases (as in Mongeez project), and using an embedded javascript interpreter sounds like an overkill, so golang methods were my preferred approach.

Gomethods migration files execution mechanism was added in a mongodb-agnostic manner - so that in future it could be extended for other purposes if needed.

bfitzsimmons and others added 28 commits November 1, 2015 13:14
Using epoch prefixed filenames, multiple developers can commit
migrations while minimizing versioning conflicts.

This commit remains backwards compatible with all previous migrations
and requires no changes to the `schema_migrations` table.

This commit also cleans up migrate-test temp directories
- Added go methods migrator, mongo db template: different from the usual driver
model.
- Added support for bidirectional files (for go methods), appending _up or _down upon context
- Added DriverWithFilnameParser for providing custom filename parser functionality that knows to parse bi-directional file names.
- Changed logic not to use custom filename parser:
  -Supporting up and down files only, no both direction files
  -Using method names as is
- Added complete test to the mongo db migration scenarios
…cific methods

- defined methods receivers registration by name and change the migration files format to include them
- added extensive testing
- currently each driver contains only a single method receiver:
   - enforcing method receiver pre-registration on go methods driver initialization
   - Method receiver name can be removed from files format
- passing the DbName parameter inside the method receiver for the go methods driver
@dimag-jfrog dimag-jfrog changed the title Prepare pr Driver for MongoDB Aug 10, 2016
Release OS signals when you're finished with them.
Bump travis versions to use Go 1.6 and 1.7
Skip tests requiring a DB connection with the '-short' flag
use a non-zero exit code when no command is given
prefix migration files with epoch
Driver for the Crate.io database
@mattes
Copy link
Owner

mattes commented Dec 22, 2016

I rebased with master. Tests fail at:

--- FAIL: TestMigrate (0.41s)
        mongodb_test.go:59: Migration 'v0 -> v1: not exported method aborts migration': FAILED
                expected errors [Method v001_not_exported_method_up is not exported]
                but got [Non existing migrate method: v001_not_exported_method_up]

@dimag-jfrog
Copy link
Contributor Author

OK, I will check/fix it in a few days.

wlcx and others added 4 commits January 5, 2017 15:09
Adds a driver for the embedded Ql database (https://github.com/cznic/ql)
- Fixed test with not-exported method identified as missing: unified the 2 errors into one
- Fixed error message formatting

# Conflicts:
#	docker-compose.yml
- Fixed test with not-exported method identified as missing: unified the 2 errors into one
- Fixed error message formatting

# Conflicts:
#	docker-compose.yml
@dimag-jfrog
Copy link
Contributor Author

dimag-jfrog commented Jan 6, 2017

Merged master and fixed the errors.
I see all the merged changes from master in the diff files, maybe I made a mistake and should have rebased instead? Or is it OK?
If needed I can do it again with only the necessary changes without merging/rebasing with master and let you do the rebase again - or rebase myself.

@mattes
Copy link
Owner

mattes commented Jan 6, 2017

Rebasing would be much appreciated. With 1,884 additions it's really hard for me to understand what changed and what not :-)

@dimag-jfrog
Copy link
Contributor Author

No problem :-)

dacamp and others added 5 commits January 7, 2017 01:28
Using epoch prefixed filenames, multiple developers can commit
migrations while minimizing versioning conflicts.

This commit remains backwards compatible with all previous migrations
and requires no changes to the `schema_migrations` table.

This commit also cleans up migrate-test temp directories
Adds a driver for the embedded Ql database (https://github.com/cznic/ql)
@dimag-jfrog
Copy link
Contributor Author

This branch is a mess after the merge, I'll make a new pull request from a clean branch.

@dimag-jfrog
Copy link
Contributor Author

Created a new branch with rebase (prepare_pr_2_rebase) and a new pull request - Driver for Mongo DB (New).
Closing this pull request.

@dimag-jfrog dimag-jfrog closed this Jan 7, 2017
@dimag-jfrog dimag-jfrog deleted the prepare_pr branch July 18, 2017 08:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.