(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestSQLSpec(t *testing.T) { |
| 17 | f := ` |
| 18 | schema "schema" { |
| 19 | } |
| 20 | |
| 21 | table "table" { |
| 22 | schema = schema.schema |
| 23 | column "id" { |
| 24 | type = integer |
| 25 | auto_increment = true |
| 26 | } |
| 27 | column "age" { |
| 28 | type = integer |
| 29 | } |
| 30 | column "price" { |
| 31 | type = integer |
| 32 | } |
| 33 | column "account_name" { |
| 34 | type = varchar(32) |
| 35 | } |
| 36 | primary_key { |
| 37 | columns = [table.table.column.id] |
| 38 | } |
| 39 | index "index" { |
| 40 | unique = true |
| 41 | columns = [ |
| 42 | table.table.column.id, |
| 43 | table.table.column.age, |
| 44 | ] |
| 45 | where = "age <> 0" |
| 46 | } |
| 47 | foreign_key "accounts" { |
| 48 | columns = [ |
| 49 | table.table.column.account_name, |
| 50 | ] |
| 51 | ref_columns = [ |
| 52 | table.accounts.column.name, |
| 53 | ] |
| 54 | on_delete = SET_NULL |
| 55 | } |
| 56 | check "positive price" { |
| 57 | expr = "price > 0" |
| 58 | } |
| 59 | without_rowid = true |
| 60 | strict = false |
| 61 | } |
| 62 | |
| 63 | table "accounts" { |
| 64 | schema = schema.schema |
| 65 | column "name" { |
| 66 | type = varchar(32) |
| 67 | } |
| 68 | primary_key { |
| 69 | columns = [table.accounts.column.name] |
| 70 | } |
| 71 | strict = true |
| 72 | } |
| 73 | ` |
nothing calls this directly
no test coverage detected