github.com/olitvin/migrate/v4@v4.14.3-0.20210330111251-992b37ee04c8/database/pgx/README.md (about) 1 # pgx 2 3 `pgx://user:password@host:port/dbname?query` 4 5 | URL Query | WithInstance Config | Description | 6 |------------|---------------------|-------------| 7 | `x-migrations-table` | `MigrationsTable` | Name of the migrations table | 8 | `x-statement-timeout` | `StatementTimeout` | Abort any statement that takes more than the specified number of milliseconds | 9 | `x-multi-statement` | `MultiStatementEnabled` | Enable multi-statement execution (default: false) | 10 | `x-multi-statement-max-size` | `MultiStatementMaxSize` | Maximum size of single statement in bytes (default: 10MB) | 11 | `dbname` | `DatabaseName` | The name of the database to connect to | 12 | `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. | 13 | `user` | | The user to sign in as | 14 | `password` | | The user's password | 15 | `host` | | The host to connect to. Values that start with / are for unix domain sockets. (default is localhost) | 16 | `port` | | The port to bind to. (default is 5432) | 17 | `fallback_application_name` | | An application_name to fall back to if one isn't provided. | 18 | `connect_timeout` | | Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely. | 19 | `sslcert` | | Cert file location. The file must contain PEM encoded data. | 20 | `sslkey` | | Key file location. The file must contain PEM encoded data. | 21 | `sslrootcert` | | The location of the root certificate file. The file must contain PEM encoded data. | 22 | `sslmode` | | Whether or not to use SSL (disable\|require\|verify-ca\|verify-full) | 23 24 25 ## Upgrading from v1 26 27 1. Write down the current migration version from schema_migrations 28 1. `DROP TABLE schema_migrations` 29 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. 30 3. Download and install the latest migrate version. 31 4. Force the current migration version with `migrate force <current_version>`. 32 33 ## Multi-statement mode 34 35 In PostgreSQL running multiple SQL statements in one `Exec` executes them inside a transaction. Sometimes this 36 behavior is not desirable because some statements can be only run outside of transaction (e.g. 37 `CREATE INDEX CONCURRENTLY`). If you want to use `CREATE INDEX CONCURRENTLY` without activating multi-statement mode 38 you have to put such statements in a separate migration files.