329 Commits

Author SHA1 Message Date
Nicholas Duffy
fa8806ecfd Add support for optional migrations.
See the discussion in https://github.com/pressly/goose/issues/7.
Credit goes to @dkotson for his gist here: https://github.com/pressly/goose/issues/7#issuecomment-241613482

I've just added that patch to this repository and change the transaction comment to `-- +goose NO TRANSACTIONS`.

- Checks the migration file for `-- +goose NO TRANSACTIONS`
- Based upon that line, either runs the up/down SQL with or without transactions
- Add test to check for transactions
- Update README

Closes #7.
2017-05-06 09:41:44 -06:00
Nicholas Duffy
3c5ec4e555 Update README
- Add list of drivers
- Update command list to reference `up-to` and `down-to`
- Add `up-to` and `down-to` examples
- Update usage output

Closes #37.
2017-05-06 08:43:15 -06:00
Nicholas Duffy
0d5a6db9db Update CollectMigrations for subdirectories
I like to group my migrations by logical subdirectories.

```
[nicholasduffy@duffn:~/go/src/github.com/pressly/goose/migrations on sql-subdirectories]
% tree                                                                                                                                              ✭
.
├── group1
│   └── 20170506073854_table1_create_table.sql
└── group2
    └── 20170506073920_table2_create_table.sql

2 directories, 2 files
```

It's easy to run migrations by groups if necessary. However, I'd like the
ability to run all migrations in all subdirectories at the same time. This
PR adds discovery of all SQL files in subdirectories within the `-dir`
directory.
2017-05-06 08:04:19 -06:00
Vojtech Vitek
cdb30a7da1 Merge pull request #36 from bharani91/master
Redo migration bugfix
2017-05-04 11:45:38 -04:00
Bharani
eea165e5d3 Redo migration bugfix 2017-05-04 20:36:11 +05:30
Vojtech Vitek
d5d23928d9 Merge pull request #33 from duffn/redshift-driver
Add Redshift driver support
2017-05-03 20:59:12 -04:00
Nicholas Duffy
1d402b32ff Add Redshift driver support
Redshift can be accessed and `up`/`down` SQL executed with the `pq`
library by default, however, the `createVersionTableSql` of the `PostgresDialect`
is not compatible with Redshift due to the `serial` datatype and `now()` default on.

This PR creates a new Redshift dialect. The dialect still uses the `pq` library and
only updates the SQL in `createVersionTableSql` to be compatible with Redshift.

