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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mattes/migrate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.1
Choose a base ref
...
head repository: mattes/migrate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.3.2
Choose a head ref
  • 12 commits
  • 37 files changed
  • 3 contributors

Commits on Mar 30, 2017

  1. Add MSSQL support

    Andras Laczi committed Mar 30, 2017
    Copy the full SHA
    b7845a7 View commit details

Commits on Apr 20, 2017

  1. Update Readme

    mattes committed Apr 20, 2017
    Copy the full SHA
    9f14676 View commit details

Commits on Apr 24, 2017

  1. Add go 1.8 to travis config

    Fix getting the latest version
    Andras Laczi committed Apr 24, 2017
    Copy the full SHA
    ecd74e1 View commit details
  2. Add wait-retry to mssql test

    Andras Laczi committed Apr 24, 2017
    Copy the full SHA
    7f4000c View commit details

Commits on Apr 25, 2017

  1. Remove go1.4 from travis as the ql package is not compatible and brea…

    …ks the build
    Andras Laczi committed Apr 25, 2017
    Copy the full SHA
    d21443f View commit details
  2. Merge pull request #190 from alaczi/mssql_support

    MSSQL support
    mattes authored Apr 25, 2017
    Copy the full SHA
    78ca4eb View commit details
  3. update travis branch

    mattes committed Apr 25, 2017
    Copy the full SHA
    62dba4f View commit details

Commits on May 6, 2017

  1. rewrite paths

    mattes committed May 6, 2017
    Copy the full SHA
    1887c0f View commit details
  2. rewrite in readmes

    mattes committed May 6, 2017
    Copy the full SHA
    964e6bc View commit details
  3. Merge pull request #212 from mattes/v1-gopkg

    v1: github.com/mattes/migrate -> gopkg.in/mattes/migrate.v1
    mattes authored May 6, 2017
    Copy the full SHA
    1dffba9 View commit details

Commits on May 9, 2017

  1. Register neo4j driver using a pseudo neo4js protocol scheme.

    Neo4J supports both `http` and `https` connections, however `https`
    connections weren't supported previously as the `neo4j` URL scheme
    currently used to identify the driver type is always substituted for
    just `http`.
    
    This PR also registers the driver under an alternate key: `neo4js` which
    given the way the scheme substitution happens, should allow the driver
    to correctly create an `https` connection URL. This will allow the
    library to be used for cases where we don't have access to the plain
    `http` endpoint.
    Sam Mulube committed May 9, 2017
    Copy the full SHA
    250543a View commit details
  2. Merge pull request #216 from thingful/v1.3.1-neo4j-https

    Register neo4j driver using a pseudo `neo4js` protocol scheme.
    mattes authored May 9, 2017
    Copy the full SHA
    afc973c View commit details
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@ language: go
sudo: required

go:
- 1.4
- 1.5
- 1.6
- 1.7
- 1.8

services:
- docker
@@ -16,4 +16,5 @@ before_install:
- sudo mv docker-compose /usr/local/bin
- sed -i -e 's/golang/golang:'"$TRAVIS_GO_VERSION"'/' docker-compose.yml


