From 2b1a21ca076ad8d3faf52f29dacb84ed7261e22b Mon Sep 17 00:00:00 2001 From: sonatard Date: Mon, 17 Jun 2024 14:06:21 +0900 Subject: [PATCH] Add NUMERIC Type Default tests --- internal/hammer/diff_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/hammer/diff_test.go b/internal/hammer/diff_test.go index 65c36c1..bf3e057 100644 --- a/internal/hammer/diff_test.go +++ b/internal/hammer/diff_test.go @@ -119,6 +119,7 @@ CREATE TABLE t1 ( t1_8 TIMESTAMP NOT NULL, t1_9 JSON NOT NULL, t1_10 ARRAY NOT NULL, + t1_11 NUMERIC NOT NULL, ) PRIMARY KEY(t1_1); `, expected: []string{ @@ -140,6 +141,8 @@ CREATE TABLE t1 ( `ALTER TABLE t1 ALTER COLUMN t1_9 DROP DEFAULT`, `ALTER TABLE t1 ADD COLUMN t1_10 ARRAY 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`, }, }, { @@ -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 DEFAULT ([1]), + t1_11 NUMERIC DEFAULT (11), ) PRIMARY KEY(t1_1); `, expected: []string{ @@ -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 DEFAULT ([1])`, + `ALTER TABLE t1 ADD COLUMN t1_11 NUMERIC DEFAULT (11)`, }, }, { @@ -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 NOT NULL DEFAULT ([1]), + t1_11 NUMERIC NOT NULL DEFAULT (11), ) PRIMARY KEY(t1_1); `, expected: []string{ @@ -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 NOT NULL DEFAULT ([1])`, + `ALTER TABLE t1 ADD COLUMN t1_11 NUMERIC NOT NULL DEFAULT (11)`, }, }, {