Closes #32.
2017-05-03 17:41:20 -06:00
Vojtech Vitek
1da0b166cb Merge pull request #30 from itsjamie/go-template-lint-errs
Golint fixes
2017-04-13 10:23:49 -04:00
Jamie Stackhouse
261b46c60f Update migration.go
golint pass on go migrations
2017-04-12 11:58:26 -03:00
Vojtech Vitek
2784f38ca2 Merge pull request #29 from mmatczuk/mmt/ensure_db_version_panic
Avoid panic in EnsureDBVersion
2017-04-10 14:43:13 -04:00
mmatczuk
a66174eb9e Avoid panic in EnsureDBVersion 2017-04-05 12:32:40 +02:00
Vojtech Vitek
99e29546ba Merge pull request #22 from mmatczuk/mmt/export_collect_migrations
Rename collectMigrations to CollectMigrations
2017-03-27 11:21:09 -04:00
Vojtech Vitek
729045fdd1 Merge pull request #23 from przemyslaw-dobrowolski-cl/add_custom_filenames
Add support for adding migrations with custom filenames
2017-03-27 11:19:56 -04:00
Przemyslaw Dobrowolski
9fc6f5207a Add support for adding migrations with custom filenames 2017-03-27 16:12:33 +02:00
mmatczuk
1e8921d41c rename collectMigrations to CollectMigrations 2017-03-27 10:19:04 +02:00
Vojtech Vitek
221ff41793 Merge pull request #21 from mmatczuk/mmt/readme_mysql
MySQL status note
2017-03-24 10:23:49 -04:00
mmatczuk
1d358f1467 MySQL status note 2017-03-24 13:11:15 +01:00
Vojtech Vitek
90a6d29bb6 Merge pull request #20 from p-kozlowski/migrate-to-version
Support for migrating up/down to a specific version
2017-03-21 12:17:36 -04:00
Piotr Kozłowski
da36030846 Support for migrating up/down to a specific version 2017-03-17 14:44:22 +01:00
Vojtech Vitek
e591daea14 Fix example 2017-03-13 12:08:01 -04:00
Vojtech Vitek
1a4b9210ea Update Goals of this fork 2017-03-13 12:04:18 -04:00
Vojtech Vitek
f9980cee25 Fix int overflow on go 1.8-beta1 v1.0 2016-12-09 13:06:30 -05:00
Vojtech Vitek
0498aed91f Add `make dist' 2016-12-09 13:02:14 -05:00
Vojtech Vitek (V-Teq)
d6e8fe0292 Revert "Fix README example to have DB string"
This reverts commit c63bd171be103d606a2f8125710c1d4fb6e83086.

Ref. #12
v0.9
2016-11-06 13:45:28 -05:00
Vojtech Vitek
5c7c3b5b6f Merge pull request #13 from prestonp/12-refactor-create
Handle migration creation without db params
2016-11-06 13:43:49 -05:00
Preston Pham
8dcbd69b12 Handle migration creation without db params 2016-11-05 14:10:59 -05:00
Vojtech Vitek
5458c8f49f Merge pull request #10 from trevrosen/readme-fix
Fix README example to have DB string
2016-10-21 14:55:14 -04:00
Vojtech Vitek
1efa079859 Merge pull request #11 from jfyne/fix-error-on-up
ErrNoNextVersion returned on last migration
2016-10-07 16:18:20 -04:00
Josh Fyne
8a6c2299f0 Fixes the tests 2016-10-07 16:12:18 -04:00
Josh Fyne
42766096ee Fixes error on successful up 2016-10-07 15:52:55 -04:00
Trevor Rosen
c63bd171be Fix README example to have DB string 2016-10-05 14:39:07 -05:00
Vojtech Vitek
cb330a2e11 Merge pull request #9 from pressly/refactor
Refactor
2016-10-03 19:41:15 -04:00
Vojtech Vitek (V-Teq)
6804955eb2 Fix err 2016-10-03 19:36:16 -04:00
Vojtech Vitek (V-Teq)
9bf132172d Fix build 2016-10-03 19:34:37 -04:00
Vojtech Vitek (V-Teq)
643386c3a6 Refactor 2016-10-03 19:31:27 -04:00
Vojtech Vitek
aad3e6a24e Merge pull request #8 from pressly/fix_go_up
Fix go migration up
2016-09-29 19:41:40 -04:00
Vojtech Vitek (V-Teq)
f49670b2b4 Fix go migration up 2016-09-29 19:30:23 -04:00
Vojtech Vitek (V-Teq)
96680a8221 Better version duplicate check 2016-08-15 15:29:29 -04:00
Vojtech Vitek (V-Teq)
6a2ef004b5 More verbose panic on duplicate migrations 2016-08-15 14:22:11 -04:00
Vojtech Vitek (V-Teq)
52af0e6a35 Panic on duplicate migration version 2016-08-15 14:11:46 -04:00
Vojtech Vitek
caf14b8e35 Merge pull request #6 from jfyne/patch-1
Fixes install instructions
2016-06-30 10:41:15 -04:00
Josh Fyne
3a4a94cc90 Fixes install instructions 2016-06-30 10:33:02 -04:00
Vojtech Vitek
4dec8a31fd Merge pull request #5 from jfyne/create
Create command
2016-06-29 21:12:33 -04:00
Josh Fyne
15b7bf5fc7 Actually works now, re-added go migration template, updated cmd parser 2016-06-29 17:56:28 -04:00
Josh Fyne
e4c7697123 Re-ordered create arguments, checked for missing create arguments 2016-06-29 15:40:13 -04:00
Josh Fyne
db38a98723 dir string before extra args 2016-06-29 14:54:13 -04:00
Josh Fyne
ba86be6db6 Readme fix 2016-06-29 14:29:16 -04:00
Josh Fyne
7b43a0193d Adding create command back in 2016-06-29 14:20:34 -04:00
Josh Fyne
3523b17cdc Remove misleading create documentation 2016-06-29 12:30:47 -04:00
Vojtech Vitek (V-Teq)
602cd2b9c7 Fix up-by-one and down cmd return err 2016-06-20 15:56:01 -04:00