apply 1.hcl
cmpshow users 1.sql
atlas schema inspect -u URL > got
cmp 1.inspected.hcl got

# Change column default.
apply 2.hcl
cmpshow users 2.sql

-- 1.hcl --
schema "$db" {}

table "users" {
  schema = schema.$db
  column "name" {
    type = character_varying
    default = "unknown"
  }
  column "age" {
    type = int
    default = 1
  }
  column "active" {
    type = boolean
    default = true
  }
  column "bpchar" {
    type = bpchar
    default = "foo"
  }
}

-- 1.inspected.hcl --
table "users" {
  schema = schema.script_column_default
  column "name" {
    null    = false
    type    = character_varying
    default = "unknown"
  }
  column "age" {
    null    = false
    type    = integer
    default = 1
  }
  column "active" {
    null    = false
    type    = boolean
    default = true
  }
  column "bpchar" {
    null    = false
    type    = bpchar
    default = "foo"
  }
}
schema "script_column_default" {
}
-- 1.sql --
                       Table "script_column_default.users"
 Column |       Type        | Collation | Nullable |           Default
--------+-------------------+-----------+----------+------------------------------
 name   | character varying |           | not null | 'unknown'::character varying
 age    | integer           |           | not null | 1
 active | boolean           |           | not null | true
 bpchar | bpchar            |           | not null | 'foo'::bpchar

-- 2.hcl --
schema "$db" {}

table "users" {
  schema = schema.$db
  column "name" {
    type = character_varying
    default = "anonymous"
  }
  column "age" {
    type = int
    default = 0
  }
  column "active" {
    type = boolean
    default = false
  }
}

-- 2.sql --
                        Table "script_column_default.users"
 Column |       Type        | Collation | Nullable |            Default
--------+-------------------+-----------+----------+--------------------------------
 name   | character varying |           | not null | 'anonymous'::character varying
 age    | integer           |           | not null | 0
 active | boolean           |           | not null | false

