Skip to content

Commit

Permalink
internal/integration: composite-index test case
Browse files Browse the repository at this point in the history
  • Loading branch information
a8m committed Jan 31, 2022
1 parent e220cce commit 10ec926
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion internal/integration/testdata/postgres/index-desc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ cmpshow users 2.sql
# Use of "columns" instead of "on" should not trigger a change.
synced 2-no-change.hcl

apply 3.hcl
cmpshow users 3.sql

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

Expand Down Expand Up @@ -54,6 +57,7 @@ table "users" {
Indexes:
"rank_idx" btree (rank)


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

Expand All @@ -67,4 +71,36 @@ table "users" {
table.users.column.rank,
]
}
}
}


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

table "users" {
schema = schema.$db
column "rank" {
type = int
}
column "score" {
type = int
}
index "rank_score_idx" {
on {
column = table.users.column.rank
}
on {
column = table.users.column.score
desc = true
}
}
}

-- 3.sql --
Table "script_index_desc.users"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
rank | integer | | not null |
score | integer | | not null |
Indexes:
"rank_score_idx" btree (rank, score DESC)

0 comments on commit 10ec926

Please sign in to comment.