sqitchers/sqitch

How to pass database and schema information using variable

hrkachhia opened this issue · 2 comments

I want to pass database and schema information when deploying the database. for that I have declared below line in appschema.sql file and trying to pass schema value accrodingly

sqitch deploy 'db_url/database?Driver=Snowflake;warehouse=COMPUTE_WH;schema=my_schema'

appschema.sql:

USE WAREHOUSE &warehouse;
USE SCHEMA &schema; 


-- XXX Add DDLs here.
CREATE TABLE users (
    nickname  TEXT         PRIMARY KEY,
    password  TEXT         NOT NULL,
    fullname  TEXT         NOT NULL,
    twitter   TEXT         NOT NULL,
    timestamp TIMESTAMP_TZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);

I am getting error Variable schema is not defined

Try

sqitch deploy --set schema=my_schema 'db_url/database?Driver=Snowflake;warehouse=COMPUTE_WH'

Thank you I have tried and it is working now.