script: make test
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
__[v3.0 in the making](https://github.com/mattes/migrate/tree/v3.0-prev)__
# You are looking at a deprecated version.
# Use the [latest version](https://github.com/mattes/migrate) instead.

---

# migrate

[![Build Status](https://travis-ci.org/mattes/migrate.svg?branch=master)](https://travis-ci.org/mattes/migrate)
[![GoDoc](https://godoc.org/github.com/mattes/migrate?status.svg)](https://godoc.org/github.com/mattes/migrate)
[![Build Status](https://travis-ci.org/mattes/migrate.svg?branch=v1)](https://travis-ci.org/mattes/migrate)

A migration helper written in Go. Use it in your existing Golang code
or run commands via the CLI.

```
GoCode import github.com/mattes/migrate/migrate
CLI go get -u github.com/mattes/migrate
GoCode import gopkg.in/mattes/migrate.v1/migrate
CLI go get -u gopkg.in/mattes/migrate.v1
```

__Features__

* Super easy to implement [Driver interface](http://godoc.org/github.com/mattes/migrate/driver#Driver).
* Super easy to implement [Driver interface](http://godoc.org/gopkg.in/mattes/migrate.v1/driver#Driver).
* Gracefully quit running migrations on ``^C``.
* No magic search paths routines, no hard-coded config files.
* CLI is build on top of the ``migrate package``.
@@ -33,15 +33,16 @@ __Features__
* [Ql](driver/ql)
* [MongoDB](driver/mongodb)
* [CrateDB](driver/crate)
* [MSSQL](driver/mssql)

Need another driver? Just implement the [Driver interface](http://godoc.org/github.com/mattes/migrate/driver#Driver) and open a PR.
Need another driver? Just implement the [Driver interface](http://godoc.org/gopkg.in/mattes/migrate.v1/driver#Driver) and open a PR.


## Usage from Terminal

```bash
# install
go get github.com/mattes/migrate
go get gopkg.in/mattes/migrate.v1

# create new migration file in path
migrate -url driver://url -path ./migrations create migration_file_xyz
@@ -80,13 +81,13 @@ migrate -url driver://url -path ./migrations goto v

## Usage in Go

See GoDoc here: http://godoc.org/github.com/mattes/migrate/migrate
See GoDoc here: http://godoc.org/gopkg.in/mattes/migrate.v1/migrate

```go
import "github.com/mattes/migrate/migrate"
import "gopkg.in/mattes/migrate.v1/migrate"

// Import any required drivers so that they are registered and available
import _ "github.com/mattes/migrate/driver/mysql"
import _ "gopkg.in/mattes/migrate.v1/driver/mysql"

// use synchronous versions of migration functions ...
allErrors, ok := migrate.UpSync("driver://url", "./path")
10 changes: 8 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
go: &go
image: golang
working_dir: /go/src/github.com/mattes/migrate
working_dir: /go/src/gopkg.in/mattes/migrate.v1
volumes:
- $GOPATH:/go
- $GOPATH/src/github.com/mattes/migrate:/go/src/gopkg.in/mattes/migrate.v1
go-test:
<<: *go
command: sh -c 'go get -t -v ./... && go test -v ./...'
links:
- mssql
- postgres
- mysql
- cassandra
@@ -30,3 +31,8 @@ crate:
image: crate
mongo:
image: mongo:3.2.6
mssql:
image: microsoft/mssql-server-linux
environment:
SA_PASSWORD: Passw0rd
ACCEPT_EULA: "Y"
2 changes: 1 addition & 1 deletion driver/bash/README.md
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@
migrate -url bash://xxx -path ./migrations create increment_xyz
migrate -url bash://xxx -path ./migrations up
migrate help # for more info
```
```
4 changes: 2 additions & 2 deletions driver/bash/bash.go
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
package bash

import (
"github.com/mattes/migrate/driver"
"github.com/mattes/migrate/file"
"gopkg.in/mattes/migrate.v1/driver"
"gopkg.in/mattes/migrate.v1/file"
)

type Driver struct {
6 changes: 3 additions & 3 deletions driver/cassandra/cassandra.go
Original file line number Diff line number Diff line change
@@ -9,9 +9,9 @@ import (
"time"

"github.com/gocql/gocql"
"github.com/mattes/migrate/driver"
"github.com/mattes/migrate/file"
"github.com/mattes/migrate/migrate/direction"
"gopkg.in/mattes/migrate.v1/driver"
"gopkg.in/mattes/migrate.v1/file"
"gopkg.in/mattes/migrate.v1/migrate/direction"
)

// Driver implements migrate Driver interface
6 changes: 3 additions & 3 deletions driver/cassandra/cassandra_test.go
Original file line number Diff line number Diff line change
@@ -7,9 +7,9 @@ import (
"time"

"github.com/gocql/gocql"
"github.com/mattes/migrate/file"
"github.com/mattes/migrate/migrate/direction"
pipep "github.com/mattes/migrate/pipe"
"gopkg.in/mattes/migrate.v1/file"
"gopkg.in/mattes/migrate.v1/migrate/direction"
pipep "gopkg.in/mattes/migrate.v1/pipe"
)

func TestMigrate(t *testing.T) {
2 changes: 1 addition & 1 deletion driver/crate/README.md
Original file line number Diff line number Diff line change
@@ -12,4 +12,4 @@ limitation of Crate. So handle situations with failed migrations with care!
migrate -url http://host:port -path ./db/migrations create add_field_to_table
migrate -url http://host:port -path ./db/migrations up
migrate help # for more info
```
```
6 changes: 3 additions & 3 deletions driver/crate/crate.go
Original file line number Diff line number Diff line change
@@ -7,9 +7,9 @@ import (
"strings"

_ "github.com/herenow/go-crate"
"github.com/mattes/migrate/driver"
"github.com/mattes/migrate/file"
"github.com/mattes/migrate/migrate/direction"
"gopkg.in/mattes/migrate.v1/driver"
"gopkg.in/mattes/migrate.v1/file"
"gopkg.in/mattes/migrate.v1/migrate/direction"
)

func init() {
6 changes: 3 additions & 3 deletions driver/crate/crate_test.go
Original file line number Diff line number Diff line change
@@ -5,9 +5,9 @@ import (
"os"
"testing"

"github.com/mattes/migrate/file"
"github.com/mattes/migrate/migrate/direction"
pipep "github.com/mattes/migrate/pipe"
"gopkg.in/mattes/migrate.v1/file"
"gopkg.in/mattes/migrate.v1/migrate/direction"
pipep "gopkg.in/mattes/migrate.v1/pipe"
)

func TestContentSplit(t *testing.T) {
2 changes: 1 addition & 1 deletion driver/driver.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (
"fmt"
neturl "net/url" // alias to allow `url string` func signature in New

"github.com/mattes/migrate/file"
"gopkg.in/mattes/migrate.v1/file"
)

// Driver is the interface type that needs to implemented by all drivers.
8 changes: 4 additions & 4 deletions driver/mongodb/README.md
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
## Usage in Go

```go
import "github.com/mattes/migrate/migrate"
import "gopkg.in/mattes/migrate.v1/migrate"

// Import your migration methods package so that they are registered and available for the MongoDB driver.
// There is no need to import the MongoDB driver explicitly, as it should already be imported by your migration methods package.
@@ -59,14 +59,14 @@ V001_some_migration_operation_down

## Methods registration

For a detailed example see: [sample_mongodb_migrator.go](https://github.com/mattes/migrate/blob/master/driver/mongodb/example/sample_mongdb_migrator.go)
For a detailed example see: [sample_mongodb_migrator.go](https://github.com/mattes/migrate/blob/v1/driver/mongodb/example/sample_mongdb_migrator.go)

```go
package my_mongo_db_migrator

import (
"github.com/mattes/migrate/driver/mongodb"
"github.com/mattes/migrate/driver/mongodb/gomethods"
"gopkg.in/mattes/migrate.v1/driver/mongodb"
"gopkg.in/mattes/migrate.v1/driver/mongodb/gomethods"
"gopkg.in/mgo.v2"
)

12 changes: 6 additions & 6 deletions driver/mongodb/example/mongodb_test.go
Original file line number Diff line number Diff line change
@@ -3,17 +3,17 @@ package example
import (
"testing"

"github.com/mattes/migrate/file"
"github.com/mattes/migrate/migrate/direction"
"gopkg.in/mattes/migrate.v1/file"
"gopkg.in/mattes/migrate.v1/migrate/direction"

"os"
"reflect"
"time"

"github.com/mattes/migrate/driver"
"github.com/mattes/migrate/driver/mongodb"
"github.com/mattes/migrate/driver/mongodb/gomethods"
pipep "github.com/mattes/migrate/pipe"
"gopkg.in/mattes/migrate.v1/driver"
"gopkg.in/mattes/migrate.v1/driver/mongodb"
"gopkg.in/mattes/migrate.v1/driver/mongodb/gomethods"
pipep "gopkg.in/mattes/migrate.v1/pipe"
)

type ExpectedMigrationResult struct {
6 changes: 3 additions & 3 deletions driver/mongodb/example/sample_mongdb_migrator.go
Original file line number Diff line number Diff line change
@@ -3,12 +3,12 @@ package example
import (
"time"

"github.com/mattes/migrate/driver/mongodb/gomethods"
_ "github.com/mattes/migrate/driver/mongodb/gomethods"
"gopkg.in/mattes/migrate.v1/driver/mongodb/gomethods"
_ "gopkg.in/mattes/migrate.v1/driver/mongodb/gomethods"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"

"github.com/mattes/migrate/driver/mongodb"
"gopkg.in/mattes/migrate.v1/driver/mongodb"
)

type SampleMongoDbMigrator struct {
4 changes: 2 additions & 2 deletions driver/mongodb/gomethods/gomethods_migrator.go
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@ import (
"path"
"strings"

"github.com/mattes/migrate/driver"
"github.com/mattes/migrate/file"
"gopkg.in/mattes/migrate.v1/driver"
"gopkg.in/mattes/migrate.v1/file"
)

type MethodNotFoundError string
6 changes: 3 additions & 3 deletions driver/mongodb/gomethods/gomethods_migrator_test.go
Original file line number Diff line number Diff line change
@@ -4,10 +4,10 @@ import (
"reflect"
"testing"

"github.com/mattes/migrate/file"
"github.com/mattes/migrate/migrate/direction"
"gopkg.in/mattes/migrate.v1/file"
"gopkg.in/mattes/migrate.v1/migrate/direction"

pipep "github.com/mattes/migrate/pipe"
pipep "gopkg.in/mattes/migrate.v1/pipe"
)

type FakeGoMethodsInvoker struct {
2 changes: 1 addition & 1 deletion driver/mongodb/gomethods/gomethods_registry.go
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import (
"fmt"
"sync"

"github.com/mattes/migrate/driver"
"gopkg.in/mattes/migrate.v1/driver"
)

var methodsReceiversMu sync.Mutex
8 changes: 4 additions & 4 deletions driver/mongodb/mongodb.go
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ import (
"reflect"
"strings"

"github.com/mattes/migrate/driver"
"github.com/mattes/migrate/driver/mongodb/gomethods"
"github.com/mattes/migrate/file"
"github.com/mattes/migrate/migrate/direction"
"gopkg.in/mattes/migrate.v1/driver"
"gopkg.in/mattes/migrate.v1/driver/mongodb/gomethods"
"gopkg.in/mattes/migrate.v1/file"
"gopkg.in/mattes/migrate.v1/migrate/direction"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
22 changes: 22 additions & 0 deletions driver/mssql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# MSSQL Driver

* Runs migrations in transactions.
That means that if a migration fails, it will be safely rolled back.
* Tries to return helpful error messages.
* Stores migration version details in table ``schema_migrations``.
This table will be auto-generated.


## Usage

```bash
migrate -url="sqlserver://sa:Passw0rd@localhost:1433?database=master" -path ./db/migrations create add_field_to_table
migrate -url="sqlserver://sa:Passw0rd@localhost:1433?database=master" -path ./db/migrations up
migrate help # for more info

# see more docs: https://github.com/denisenkom/go-mssqldb
```

## Authors

* Andras Laczi, https://github.com/alaczi
Loading