File: column-float.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 (64 lines) | stat: -rw-r--r-- 1,443 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
apply 1.hcl
cmpshow users 1.sql

apply 2.hcl
cmpshow users 2.sql

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

table "users" {
  schema = schema.$db
  column "c1" {
    type = real
  }
  column "c2" {
    type = double_precision
  }
  column "c3" {
    // Equals to real when precision is between 1 and 24.
    type = float(10)
  }
  column "c4" {
    // Equals to double_precision when precision is between 1 and 24.
    type = float(30)
  }
}

-- 1.sql --
             Table "script_column_float.users"
 Column |       Type       | Collation | Nullable | Default
--------+------------------+-----------+----------+---------
 c1     | real             |           | not null |
 c2     | double precision |           | not null |
 c3     | real             |           | not null |
 c4     | double precision |           | not null |


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

table "users" {
  schema = schema.$db
  column "c1" {
    type = double_precision
  }
  column "c2" {
    type = real
  }
  column "c3" {
    type = float(30)
  }
  column "c4" {
    type = float(10)
  }
}

-- 2.sql --
             Table "script_column_float.users"
 Column |       Type       | Collation | Nullable | Default
--------+------------------+-----------+----------+---------
 c1     | double precision |           | not null |
 c2     | real             |           | not null |
 c3     | double precision |           | not null |
 c4     | real             |           | not null |