Skip to content

Commit

Permalink
Add NUMERIC Type Default tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sonatard committed Jun 17, 2024
1 parent 4007218 commit 2b1a21c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/hammer/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ CREATE TABLE t1 (
t1_8 TIMESTAMP NOT NULL,
t1_9 JSON NOT NULL,
t1_10 ARRAY<INT64> NOT NULL,
t1_11 NUMERIC NOT NULL,
) PRIMARY KEY(t1_1);
`,
expected: []string{
Expand All @@ -140,6 +141,8 @@ CREATE TABLE t1 (
`ALTER TABLE t1 ALTER COLUMN t1_9 DROP DEFAULT`,
`ALTER TABLE t1 ADD COLUMN t1_10 ARRAY<INT64> NOT NULL DEFAULT ([])`,
`ALTER TABLE t1 ALTER COLUMN t1_10 DROP DEFAULT`,
`ALTER TABLE t1 ADD COLUMN t1_11 NUMERIC NOT NULL DEFAULT (0)`,
`ALTER TABLE t1 ALTER COLUMN t1_11 DROP DEFAULT`,
},
},
{
Expand All @@ -161,6 +164,7 @@ CREATE TABLE t1 (
t1_8 TIMESTAMP DEFAULT (TIMESTAMP '2022-06-18 04:36:00.000000+09:00'),
t1_9 JSON DEFAULT (JSON '{"key": "value"}'),
t1_10 ARRAY<INT64> DEFAULT ([1]),
t1_11 NUMERIC DEFAULT (11),
) PRIMARY KEY(t1_1);
`,
expected: []string{
Expand All @@ -173,6 +177,7 @@ CREATE TABLE t1 (
`ALTER TABLE t1 ADD COLUMN t1_8 TIMESTAMP DEFAULT (TIMESTAMP '2022-06-18 04:36:00.000000+09:00')`,
`ALTER TABLE t1 ADD COLUMN t1_9 JSON DEFAULT (JSON '{"key": "value"}')`,
`ALTER TABLE t1 ADD COLUMN t1_10 ARRAY<INT64> DEFAULT ([1])`,
`ALTER TABLE t1 ADD COLUMN t1_11 NUMERIC DEFAULT (11)`,
},
},
{
Expand All @@ -194,6 +199,7 @@ CREATE TABLE t1 (
t1_8 TIMESTAMP NOT NULL DEFAULT (TIMESTAMP '2022-06-18 04:36:00.000000+09:00'),
t1_9 JSON NOT NULL DEFAULT (JSON '{"key": "value"}'),
t1_10 ARRAY<INT64> NOT NULL DEFAULT ([1]),
t1_11 NUMERIC NOT NULL DEFAULT (11),
) PRIMARY KEY(t1_1);
`,
expected: []string{
Expand All @@ -206,6 +212,7 @@ CREATE TABLE t1 (
`ALTER TABLE t1 ADD COLUMN t1_8 TIMESTAMP NOT NULL DEFAULT (TIMESTAMP '2022-06-18 04:36:00.000000+09:00')`,
`ALTER TABLE t1 ADD COLUMN t1_9 JSON NOT NULL DEFAULT (JSON '{"key": "value"}')`,
`ALTER TABLE t1 ADD COLUMN t1_10 ARRAY<INT64> NOT NULL DEFAULT ([1])`,
`ALTER TABLE t1 ADD COLUMN t1_11 NUMERIC NOT NULL DEFAULT (11)`,
},
},
{
Expand Down

0 comments on commit 2b1a21c

Please sign in to comment.