File: column-array.txt

package info (click to toggle)
golang-ariga-atlas 0.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,676 kB
  • sloc: javascript: 592; sql: 404; makefile: 10
file content (103 lines) | stat: -rw-r--r-- 2,174 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
apply 1.hcl
cmpshow logs 1.sql

# Change size of the underlying type.
apply 2.change-size.hcl
cmpshow logs 2.sql

synced 3.nochange.hcl
synced 4.nochange.hcl

apply 5.hcl
cmpshow logs 5.sql


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

table "logs" {
  schema    = schema.$db
  column "records" {
    null      = false
    type      = sql("varchar(255)[]")
  }
}

-- 1.sql --
                  Table "script_column_array.logs"
 Column  |           Type           | Collation | Nullable | Default
---------+--------------------------+-----------+----------+---------
 records | character varying(255)[] |           | not null |


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

table "logs" {
  schema    = schema.$db
  column "records" {
    null      = false
    type      = sql("varchar(100) ARRAY")
  }
}

-- 2.sql --
                  Table "script_column_array.logs"
 Column  |           Type           | Collation | Nullable | Default
---------+--------------------------+-----------+----------+---------
 records | character varying(100)[] |           | not null |

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

table "logs" {
  schema    = schema.$db
  column "records" {
    null      = false
    type      = sql("varchar(100) ARRAY")
  }
}

-- 4.nochange.hcl --
schema "$db" {}

table "logs" {
  schema    = schema.$db
  column "records" {
    null      = false
    type      = sql("varchar(100) [10][]")
  }
}

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

table "logs" {
  schema    = schema.$db
  column "a" {
    null = false
    type = sql("int[1]")
  }
  column "b" {
    null = false
    type = sql("int ARRAY[1]")
  }
  column "c" {
    null = false
    type = sql("character varying(100) ARRAY[1]")
  }
  column "d" {
    null = false
    type = sql("point [][1]")
  }
}

-- 5.sql --
       Table "script_column_array.logs"
 Column |           Type           | Collation | Nullable | Default
--------+--------------------------+-----------+----------+---------
 a      | integer[]                |           | not null |
 b      | integer[]                |           | not null |
 c      | character varying(100)[] |           | not null |
 d      | point[]                  |           | not null |