From be719e2fa8b8c4d379d2d40ab251de98e17df8cd Mon Sep 17 00:00:00 2001 From: Karthik Kamurthy Date: Thu, 10 Mar 2022 15:04:45 +0530 Subject: [PATCH] AQUILONAQD-1107: NETWORK-SCHEMA-CHANGE * Move subscription table ddl from this_branch to upgrade/2021.12.08-1 * Schema changes to network table on psql script since the ip is represented as RAW data type and will fail when it's migrated to Postgres. --- upgrade/{this_branch => 2021.12.08-1}/subscription.psql | 0 upgrade/{this_branch => 2021.12.08-1}/subscription.sql | 0 upgrade/this_branch/migration.psql | 5 +++++ 3 files changed, 5 insertions(+) rename upgrade/{this_branch => 2021.12.08-1}/subscription.psql (100%) rename upgrade/{this_branch => 2021.12.08-1}/subscription.sql (100%) create mode 100755 upgrade/this_branch/migration.psql diff --git a/upgrade/this_branch/subscription.psql b/upgrade/2021.12.08-1/subscription.psql similarity index 100% rename from upgrade/this_branch/subscription.psql rename to upgrade/2021.12.08-1/subscription.psql diff --git a/upgrade/this_branch/subscription.sql b/upgrade/2021.12.08-1/subscription.sql similarity index 100% rename from upgrade/this_branch/subscription.sql rename to upgrade/2021.12.08-1/subscription.sql diff --git a/upgrade/this_branch/migration.psql b/upgrade/this_branch/migration.psql new file mode 100755 index 000000000..ba2152208 --- /dev/null +++ b/upgrade/this_branch/migration.psql @@ -0,0 +1,5 @@ +-- network + +ALTER TABLE network DROP CONSTRAINT network_cidr_ip_ck; +ALTER TABLE network ADD CONSTRAINT network_cidr_ip_ck + CHECK (cidr >= 1 AND cidr <= CASE WHEN (ip >= '0.0.0.0' AND ip <= '255.255.255.255') THEN 32 ELSE 128 END); \ No newline at end of file