Mai Same
Mai Same

Reputation: 21

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

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

Upvotes: 2

Views: 323

Answers (1)

Ferdy
Ferdy

Reputation: 507

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.

Upvotes: 0

Related Questions