tree: 8160d0640a29d6db7695d758f7b270b92bf6d2cc [path history] [tgz]
  1. examples/
  2. postgres.go
  3. postgres_test.go
  4. README.md
database/postgres/README.md

postgres

postgres://user:password@host:port/dbname?query (postgresql:// works, too)

URL QueryWithInstance ConfigDescription
x-migrations-tableMigrationsTableName of the migrations table
dbnameDatabaseNameThe name of the database to connect to
search_pathThis variable specifies the order in which schemas are searched when an object is referenced by a simple name with no schema specified.
userThe user to sign in as
passwordThe user's password
hostThe host to connect to. Values that start with / are for unix domain sockets. (default is localhost)
portThe port to bind to. (default is 5432)
fallback_application_nameAn application_name to fall back to if one isn't provided.
connect_timeoutMaximum wait for connection, in seconds. Zero or not specified means wait indefinitely.
sslcertCert file location. The file must contain PEM encoded data.
sslkeyKey file location. The file must contain PEM encoded data.
sslrootcertThe location of the root certificate file. The file must contain PEM encoded data.
sslmodeWhether or not to use SSL (disable|require|verify-ca|verify-full)

Upgrading from v1

  1. Write down the current migration version from schema_migrations
  2. DROP TABLE schema_migrations
  3. Wrap your existing migrations in transactions (BEGIN/COMMIT) if you use multiple statements within one migration.
  4. Download and install the latest migrate version.
  5. Force the current migration version with migrate force <current_version>.