From c1f8effe1ac91ba9e847923bd80bb53b9dfa30b2 Mon Sep 17 00:00:00 2001 From: Bobby Rullo Date: Mon, 28 Dec 2015 15:57:21 -0800 Subject: [PATCH] db, functional: make value column in key not pkey go-oidc increased the size of the generated keys, which were too large to be used as primary keys in postgres. --- db/key.go | 1 - db/migrations/0009_key_not_primary_key.sql | 5 ++ db/migrations/assets.go | 75 ++++++++-------------- db/migrations/migrations.go | 2 +- functional/db_test.go | 4 +- 5 files changed, 35 insertions(+), 52 deletions(-) create mode 100644 db/migrations/0009_key_not_primary_key.sql diff --git a/db/key.go b/db/key.go index 126a5e81..18bdfdc4 100644 --- a/db/key.go +++ b/db/key.go @@ -27,7 +27,6 @@ func init() { name: keyTableName, model: privateKeySetBlob{}, autoinc: false, - pkey: []string{"value"}, }) } diff --git a/db/migrations/0009_key_not_primary_key.sql b/db/migrations/0009_key_not_primary_key.sql new file mode 100644 index 00000000..f93f51b6 --- /dev/null +++ b/db/migrations/0009_key_not_primary_key.sql @@ -0,0 +1,5 @@ +-- +migrate Up +ALTER TABLE key ADD COLUMN tmp_value bytea; +UPDATE KEY SET tmp_value = value; +ALTER TABLE key DROP COLUMN value; +ALTER TABLE key RENAME COLUMN "tmp_value" to "value"; diff --git a/db/migrations/assets.go b/db/migrations/assets.go index dc2dde42..7da1604b 100644 --- a/db/migrations/assets.go +++ b/db/migrations/assets.go @@ -1,15 +1,14 @@ // Code generated by go-bindata. // sources: -// db/migrations/0001_initial_migration.sql -// db/migrations/0002_dex_admin.sql -// db/migrations/0003_user_created_at.sql -// db/migrations/0004_session_nonce.sql -// db/migrations/0005_refresh_token_create.sql -// db/migrations/0006_user_email_unique.sql -// db/migrations/0007_session_scope.sql -// db/migrations/0008_users_active_or_inactive.sql -// db/migrations/assets.go -// db/migrations/migrations.go +// 0001_initial_migration.sql +// 0002_dex_admin.sql +// 0003_user_created_at.sql +// 0004_session_nonce.sql +// 0005_refresh_token_create.sql +// 0006_user_email_unique.sql +// 0007_session_scope.sql +// 0008_users_active_or_inactive.sql +// 0009_key_not_primary_key.sql // DO NOT EDIT! package migrations @@ -92,7 +91,7 @@ func dbMigrations0001_initial_migrationSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "db/migrations/0001_initial_migration.sql", size: 1388, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0001_initial_migration.sql", size: 1388, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -112,7 +111,7 @@ func dbMigrations0002_dex_adminSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "db/migrations/0002_dex_admin.sql", size: 126, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0002_dex_admin.sql", size: 126, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -132,7 +131,7 @@ func dbMigrations0003_user_created_atSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "db/migrations/0003_user_created_at.sql", size: 111, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0003_user_created_at.sql", size: 111, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -152,7 +151,7 @@ func dbMigrations0004_session_nonceSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "db/migrations/0004_session_nonce.sql", size: 60, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0004_session_nonce.sql", size: 60, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -172,7 +171,7 @@ func dbMigrations0005_refresh_token_createSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "db/migrations/0005_refresh_token_create.sql", size: 506, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0005_refresh_token_create.sql", size: 506, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -192,7 +191,7 @@ func dbMigrations0006_user_email_uniqueSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "db/migrations/0006_user_email_unique.sql", size: 99, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0006_user_email_unique.sql", size: 99, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -212,7 +211,7 @@ func dbMigrations0007_session_scopeSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "db/migrations/0007_session_scope.sql", size: 60, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0007_session_scope.sql", size: 60, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -232,47 +231,27 @@ func dbMigrations0008_users_active_or_inactiveSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "db/migrations/0008_users_active_or_inactive.sql", size: 110, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0008_users_active_or_inactive.sql", size: 110, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _dbMigrationsAssetsGo = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd4\x99\x6d\x6f\xdb\x46\x12\xc7\x5f\x5b\x9f\x82\x35\xd0\x42\x3e\xf8\x6c\x92\xe2\x93\x0c\xf4\x4d\xdb\x1c\x90\x17\x4d\x81\x6b\xee\xd5\xf9\x20\x2c\xc9\xa5\x4b\xd4\x16\x1d\x51\xce\x39\x09\xf2\xdd\x6f\x7e\x3b\x23\xc5\x8e\x25\xe7\xe9\x82\xa0\x05\x58\x8b\xcb\xd9\x79\x9e\xd9\xd9\x7f\x4e\x4f\xa3\x9f\x87\xd6\x47\x17\x7e\xe9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xe9\xae\x7c\xa4\xdb\x8e\xa2\xe9\x66\xd5\xaf\x56\xc3\xea\x28\x7a\x33\x39\xb8\x78\x1d\xde\xa2\xb3\x1f\x23\xb4\x3a\x79\xe6\xff\x0b\x13\xbf\x9a\x06\xb5\x79\xff\xe9\xa6\xeb\xe4\x1d\xb6\x47\x47\x93\x83\xbe\x0b\x1b\xbe\xfb\x31\x5a\xf6\x97\xb0\x38\x58\xf9\xf5\xcd\x6a\xc9\xeb\x71\x24\x26\x9d\x3c\x81\x7b\x37\x3d\x84\x51\xf4\xfd\x8b\xb3\xe8\xfb\x97\x87\xaa\x49\x90\x25\x3c\xde\x4e\x26\x07\x2f\xdd\x2a\xaa\x6f\xba\x48\xe5\xa8\x90\xc9\xc1\x42\xd5\xf9\x31\xea\x87\x93\x9f\x87\xeb\x57\xd3\x1f\x84\xe6\x58\x74\x93\x5d\xcd\xe5\x93\x8d\xa6\x27\x3f\x5f\x0e\xa3\x9f\x8a\xf9\xff\x27\x7d\x60\xa3\xfc\xf7\x30\x12\x42\xd5\xdb\x16\x45\xad\x93\x9f\x50\x7d\x7a\x74\x0c\xc5\x44\xbe\xad\x5f\x5d\xfb\x28\xe4\x11\x2e\xbf\x69\xd6\x70\x09\xf6\x59\x3c\x44\xcc\xb2\x1b\xa2\x68\x18\x4f\xfe\x21\x61\x7d\x2a\x2f\xdb\x7d\x16\xc2\xcd\xfa\x1d\x0e\x21\x86\xf2\x9f\x86\x71\x72\x30\xf6\xaf\xc3\x7b\xbf\x5c\x17\xd9\xe4\xe0\x8a\x5e\x12\x6d\x99\xfe\x2a\xaf\x61\xf1\xb9\x64\x48\x44\x9a\x9c\xf0\x0b\x39\x21\x55\xa6\x5d\xff\xbe\xac\xa3\xe8\x99\x88\x98\x1e\x99\x04\x64\x9a\x95\x5d\x7f\x82\x74\xd9\xbc\x7f\xef\xef\xa2\x8e\xec\x0d\xda\xdc\xdf\x8a\xa2\x8f\x6e\x45\x57\xd9\x7a\x47\xf3\xfb\x0c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33\x74\x94\xf7\x46\x74\xc8\xe5\xf7\xac\x51\xba\x46\xf8\x74\xb1\xda\x3f\x97\xfd\xad\x53\xff\x63\x3b\x7e\x44\x07\x6c\x76\xb9\xea\xee\x66\xea\x57\xf6\xe0\x97\xb8\x31\xdf\x98\x5f\xd0\xa9\xdc\xc4\xab\x53\x3d\x62\x6c\x4f\x55\x76\x23\xba\x37\x73\x5d\x2f\x8d\x3e\x8b\xd5\x67\x4d\x6a\xfa\xc8\x77\xdf\x6a\xbe\xe0\xbb\x3a\x56\x1b\xe3\x5a\xf3\xc6\xa5\x1a\x3b\x62\x8e\x6d\xac\xc7\x85\xe6\x46\x93\x68\x9e\xa0\x17\x36\x25\xf2\xb7\x26\xe6\x33\x8d\x4f\xc8\x0d\xf6\x8a\xdc\x1c\xbf\x39\xe5\x53\x0b\xcf\x54\x64\xcf\xd1\x9f\xbc\x9d\x5b\x7e\xd6\x2a\x83\x3c\x26\xfe\xb1\x7c\xf7\x99\xc6\xaa\x26\x07\x73\xb5\xbf\x9b\xe9\x7b\x96\xa8\x2e\xd0\xa1\x43\x4c\xcc\xf9\x56\x2a\xff\xe0\x7f\x8b\x67\x22\x34\xb5\xfc\x4d\x63\xcd\x8d\xba\x53\x7a\x74\x2b\x85\xde\x8b\x3c\x1f\xab\xff\xf1\x67\xd3\xe8\x1a\x35\x32\x6b\x35\x26\xd4\x12\xf9\x80\x4e\xc8\xc6\x87\x55\x63\xfa\xc8\x7a\x95\x6a\x1d\x12\x2f\xf4\x87\x1e\xfe\xf8\x16\x1d\x82\xef\x3b\xad\x97\x4e\xe8\xca\x99\xf2\xc9\xe6\xea\x93\xd8\xfc\x45\x1c\xd0\x29\x97\xef\x69\xaa\xbe\x43\x2f\xe8\x91\x91\x09\xbf\xa4\x56\xbe\xe4\x1d\xb9\x4a\x8d\xa4\xf4\x81\x58\xbf\xe3\x47\x37\xd7\x9a\xc2\xee\xbc\xd1\xda\x21\xe6\x49\xa5\x79\x41\xcc\x4a\xbe\x39\xb5\xb7\x98\xab\x7e\x8e\x7c\x94\xb5\x7c\x13\xfb\x99\xf2\x22\x67\x1b\xe1\x9f\x96\xea\x73\xf2\x93\xde\x43\x3d\x3a\xf2\x92\x5e\xd1\x6a\x7d\x40\x83\x2f\x88\x0f\x79\x91\x7b\xd5\x21\x6b\x35\xcf\xe9\x11\x69\xae\xfa\x92\x97\xc1\xfe\xb9\xca\xc5\x07\xe4\x25\x75\x43\xbf\x21\x9f\xa0\x0f\x72\x0a\x8d\x09\xba\x84\x3e\x28\x6b\xbe\xd1\xdc\x29\x63\xe5\x4f\x3f\xc3\xe6\xb6\x55\x9d\xf8\x8d\xcf\xb3\x52\xfd\xe6\x91\x2b\x7c\x0b\x91\xd5\x39\xed\x41\x39\xb9\x06\x5d\xaa\x39\x46\xec\x88\x39\x3c\x58\x4b\xe1\x3b\xd7\x7a\xa0\x1f\x12\x6f\xea\xb6\xb2\x7e\x0a\x7f\x62\xe0\xa0\x2b\xd4\xee\xba\x51\x3f\xe0\x63\xf2\x15\x19\xc4\x90\xbe\x8c\xbd\xe4\x49\x87\x7f\x1b\xed\x93\xf4\x30\x3f\xd3\xfc\x2f\xe9\x59\x9d\xda\x94\x93\xff\xc4\x4a\xd6\xeb\x4a\xe3\x4b\x5f\x08\x67\x41\xa9\xbd\xbc\x76\x1a\x73\xf2\x8a\x3c\xda\x9c\x0d\xf4\x3e\x1e\xe7\xb5\xcf\x51\x43\xf4\x72\xfa\x51\x9c\x6f\xe8\x0e\x37\xe3\xe2\x47\x1d\x48\x36\xdd\xec\x9a\x1a\x37\x33\xd0\x9d\xa9\x53\xc6\xa5\x8f\x3b\xe7\x8e\x85\xf2\xf0\x63\xaf\x34\x87\x42\x7d\xb4\x1d\x5d\x3e\x8a\x3f\x1a\xff\x2d\x0c\x61\x77\x35\x0e\x53\xd8\x76\xd4\xfd\x14\xfb\x3f\x34\x61\x6e\x07\xc3\x30\xda\x09\xf3\xf7\xc6\x84\x37\x0c\x50\x67\xd1\x27\x98\x1c\x31\x37\x9d\x45\xc9\xac\xaa\x8e\x23\x46\xa0\xb3\xbb\x13\xd2\x34\x9b\x15\x47\x61\x9d\xc1\xe6\x4c\x07\x9f\x7f\x2d\xfb\xdb\x69\x72\x1c\xc5\x47\x32\xca\x3a\xb4\xf8\x21\xb8\xe0\x4d\xb0\xfb\x2c\x32\xf3\x51\xf1\x2c\xfc\xff\xed\x36\x88\xee\xf8\xb1\x59\xe5\xce\xf5\xf1\x73\x67\x14\xce\xa9\x70\x36\xe4\x7a\x2e\x84\x39\xa0\xd5\xfc\x4e\xed\x2c\x4d\x1b\xed\x8f\xd0\xc0\x8f\x3a\xa4\x4f\x97\xd4\x4f\xa6\x7c\xa9\xc7\xb8\xd5\x7e\x05\x0d\xef\x65\xa6\x67\x74\x69\x75\x97\x55\xc6\x7f\xae\xfc\x91\x93\xd6\x7a\xf6\x50\xeb\xac\x71\x76\xd2\x57\xa8\x73\x7a\x13\xe7\x13\xe7\x73\x25\xfb\x52\x7b\xc2\x79\xed\xb5\xce\x98\x2d\xc2\x4c\xe4\xf5\x1c\x8b\xad\x06\xe9\xc3\xf4\x4b\xce\x1c\x66\x11\x64\xb0\x46\x0d\xc3\x9b\xfe\x95\xd9\xd9\x8f\x6d\x9d\x3d\x33\xdb\x57\x19\x0d\x3d\x9f\x9e\x99\x37\xef\xce\x76\x74\x08\xfa\x24\x5a\xd3\x1b\x99\x45\xa5\x3d\x04\x9d\x99\x57\x38\x27\x72\x9b\xc1\xe8\x9d\x61\x6e\xc3\x7f\x4e\x7b\x35\xf6\xd1\xaf\xa0\xe5\x2c\xe7\x0c\xa0\x37\x21\x23\x4e\x1f\xf6\x0f\x74\xaa\xed\xdc\x0d\x7d\xde\xdf\x89\xed\xde\xfe\x71\x3f\x49\xbe\xb8\x6f\xdc\x67\xb7\xbb\x5f\xbc\x07\x6b\x3c\xda\x27\xee\xf3\xfb\x8c\xfe\xb0\xd3\xbe\xaf\xd6\x17\x1e\x98\xb6\xe9\x07\x69\xf1\xcd\xdb\xc1\x03\xa4\xe8\xaf\xd2\x14\xe0\x95\xda\xa0\xcc\x7b\x28\xd6\x4e\xd7\xb8\xa4\xa4\xc6\x83\x83\x98\xfd\x61\x6f\xa2\xef\x5c\x10\x38\xc0\x91\xd7\xe5\xfa\xe4\x56\x70\x41\x4f\x6f\x85\x9e\x6b\xe1\x65\x36\xec\x72\xf1\x40\x2e\x7c\xe0\x1d\x9a\x93\xb3\xc6\x64\xc3\x67\x6a\x43\x83\xb7\x8b\x09\x85\x8e\x3d\x41\x0f\xbb\x0c\x30\x3c\xb6\xf2\x24\xa9\x0e\x41\x34\x00\x0a\xdf\x39\x6b\x1e\x85\x0e\xe9\x0c\x6d\x73\x1b\xde\x93\xf8\x61\x71\xa7\xd6\x1c\xbd\x5d\x64\xb8\x7c\x7c\xb8\xb8\x77\x85\xfc\x8b\x4b\x7c\x17\xd3\xdd\x85\xbe\x13\x9b\x7c\xb4\xdc\x77\xf1\xfe\x8c\xa2\x7f\xc4\xee\xaf\x56\xfa\x7b\x8c\xdd\x34\x80\x24\xf9\xe6\x0d\xe0\x3d\x00\xf8\xaf\x50\xfe\xa4\xfd\xa6\xc4\x29\xd5\x20\xcb\x4a\x90\x32\xfe\xd4\x92\xa7\x84\x9b\xda\xe6\x89\x5a\x79\x23\x07\x1d\x82\xac\xb9\xde\x0f\xf8\xbd\x29\xed\x70\xd6\x66\x0f\x4b\x92\xfb\x1f\x18\x02\x77\x25\xfc\xc6\x5d\xe8\xc3\x25\xf9\x30\x08\x5f\x5c\x90\x0f\x59\xee\x2e\xc7\x1d\xff\x00\xf0\x68\x31\x3e\xe4\xfb\x19\xa5\xb8\xd7\xde\xaf\x56\x88\x3b\xcd\xb4\x32\x2c\xe2\x6f\x5e\x85\xbb\xff\x79\xe5\x73\x8b\x91\x8b\xf0\x3c\xd6\xe4\xe7\xcc\x02\xf0\xd8\x82\x88\x5c\x5c\x3b\x2d\x06\x86\x5b\x80\x3f\x0a\x8e\xfd\x45\xaa\xb4\x9c\x61\x0c\xc9\x0c\xa5\x80\x4c\xb1\x01\x21\x0c\x90\x61\xe8\xb4\x21\x9c\xa2\x0c\x17\x7d\x03\xb7\x9c\x01\x8e\x0c\xba\x0c\xcd\xac\x71\x31\x66\xd0\xe6\xe2\xcd\x25\x16\x50\x20\x36\x50\x8d\xe1\x37\xe8\xe2\xf4\xb2\xdf\xd5\xfa\x9e\x5a\x21\xb1\x97\x0b\x3a\x83\x34\xfb\x39\x0b\x01\x0a\x00\x30\x00\x51\xb8\xac\x03\x14\x71\x71\x4e\x0d\x28\x00\x78\x09\x67\x65\xa6\x43\x7b\x6e\xc0\x64\x00\xc9\x00\x71\x32\x05\xf0\x0a\x03\x72\x6a\xf3\x87\x37\x50\x15\x30\x35\x36\x70\xa6\x28\x75\x0d\x50\x08\x5e\x55\x6b\x17\x84\x46\x01\xb7\xdc\x1a\x00\xc0\x00\x60\x17\x60\x09\x7a\x03\x20\x60\x3b\x20\x6c\xf0\x43\xa9\xa0\x63\x6d\x8d\x05\xf0\x8f\x33\xdd\xd5\x7a\xde\x03\xe0\xd0\x3c\x01\xa4\xd8\xcf\x3a\xc0\x29\x00\x03\x40\x01\xb6\x06\xe0\x29\x53\x50\x0b\x9b\xe7\x06\x38\xc1\x9b\x18\x36\x95\xce\x10\xcc\x15\x85\xcd\x1b\xc4\x06\xf0\x08\x5b\x02\x90\x8a\x2f\x88\x41\xa9\xb1\xc6\xee\xe0\xa3\x5a\x81\xdf\xa0\x8b\x7c\x9f\x19\xc0\x05\x68\x01\x50\x82\xee\xa9\x01\xba\xe4\x11\xbe\x02\x14\xa3\xe9\x02\x50\x02\x9c\x42\x0f\x68\x05\x30\x54\x1b\xd0\x89\x7e\xec\x43\x66\x6a\xba\x64\x96\x9f\x01\x70\x6d\x54\x2e\x33\x5c\x67\xa0\x37\x60\x2c\xb4\xcc\x33\xf8\x99\x7c\x62\x8e\xaa\x0d\x44\x24\x1e\x00\x79\x00\x2d\xe8\x9d\xda\xc5\x06\xbd\x00\xf5\x00\x96\x1a\xe3\xe5\x0c\x94\x0a\xc0\x58\xa5\x00\x12\x39\xc6\x3e\x40\xa2\xca\x00\x2e\x0e\x1f\xec\x01\xe4\x66\x7f\x00\xf0\x9c\xe6\x2a\xb1\xc2\x0f\xec\xa9\xac\xf1\x93\x63\x01\x24\x9a\xe9\xc5\x13\x9d\x5c\x65\xa0\xb7\xd3\x3a\x45\x76\x62\xfa\x70\xe9\x22\x47\x62\x03\xc2\x00\xe6\xf0\x4d\x00\xd8\x0d\x38\x06\x58\x42\x16\xba\x38\x03\xf3\x5a\xbb\xe8\x66\x99\xc6\x8e\xb8\x05\x00\xb5\xd1\xf8\x32\x3f\x6e\xec\x09\xf5\xd0\xe9\x41\x15\x72\xd0\xa9\xdf\xa9\x0d\x00\x38\x00\x2d\xfc\x47\x6d\x05\xdf\x7a\xcd\x21\xfc\x46\x4d\x40\x0b\x80\xda\x19\xe8\xfa\xfe\xc1\x46\xbd\x12\xef\x60\x67\xab\x35\x1b\x2e\x9d\x8f\x1e\x6c\x7b\xfb\xda\x17\x9f\x6f\x7b\x39\xef\x3e\xe6\xf6\xff\xfb\xf5\xa3\xa7\xdd\x5e\x29\xf7\x0e\xbd\xff\x05\x00\x00\xff\xff\x1a\xff\x1f\xe3\x00\x20\x00\x00") +var _dbMigrations0009_key_not_primary_keySql = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd5\x55\xd0\xce\xcd\x4c\x2f\x4a\x2c\x49\x55\x08\x2d\xe0\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\xc8\x4e\xad\x54\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\x28\xc9\x2d\x88\x2f\x4b\xcc\x29\x4d\x55\x48\xaa\x2c\x49\x4d\xb4\xe6\x0a\x0d\x70\x71\x0c\x71\x55\xf0\x76\x8d\x54\x08\x76\x0d\x41\x92\xb7\x55\x00\xd3\xd6\x18\xa6\xb9\x04\xf9\x07\xc0\x8c\xc3\xa1\x24\xc8\xd5\xcf\xd1\xd7\x15\xa6\x48\x09\x6e\xa8\x92\x42\x49\xbe\x82\x12\x84\x69\xcd\x05\x08\x00\x00\xff\xff\x58\x6f\x17\x19\xb6\x00\x00\x00") -func dbMigrationsAssetsGoBytes() ([]byte, error) { +func dbMigrations0009_key_not_primary_keySqlBytes() ([]byte, error) { return bindataRead( - _dbMigrationsAssetsGo, - "db/migrations/assets.go", + _dbMigrations0009_key_not_primary_keySql, + "db/migrations/0009_key_not_primary_key.sql", ) } -func dbMigrationsAssetsGo() (*asset, error) { - bytes, err := dbMigrationsAssetsGoBytes() +func dbMigrations0009_key_not_primary_keySql() (*asset, error) { + bytes, err := dbMigrations0009_key_not_primary_keySqlBytes() if err != nil { return nil, err } - info := bindataFileInfo{name: "db/migrations/assets.go", size: 20480, mode: os.FileMode(436), modTime: time.Unix(1, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _dbMigrationsMigrationsGo = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x64\xce\x41\xae\x83\x30\x0c\x84\xe1\x3d\xa7\x98\x0b\xc4\xd1\xdb\x3e\xa9\xb7\xe8\x01\x30\xc4\x75\x53\x9a\x18\x11\x47\x5c\xbf\x74\x05\x52\xf7\xa3\x6f\xfe\x95\xe7\x85\x55\x50\xb2\x6e\xec\xd9\x6a\x1b\x86\x18\x71\x37\x24\xdb\xeb\xdb\x38\x41\x2d\x4c\xb9\x26\x76\xc6\xd6\x2b\x46\x35\xa8\x38\x42\x87\x66\x7f\xf6\x89\x66\x2b\xf1\xe5\x22\x7d\x97\x1a\xcf\x75\x24\xa2\xf1\xab\xa9\xfd\xab\x54\x39\x7c\xb9\x62\xa1\x58\xf2\x5c\xe4\xf6\x87\xb0\x2e\x7a\x49\x40\x30\x70\x6b\xe2\x8d\x8e\x33\xa2\xf8\x83\x3c\xca\x11\xb0\x9f\xa3\xe1\x13\x00\x00\xff\xff\x2a\x0f\xf5\xbf\xc8\x00\x00\x00") - -func dbMigrationsMigrationsGoBytes() ([]byte, error) { - return bindataRead( - _dbMigrationsMigrationsGo, - "db/migrations/migrations.go", - ) -} - -func dbMigrationsMigrationsGo() (*asset, error) { - bytes, err := dbMigrationsMigrationsGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "db/migrations/migrations.go", size: 200, mode: os.FileMode(436), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "db/migrations/0009_key_not_primary_key.sql", size: 182, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -337,8 +316,7 @@ var _bindata = map[string]func() (*asset, error){ "db/migrations/0006_user_email_unique.sql": dbMigrations0006_user_email_uniqueSql, "db/migrations/0007_session_scope.sql": dbMigrations0007_session_scopeSql, "db/migrations/0008_users_active_or_inactive.sql": dbMigrations0008_users_active_or_inactiveSql, - "db/migrations/assets.go": dbMigrationsAssetsGo, - "db/migrations/migrations.go": dbMigrationsMigrationsGo, + "db/migrations/0009_key_not_primary_key.sql": dbMigrations0009_key_not_primary_keySql, } // AssetDir returns the file names below a certain @@ -392,8 +370,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "0006_user_email_unique.sql": &bintree{dbMigrations0006_user_email_uniqueSql, map[string]*bintree{}}, "0007_session_scope.sql": &bintree{dbMigrations0007_session_scopeSql, map[string]*bintree{}}, "0008_users_active_or_inactive.sql": &bintree{dbMigrations0008_users_active_or_inactiveSql, map[string]*bintree{}}, - "assets.go": &bintree{dbMigrationsAssetsGo, map[string]*bintree{}}, - "migrations.go": &bintree{dbMigrationsMigrationsGo, map[string]*bintree{}}, + "0009_key_not_primary_key.sql": &bintree{dbMigrations0009_key_not_primary_keySql, map[string]*bintree{}}, }}, }}, }} diff --git a/db/migrations/migrations.go b/db/migrations/migrations.go index b9a50e71..83931c8a 100644 --- a/db/migrations/migrations.go +++ b/db/migrations/migrations.go @@ -2,5 +2,5 @@ package migrations // To download go-bindata run `go get -u github.com/jteeuwen/go-bindata/...` -//go:generate go-bindata -modtime=1 -pkg migrations -o assets.go ../ +//go:generate go-bindata -modtime=1 -pkg migrations -o assets.go -ignore \.go$ -prefix "../.." ../../db/migrations //go:generate gofmt -w assets.go diff --git a/functional/db_test.go b/functional/db_test.go index 5c125146..59d950fa 100644 --- a/functional/db_test.go +++ b/functional/db_test.go @@ -45,7 +45,9 @@ func connect(t *testing.T) *gorp.DbMap { panic(fmt.Sprintf("Unable to drop migration table: %v", err)) } - db.MigrateToLatest(c) + if _, err = db.MigrateToLatest(c); err != nil { + panic(fmt.Sprintf("Unable to migrate: %v", err)) + } return c }