github.com/nagyist/migrate/v4@v4.14.6/database/postgres/README.md (about)

     1  # postgres
     2  
     3  `postgres://user:password@host:port/dbname?query` (`postgresql://` works, too)
     4  
     5  | URL Query  | WithInstance Config | Description | Default value |
     6  |------------|---------------------|-------------|---------------|
     7  | `x-migrations-table-has-schema` | `MigrationsTableHasSchema` | Enable schema name support in `x-migrations-table` parameter | `false` |
     8  | `x-migrations-table` | `MigrationsTable` | Name of the migrations table, if `x-migrations-table-has-schema` is enabled then the first dot is treated as the schema and table name separator, for instance `gomigrate.schema_migrations` | `schema_migrations` |
     9  | `x-statement-timeout` | `StatementTimeout` | Abort any statement that takes more than the specified number of milliseconds | `0` |
    10  | `dbname` | `DatabaseName` | The name of the database to connect to | `SELECT CURRENT_DATABASE()` result |
    11  | `search_path` | | This variable specifies the order in which schemas are searched when an object is referenced by a simple name with no schema specified. | `SHOW search_path` result |
    12  | `user` | | The user to sign in as | |
    13  | `password` | | The user's password | |
    14  | `host` | | The host to connect to. Values that start with / are for unix domain sockets | `localhost` |
    15  | `port` | | The port to bind to| `5432` |
    16  | `fallback_application_name` | | An application_name to fall back to if one isn't provided. | |
    17  | `connect_timeout` | | Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely. | |
    18  | `sslcert` | | Cert file location. The file must contain PEM encoded data. | |
    19  | `sslkey` | | Key file location. The file must contain PEM encoded data. | |
    20  | `sslrootcert` | | The location of the root certificate file. The file must contain PEM encoded data. | |
    21  | `sslmode` | | Whether or not to use SSL (disable\|require\|verify-ca\|verify-full) | |
    22  
    23  
    24  ## Upgrading from v1
    25  
    26  1. Write down the current migration version from schema_migrations
    27  1. `DROP TABLE schema_migrations`
    28  2. Wrap your existing migrations in transactions ([BEGIN/COMMIT](https://www.postgresql.org/docs/current/static/transaction-iso.html)) if you use multiple statements within one migration.
    29  3. Download and install the latest migrate version.
    30  4. Force the current migration version with `migrate force <current_version>`.
    31  
    32  ## Multi-statement mode
    33  
    34  In PostgreSQL running multiple SQL statements in one `Exec` executes them inside a transaction. Sometimes this
    35  behavior is not desirable because some statements can be only run outside of transaction (e.g.
    36  `CREATE INDEX CONCURRENTLY`). If you want to use `CREATE INDEX CONCURRENTLY` without activating multi-statement mode
    37  you have to put such statements in a separate migration files.