Files
fn-serverless/glide.lock
Reed Allman 61b416a9b5 automagic sql db migrations (#461)
* adds migrations

closes #57

migrations only run if the database is not brand new. brand new
databases will contain all the right fields when CREATE TABLE is called,
this is for readability mostly more than efficiency (do not want to have
to go through all of the database migrations to ascertain what columns a table
has). upon startup of a new database, the migrations will be analyzed and the
highest version set, so that future migrations will be run. this should also
avoid running through all the migrations, which could bork db's easily enough
(if the user just exits from impatience, say).

otherwise, all migrations that a db has not yet seen will be run against it
upon startup, this should be seamless to the user whether they had a db that
had 0 migrations run on it before or N. this means users will not have to
explicitly run any migrations on their dbs nor see any errors when we upgrade
the db (so long as things go well). if migrations do not go so well, users
will have to manually repair dbs (this is the intention of the `migrate`
library and it seems sane), this should be rare, and I'm unsure myself how
best to resolve not having gone through this myself, I would assume it will
require running down migrations and then manually updating the migration
field; in any case, docs once one of us has to go through this.

migrations are written to files and checked into version control, and then use
go-bindata to generate those files into go code and compiled in to be consumed
by the migrate library (so that we don't have to put migration files on any
servers) -- this is also in vcs. this seems to work ok. I don't like having to
use the separate go-bindata tool but it wasn't really hard to install and then
go generate takes care of the args. adding migrations should be relatively
rare anyway, but tried to make it pretty painless.

1 migration to add created_at to the route is done here as an example of how
to do migrations, as well as testing these things ;) -- `created_at` will be
`0001-01-01T00:00:00.000Z` for any existing routes after a user runs this
version. could spend the extra time adding 'today's date to any outstanding
records, but that's not really accurate, the main thing is nobody will have to
nuke their db with the migrations in place & we don't have any prod clusters
really to worry about. all future routes will correctly have `created_at` set,
and plan to add other timestamps but wanted to keep this patch as small as
possible so only did routes.created_at.

there are tests that a spankin new db will work as expected as well as a db
after running all down & up migrations works. the latter tests only run on mysql
and postgres, since sqlite3 does not like ALTER TABLE DROP COLUMN; up
migrations will need to be tested manually for sqlite3 only, but in theory if
they are simple and work on postgres and mysql, there is a good likelihood of
success; the new migration from this patch works on sqlite3 fine.

for now, we need to use `github.com/rdallman/migrate` to move forward, as
getting integrated into upstream is proving difficult due to
`github.com/go-sql-driver/mysql` being broken on master (yay dependencies).
Fortunately for us, we vendor a version of the `mysql` bindings that actually
works, thus, we are capable of using the `mattes/migrate` library with success
due to that. this also will require go1.9 to use the new `database/sql.Conn`
type, CI has been updated accordingly.

some doc fixes too from testing.. and of course updated all deps.

anyway, whew. this should let us add fields to the db without busting
everybody's dbs. open to feedback on better ways, but this was overall pretty
simple despite futzing with mysql.

* add migrate pkg to deps, update deps

use rdallman/migrate until we resolve in mattes land

* add README in migrations package

* add ref to mattes lib
2017-11-14 12:54:33 -08:00

480 lines
14 KiB
YAML

