engine = pg [core "variables"] u" /> engine = pg [core "variables"] u" /> engine = pg [core "variables"] u"/>

How can I add a custom variable to Sqitch, to be used in target postgres

275 Views Asked by At

I would like to add few variables:"username' and "database" in my sqitch.conf on a defined target.

file sqitch.conf=>

    engine = pg

[core "variables"]
    username = jv_root
    database = test

[target "dev_1"]
        uri = db:pg://username@sqlhost:5432/database

[target "dev_2"]
        uri = db:pg://username@sqlhost2:5432/database

where I run: sqitch deploy -t dev_1 it throw an error => ERROR: no such user: username

1

There are 1 best solutions below

0
Ferdy On

You can add environment specific variables like this.

[target.dev_1.variables]
  username = jv_root
  password = test

How you address them in your sql files depends on the sql dialect.