Configuration
pgmt uses pgmt.yaml for project configuration. CLI arguments override config file values.
Minimal Config
Section titled “Minimal Config”databases: dev_url: postgres://localhost/myapp_dev shadow: auto: trueFull Reference
Section titled “Full Reference”databases
Section titled “databases”databases: dev_url: postgres://localhost/myapp_dev # Development database (required) target_url: postgres://prod/myapp # Target for migrate apply (optional)
shadow: auto: true # Auto-create shadow database (recommended) # OR manual: # url: postgres://localhost/myapp_shadow
# OR Docker with specific version: # docker: # version: '16' # PostgreSQL version # auto_cleanup: true # Clean up container after usedirectories
Section titled “directories”directories: schema_dir: schema # Schema files migrations_dir: migrations # Migration files baselines_dir: schema_baselines # Baseline snapshots roles_file: roles.sql # Roles for shadow databaseobjects
Section titled “objects”objects: include: schemas: ['public', 'app'] # Only manage these schemas tables: ['users', 'orders'] # Only manage these tables
exclude: schemas: ['pg_*', 'information_schema'] # Glob patterns supported tables: ['cache_*', 'temp_*']
comments: true # Manage object comments grants: true # Manage permissions triggers: true # Manage triggers extensions: true # Manage extensionsmigration
Section titled “migration”migration: default_mode: safe_only # safe_only | confirm_all | force_all validate_baseline_consistency: true create_baselines_by_default: false # On-demand (recommended)
tracking_table: schema: public name: pgmt_migrationsschema
Section titled “schema”schema: augment_dependencies_from_files: true # Use -- require: directives validate_file_dependencies: truedocker
Section titled “docker”docker: auto_cleanup: true check_system_identifier: trueEnvironment Variables
Section titled “Environment Variables”PGMT_CONFIG_FILE # Override config file locationPGMT_DEV_URL # Override dev database URLPGMT_SHADOW_URL # Override shadow database URLPGMT_TARGET_URL # Override target database URLUse ${VAR} syntax in config files to reference environment variables:
databases: dev_url: ${DEV_DATABASE_URL} target_url: ${PROD_DATABASE_URL}CLI Overrides
Section titled “CLI Overrides”pgmt apply --dev-url postgres://localhost/other_dbpgmt apply --schema-dir custom_schema/pgmt apply --exclude-schemas "temp_*,cache_*"pgmt apply --no-comments --no-grantsDefaults
Section titled “Defaults”| Option | Default |
|---|---|
databases.shadow.auto | true |
directories.schema_dir | schema |
directories.migrations_dir | migrations |
directories.baselines_dir | schema_baselines |
objects.exclude.schemas | ["pg_*", "information_schema"] |
objects.comments | true |
objects.grants | true |
objects.triggers | true |
objects.extensions | true |
migration.default_mode | safe_only |
migration.create_baselines_by_default | false |
migration.tracking_table.schema | public |
migration.tracking_table.name | pgmt_migrations |