hash: bcface74504c6e95fdb7e0de5d0803ae55c7913ae9c83a293f7b0828313d5f63
updated: 2017-10-25T14:12:02.585493659-07:00
imports:
- name: github.com/amir/raidman
version: 1ccc43bfb9c93cb401a4025e49c64ba71e5e668b
- name: github.com/apache/thrift
version: 4c30c15924bfbc7c9e6bfc0e82630e97980e556e
subpackages:
- lib/go/thrift
- name: github.com/asaskevich/govalidator
version: 15028e809df8c71964e8efa6c11e81d5c0262302
- name: github.com/Azure/go-ansiterm
version: 19f72df4d05d31cbe1c56bfc8045c96babff6c7e
subpackages:
- winterm
- name: github.com/beorn7/perks
version: 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
subpackages:
- quantile
- name: github.com/boltdb/bolt
version: fa5367d20c994db73282594be0146ab221657943
- name: github.com/cactus/go-statsd-client
version: ce77ca9ecdee1c3ffd097e32f9bb832825ccb203
subpackages:
- statsd
- name: github.com/cenkalti/backoff
version: 80e08cb804a3eb3e576876c777e957e874609a9a
- name: github.com/cloudflare/cfssl
version: 7d88da830aad9d533c2fb8532da23f6a75331b52
subpackages:
- api
- auth
- certdb
- config
- crypto/pkcs7
- csr
- errors
- helpers
- helpers/derhelpers
- info
- initca
- log
- ocsp/config
- signer
- signer/local
- name: github.com/coreos/etcd
version: 5bb9f9591f01d0a3c61d2eb3a3bb281726005b2b
subpackages:
- raft/raftpb
- name: github.com/coreos/go-semver
version: 8ab6407b697782a06568d4b7f1db25550ec2e4c6
subpackages:
- semver
- name: github.com/davecgh/go-spew
version: a476722483882dd40b8111f0eb64e1d7f43f56e4
subpackages:
- spew
- name: github.com/dchest/siphash
version: 4ebf1de738443ea7f45f02dc394c4df1942a126d
- name: github.com/dghubble/go-twitter
version: c4115fa44a928413e0b857e0eb47376ffde3a61a
subpackages:
- twitter
- name: github.com/dghubble/oauth1
version: 7d51c10e15ca32917b32ce43f6e25840d6951db4
- name: github.com/dghubble/sling
version: 80ec33c6152a53edb5545864ca37567b506c4ca5
- name: github.com/dgrijalva/jwt-go
version: a539ee1a749a2b895533f979515ac7e6e0f5b650
- name: github.com/docker/cli
version: 139fcd3ee95f37f3ac17b1200fb0a63908cb6781
subpackages:
- cli/config/configfile
- name: github.com/docker/distribution
version: 5f6282db7d65e6d72ad7c2cc66310724a57be716
subpackages:
- digestset
- manifest
- manifest/schema1
- manifest/schema2
- reference
- registry/api/errcode
- registry/api/v2
- registry/client
- registry/client/auth
- registry/client/auth/challenge
- registry/client/transport
- registry/storage/cache
- registry/storage/cache/memory
- name: github.com/docker/docker
version: cdf870bd0b5fa678b10ef2708cca7ad776b4913c
subpackages:
- api/types
- api/types/blkiodev
- api/types/container
- api/types/filters
- api/types/mount
- api/types/network
- api/types/registry
- api/types/strslice
- api/types/swarm
- api/types/swarm/runtime
- api/types/versions
- daemon/cluster/convert
- opts
- pkg/archive
- pkg/fileutils
- pkg/homedir
- pkg/idtools
- pkg/ioutils
- pkg/jsonlog
- pkg/jsonmessage
- pkg/longpath
- pkg/mount
- pkg/namesgenerator
- pkg/pools
- pkg/promise
- pkg/stdcopy
- pkg/system
- pkg/term
- pkg/term/windows
- name: github.com/docker/go-connections
version: 3ede32e2033de7505e6500d6c868c2b9ed9f169d
subpackages:
- nat
- name: github.com/docker/go-events
version: 9461782956ad83b30282bf90e31fa6a70c255ba9
- name: github.com/docker/go-units
version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52
- name: github.com/docker/libkv
version: 93ab0e6c056d325dfbb11e1d58a3b4f5f62e7f3c
subpackages:
- store
- name: github.com/docker/libnetwork
version: 6d098467ec58038b68620a3c2c418936661efa64
subpackages:
- datastore
- discoverapi
- types
- name: github.com/docker/libtrust
version: aabc10ec26b754e797f9028f4589c5b7bd90dc20
- name: github.com/docker/swarmkit
version: bd7bafb8a61de1f5f23c8215ce7b9ecbcb30ff21
subpackages:
- api
- api/deepcopy
- api/equality
- api/genericresource
- api/naming
- ca
- connectionbroker
- identity
- ioutils
- log
- manager/raftselector
- manager/state
- manager/state/store
- protobuf/plugin
- remotes
- watch
- watch/queue
- name: github.com/eapache/go-resiliency
version: b1fe83b5b03f624450823b751b662259ffc6af70
subpackages:
- breaker
- name: github.com/eapache/go-xerial-snappy
version: bb955e01b9346ac19dc29eb16586c90ded99a98c
- name: github.com/eapache/queue
version: 44cc805cf13205b55f69e14bcb69867d1ae92f98
- name: github.com/fnproject/fn_go
version: 7ce3bb2e624df60cdfbfc1ee5483f6df80bb2b1b
subpackages:
- client
- client/apps
- client/call
- client/operations
- client/routes
- models
- name: github.com/fsnotify/fsnotify
version: 4da3e2cfbabc9f751898f250b49f2439785783a1
- name: github.com/fsouza/go-dockerclient
version: 98edf3edfae6a6500fecc69d2bcccf1302544004
- name: github.com/garyburd/redigo
version: 70e1b1943d4fc9c56791abaa6f4d1e727b9ab925
subpackages:
- internal
- redis
- name: github.com/gin-contrib/sse
version: 22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae
- name: github.com/gin-gonic/gin
version: 5afc5b19730118c9b8324fe9dd995d44ec65c81a
subpackages:
- binding
- json
- render
- name: github.com/go-logfmt/logfmt
version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5
- name: github.com/go-openapi/analysis
version: 8ed83f2ea9f00f945516462951a288eaa68bf0d6
- name: github.com/go-openapi/errors
version: 03cfca65330da08a5a440053faf994a3c682b5bf
- name: github.com/go-openapi/jsonpointer
version: 779f45308c19820f1a69e9a4cd965f496e0da10f
- name: github.com/go-openapi/jsonreference
version: 36d33bfe519efae5632669801b180bf1a245da3b
- name: github.com/go-openapi/loads
version: a80dea3052f00e5f032e860dd7355cd0cc67e24d
subpackages:
- fmts
- name: github.com/go-openapi/runtime
version: d6605b7c17ac3b1033ca794886e6142a4141f5b0
subpackages:
- client
- name: github.com/go-openapi/spec
version: 3faa0055dbbf2110abc1f3b4e3adbb22721e96e7
- name: github.com/go-openapi/strfmt
version: 610b6cacdcde6852f4de68998bd20ce1dac85b22
- name: github.com/go-openapi/swag
version: f3f9494671f93fcff853e3c6e9e948b3eb71e590
- name: github.com/go-openapi/validate
version: 8a82927c942c94794a5cd8b8b50ce2f48a955c0c
- name: github.com/go-sql-driver/mysql
version: 21d7e97c9f760ca685a01ecea202e1c84276daa1
- name: github.com/gogo/protobuf
version: 100ba4e885062801d56799d78530b73b178a78f3
subpackages:
- gogoproto
- proto
- protoc-gen-gogo/descriptor
- sortkeys
- types
- name: github.com/golang/protobuf
version: 5a0f697c9ed9d68fef0116532c6e05cfeae00e55
subpackages:
- proto
- ptypes/any
- name: github.com/golang/snappy
version: 553a641470496b2327abcac10b36396bd98e45c9
- name: github.com/google/btree
version: 316fb6d3f031ae8f4d457c6c5186b9e3ded70435
- name: github.com/google/certificate-transparency-go
version: 0dac42a6ed448ba220ee315abfaa6d26fd5fc9bb
repo: https://github.com/google/certificate-transparency-go
subpackages:
- asn1
- client
- jsonclient
- tls
- x509
- x509/pkix
- name: github.com/google/go-querystring
version: 53e6ce116135b80d037921a7fdd5138cf32d7a8a
subpackages:
- query
- name: github.com/gorilla/context
version: 08b5f424b9271eedf6f9f0ce86cb9396ed337a42
- name: github.com/gorilla/mux
version: 24fca303ac6da784b9e8269f724ddeb0b2eea5e7
- name: github.com/grpc-ecosystem/go-grpc-prometheus
version: 6b7015e65d366bf3f19b2b2a000a831940f0f7e0
- name: github.com/hashicorp/go-immutable-radix
version: 8aac2701530899b64bdea735a1de8da899815220
- name: github.com/hashicorp/go-memdb
version: ec43fcf8f202880feb35d2abb40a570c1f4172e9
- name: github.com/hashicorp/golang-lru
version: 0a025b7e63adc15a622f29b0b2c4c3848243bbf6
subpackages:
- simplelru
- name: github.com/hashicorp/hcl
version: 68e816d1c783414e79bc65b3994d9ab6b0a722ab
subpackages:
- hcl/ast
- hcl/parser
- hcl/scanner
- hcl/strconv
- hcl/token
- json/parser
- json/scanner
- json/token
- name: github.com/jmoiron/jsonq
version: e874b168d07ecc7808bc950a17998a8aa3141d82
- name: github.com/jmoiron/sqlx
version: d9bd385d68c068f1fabb5057e3dedcbcbb039d0f
subpackages:
- reflectx
- name: github.com/json-iterator/go
version: fdfe0b9a69118ff692d6e1005e9de7e0cffb7d6b
- name: github.com/kr/logfmt
version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0
- name: github.com/lib/pq
version: 23da1db4f16d9658a86ae9b717c245fc078f10f1
subpackages:
- oid
- name: github.com/magiconair/properties
version: 8d7837e64d3c1ee4e54a880c5a920ab4316fc90a
- name: github.com/mailru/easyjson
version: 2f5df55504ebc322e4d52d34df6a1f5b503bf26d
subpackages:
- buffer
- jlexer
- jwriter
- name: github.com/mattes/migrate
version: 5b98c13eff7657ab49a1a5f705b72f961d7fc558
subpackages:
- database
- source
- name: github.com/mattn/go-isatty
version: fc9e8d8ef48496124e79ae0df75490096eccf6fe
- name: github.com/mattn/go-sqlite3
version: 05548ff55570cdb9ac72ff4a25a3b5e77a6fb7e5
- name: github.com/matttproud/golang_protobuf_extensions
version: c12348ce28de40eed0136aa2b644d0ee0650e56c
subpackages:
- pbutil
- name: github.com/Microsoft/go-winio
version: 78439966b38d69bf38227fbf57ac8a6fee70f69a
- name: github.com/mitchellh/mapstructure
version: d0303fe809921458f417bcf828397a65db30a7e4
- name: github.com/Nvveen/Gotty
version: cd527374f1e5bff4938207604a14f2e38a9cf512
- name: github.com/opencontainers/go-digest
version: 279bed98673dd5bef374d3b6e4b09e2af76183bf
- name: github.com/opencontainers/image-spec
version: ebd93fd0782379ca3d821f0fa74f0651a9347a3e
subpackages:
- specs-go
- specs-go/v1
- name: github.com/opencontainers/runc
version: ae2948042b08ad3d6d13cd09f40a50ffff4fc688
subpackages:
- libcontainer/system
- libcontainer/user
- name: github.com/opentracing-contrib/go-observer
version: a52f2342449246d5bcc273e65cbdcfa5f7d6c63c
- name: github.com/opentracing/opentracing-go
version: 8ebe5d4e236eed9fd88e593c288bfb804d630b8c
subpackages:
- ext
- log
- name: github.com/openzipkin/zipkin-go-opentracing
version: 9c88fa03bfdfaa5fec7cd1b40f3d10ec15c15fc6
subpackages:
- flag
- thrift/gen-go/scribe
- thrift/gen-go/zipkincore
- types
- wire
- name: github.com/patrickmn/go-cache
version: a3647f8e31d79543b2d0f0ae2fe5c379d72cedc0
- name: github.com/pelletier/go-toml
version: 1d6b12b7cb290426e27e6b4e38b89fcda3aeef03
- name: github.com/pierrec/lz4
version: 08c27939df1bd95e881e2c2367a749964ad1fceb
- name: github.com/pierrec/xxHash
version: a0006b13c722f7f12368c00a3d3c2ae8a999a0c6
subpackages:
- xxHash32
- name: github.com/pkg/errors
version: 2b3a18b5f0fb6b4f9190549597d3f962c02bc5eb
- name: github.com/prometheus/client_golang
version: c5b7fccd204277076155f10851dad72b76a49317
subpackages:
- prometheus
- prometheus/promhttp
- name: github.com/prometheus/client_model
version: 6f3806018612930941127f2a7c6c453ba2c527d2
subpackages:
- go
- name: github.com/prometheus/common
version: 2f17f4a9d485bf34b4bfaccc273805040e4f86c8
subpackages:
- expfmt
- internal/bitbucket.org/ww/goautoneg
- model
- name: github.com/prometheus/procfs
version: a1dba9ce8baed984a2495b658c82687f8157b98f
subpackages:
- xfs
- name: github.com/PuerkitoBio/purell
version: 7cf257f0a33260797b0febf39f95fccd86aab2a3
- name: github.com/PuerkitoBio/urlesc
version: de5bf2ad457846296e2031421a34e2568e304e35
- name: github.com/rcrowley/go-metrics
version: 1f30fe9094a513ce4c700b9a54458bbb0c96996c
- name: github.com/rdallman/migrate
version: bc72eeb997c7334cb5f05f5aefd2d70bc34d71ef
subpackages:
- database/mysql
- database/postgres
- database/sqlite3
- source
- source/go-bindata
- name: github.com/Shopify/sarama
version: 4704a3a8c95920361c47e9a2adec13c3d757c757
- name: github.com/sirupsen/logrus
version: 89742aefa4b206dcf400792f3bd35b542998eb3b
subpackages:
- hooks/syslog
- name: github.com/spf13/afero
version: ee1bd8ee15a1306d1f9201acc41ef39cd9f99a1b
subpackages:
- mem
- name: github.com/spf13/cast
version: acbeb36b902d72a7a4c18e8f3241075e7ab763e4
- name: github.com/spf13/jwalterweatherman
version: 12bd96e66386c1960ab0f74ced1362f66f552f7b
- name: github.com/spf13/pflag
version: 7aff26db30c1be810f9de5038ec5ef96ac41fd7c
- name: github.com/spf13/viper
version: 25b30aa063fc18e48662b86996252eabdcf2f0c7
- name: github.com/ugorji/go
version: 54210f4e076c57f351166f0ed60e67d3fca57a36
subpackages:
- codec
- name: golang.org/x/crypto
version: 2509b142fb2b797aa7587dad548f113b2c0f20ce
subpackages:
- bcrypt
- blowfish
- ocsp
- pkcs12
- pkcs12/internal/rc2
- ssh/terminal
- name: golang.org/x/net
version: 66aacef3dd8a676686c7ae3716979581e8b03c47
subpackages:
- context
- context/ctxhttp
- http2
- http2/hpack
- idna
- internal/timeseries
- lex/httplex
- trace
- name: golang.org/x/sys
version: 07c182904dbd53199946ba614a412c61d3c548f5
subpackages:
- unix
- windows
- name: golang.org/x/text
version: b19bf474d317b857955b12035d2c5acb57ce8b01
subpackages:
- secure/bidirule
- transform
- unicode/bidi
- unicode/norm
- width
- name: google.golang.org/genproto
version: 09f6ed296fc66555a25fe4ce95173148778dfa85
subpackages:
- googleapis/rpc/status
- name: google.golang.org/grpc
version: b8669c35455183da6d5c474ea6e72fbf55183274
subpackages:
- codes
- credentials
- grpclb/grpc_lb_v1
- grpclog
- internal
- keepalive
- metadata
- naming
- peer
- stats
- status
- tap
- transport
- name: gopkg.in/go-playground/validator.v8
version: 5f1438d3fca68893a817e4a66806cea46a9e4ebf
- name: gopkg.in/mgo.v2
version: 3f83fa5005286a7fe593b055f0d7771a7dce4655
subpackages:
- bson
- internal/json
- internal/sasl
- internal/scram
- name: gopkg.in/yaml.v2
version: eb3733d160e74a9c7e442f435eb3bea458e1d19f
testImports: []