You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by zr...@apache.org on 2021/07/29 16:59:07 UTC
[trafficcontrol] branch master updated: Collapse DB migrations that
have already been released (pre-ATCv6) (#6065)
This is an automated email from the ASF dual-hosted git repository.
zrhoffman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 3cc78ea Collapse DB migrations that have already been released (pre-ATCv6) (#6065)
3cc78ea is described below
commit 3cc78ea53ab792ef0c8ac6dd07e423eecd5acc55
Author: Steve Hamrick <sh...@users.noreply.github.com>
AuthorDate: Thu Jul 29 10:58:59 2021 -0600
Collapse DB migrations that have already been released (pre-ATCv6) (#6065)
* Collapse <6 migrations
* Fix TODB tests when there are deletions
* Fix triggers
* IF NOT EXISTS
* IF NOT EXISTS
* Check correct table
* Check correct table
* Fix whitespace
---
.github/actions/todb-tests/entrypoint.sh | 4 +-
CHANGELOG.md | 1 +
traffic_ops/app/db/create_tables.sql | 613 ++++++++++++++++++++-
.../20181206000000_create_monitor_snapshots.sql | 28 -
.../20190219000000_add_consistent_hash_regex.sql | 19 -
.../20190319000000_add_max_origin_connections.sql | 22 -
.../20190513000000_add-allowed_query_keys.sql | 32 --
.../20191004000000_add_server_capabilities.sql | 27 -
...20191005000000_add_server_server_capability.sql | 31 --
...00_add_deliveryservices_required_capability.sql | 31 --
.../migrations/20191215000000_add_ecs_enabled.sql | 22 -
.../20200218000000_add_dns_challenges.sql | 28 -
.../20200227000000_add_ds_slice_block_size.sql | 25 -
.../20200313000000_add_server_ip_toggles.sql | 33 --
...0200408000000_add_lets_encrypt_account_info.sql | 33 --
.../20200422101648_create_topology_tables.sql | 68 ---
.../db/migrations/20200507000000_interfaces.sql | 116 ----
.../2020061622101648_add_new_header_rewrite.sql | 32 --
.../2020062923101648_add_deleted_tables.sql | 470 ----------------
.../2020072700000000_remove_redundancy.sql | 64 ---
...000000_add_deliveryservice_service_category.sql | 25 -
...0081108261100_add_server_ip_profile_trigger.sql | 124 -----
...082000000000_add_server_status_last_updated.sql | 28 -
.../2020082700000000_server_id_primary_key.sql | 41 --
...03000000000_remove_service_category_tenancy.sql | 19 -
...20110200000000_add_service_category_deleted.sql | 28 -
...0900000000_server_ip_profile_trigger_update.sql | 124 -----
.../2021010900000001_move_lets_encrypt_to_acme.sql | 60 --
...dd_max_request_header_size_delivery_service.sql | 22 -
...0000003_server_interface_ip_address_cascade.sql | 57 --
...00000_max_request_header_bytes_default_zero.sql | 23 -
31 files changed, 588 insertions(+), 1662 deletions(-)
diff --git a/.github/actions/todb-tests/entrypoint.sh b/.github/actions/todb-tests/entrypoint.sh
index eda7bdb..ae54df2 100755
--- a/.github/actions/todb-tests/entrypoint.sh
+++ b/.github/actions/todb-tests/entrypoint.sh
@@ -52,8 +52,8 @@ for file in "$(ls)"; do
done
# Files added must have date and name later than all existing file
-LATEST_FILE="$(git log -1 --name-status --format="%ct" . | tail -n 1 | awk '{print $2}' | cut -d / -f5)"
-LATEST_FILE_TIME="$(git log -1 --name-status --format="%ct" . | head -n 1 )"
+LATEST_FILE="$(git log -1 --name-status --diff-filter=d --format="%ct" . | tail -n 1 | awk '{print $2}' | cut -d / -f5)"
+LATEST_FILE_TIME="$(git log -1 --name-status --diff-filter=d --format="%ct" . | head -n 1 )"
# Get modified times in an array
mtime_array=()
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c46d174..358c6f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -90,6 +90,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Converted TP Cache Checks table to ag-grid
- [#5981](https://github.com/apache/trafficcontrol/issues/5891) - `/deliveryservices/{{ID}}/safe` returns incorrect response for the requested API version
- [#5984](https://github.com/apache/trafficcontrol/issues/5894) - `/servers/{{ID}}/deliveryservices` returns incorrect response for the requested API version
+- [#6027](https://github.com/apache/trafficcontrol/issues/6027) - Collapsed DB migrations
### Changed
- Updated the Traffic Ops Python client to 3.0
diff --git a/traffic_ops/app/db/create_tables.sql b/traffic_ops/app/db/create_tables.sql
index 9c11964..d2a4816 100644
--- a/traffic_ops/app/db/create_tables.sql
+++ b/traffic_ops/app/db/create_tables.sql
@@ -50,9 +50,99 @@ BEGIN
END;
$$;
-
ALTER FUNCTION public.on_update_current_timestamp_last_updated() OWNER TO traffic_ops;
+--
+-- Name: before_server_table(); Type: FUNCTION; Schema: public; Owner: traffic_ops
+--
+
+CREATE OR REPLACE FUNCTION before_server_table()
+ RETURNS TRIGGER AS
+$$
+DECLARE
+ server_count BIGINT;
+BEGIN
+ WITH server_ips AS (
+ SELECT s.id, i.name, ip.address, s.profile
+ FROM server s
+ JOIN interface i on i.server = s.ID
+ JOIN ip_address ip on ip.Server = s.ID and ip.interface = i.name
+ WHERE i.monitor = true
+ )
+ SELECT count(*)
+ INTO server_count
+ FROM server_ips sip
+ JOIN server_ips sip2 on sip.id <> sip2.id
+ WHERE sip.id = NEW.id
+ AND sip2.address = sip.address
+ AND sip2.profile = sip.profile;
+
+ IF server_count > 0 THEN
+ RAISE EXCEPTION 'Server [id:%] does not have a unique ip_address over the profile [id:%], [%] conflicts',
+ NEW.id,
+ NEW.profile,
+ server_count;
+ END IF;
+ RETURN NEW;
+END;
+$$ LANGUAGE plpgsql;
+ALTER FUNCTION public.before_server_table() OWNER TO traffic_ops;
+
+--
+-- Name: before_ip_address_table(); Type: FUNCTION; Schema: public; Owner: traffic_ops
+--
+
+CREATE OR REPLACE FUNCTION before_ip_address_table()
+ RETURNS TRIGGER
+AS
+$$
+DECLARE
+ server_count BIGINT;
+ server_id BIGINT;
+ server_profile BIGINT;
+BEGIN
+ WITH server_ips AS (
+ SELECT s.id as sid, ip.interface, i.name, ip.address, s.profile, ip.server
+ FROM server s
+ JOIN interface i
+ on i.server = s.ID
+ JOIN ip_address ip
+ on ip.Server = s.ID and ip.interface = i.name
+ WHERE ip.service_address = true
+ )
+ SELECT count(distinct(sip.sid)), sip.sid, sip.profile
+ INTO server_count, server_id, server_profile
+ FROM server_ips sip
+ WHERE (sip.server <> NEW.server AND (SELECT host(sip.address)) = (SELECT host(NEW.address)) AND sip.profile = (SELECT profile from server s WHERE s.id = NEW.server))
+ GROUP BY sip.sid, sip.profile;
+
+ IF server_count > 0 THEN
+ RAISE EXCEPTION 'ip_address is not unique across the server [id:%] profile [id:%], [%] conflicts',
+ server_id,
+ server_profile,
+ server_count;
+ END IF;
+ RETURN NEW;
+END;
+$$ LANGUAGE PLPGSQL;
+ALTER FUNCTION public.before_ip_address_table() OWNER TO traffic_ops;
+
+--
+-- Name: on_delete_current_timestamp_last_updated(); Type: FUNCTION; Schema: public; Owner: traffic_ops
+--
+
+CREATE OR REPLACE FUNCTION public.on_delete_current_timestamp_last_updated()
+ RETURNS trigger
+AS $$
+BEGIN
+ update last_deleted set last_updated = now() where table_name = TG_ARGV[0];
+ RETURN NEW;
+END;
+$$
+LANGUAGE plpgsql;
+
+ALTER FUNCTION public.on_delete_current_timestamp_last_updated() OWNER TO traffic_ops;
+
SET default_tablespace = '';
SET default_with_oids = false;
@@ -157,6 +247,22 @@ IF NOT EXISTS (SELECT FROM pg_type WHERE typname = 'workflow_states') THEN
);
END IF;
+IF NOT EXISTS(SELECT FROM pg_type WHERE typname = 'server_ip_address') THEN
+ --
+ -- Name: server_ip_address; Type: TYPE; Schema: public; Owner: traffic_ops
+ --
+
+ CREATE TYPE server_ip_address AS (address inet, gateway inet, service_address boolean);
+END IF;
+
+IF NOT EXISTS(SELECT FROM pg_type WHERE typname = 'server_interface') THEN
+ --
+ -- Name: server_interface; Type: TYPE; Schema: public; Owner: traffic_ops
+ --
+
+ CREATE TYPE server_interface AS (ip_addresses server_ip_address ARRAY, max_bandwidth bigint, monitor boolean, mtu bigint, name text);
+END IF;
+
IF NOT EXISTS (SELECT FROM pg_type WHERE typname = 'deliveryservice_signature_type') THEN
--
-- Name: deliveryservice_signature_type; Type: DOMAIN; Schema: public; Owner: traffic_ops
@@ -167,6 +273,18 @@ END IF;
END$$;
--
+-- Name: acme_account; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS acme_account (
+ email text NOT NULL,
+ private_key text NOT NULL,
+ provider text NOT NULL,
+ uri text NOT NULL,
+ PRIMARY KEY (email, provider)
+);
+
+--
-- Name: api_capability; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -415,6 +533,16 @@ CREATE TABLE IF NOT EXISTS deliveryservice (
deep_caching_type deep_caching_type NOT NULL DEFAULT 'NEVER',
fq_pacing_rate bigint DEFAULT 0,
anonymous_blocking_enabled boolean NOT NULL DEFAULT FALSE,
+ consistent_hash_regex text,
+ max_origin_connections bigint NOT NULL DEFAULT 0 CHECK (max_origin_connections >= 0),
+ ecs_enabled boolean NOT NULL DEFAULT false,
+ range_slice_block_size integer CHECK (range_slice_block_size >= 262144 AND range_slice_block_size <= 33554432) DEFAULT NULL,
+ topology text,
+ first_header_rewrite text,
+ inner_header_rewrite text,
+ last_header_rewrite text,
+ service_category text,
+ max_request_header_bytes int NOT NULL DEFAULT 0,
CONSTRAINT routing_name_not_empty CHECK ((length(routing_name) > 0)),
CONSTRAINT idx_89502_primary PRIMARY KEY (id, type)
);
@@ -423,6 +551,30 @@ CREATE TABLE IF NOT EXISTS deliveryservice (
ALTER TABLE deliveryservice OWNER TO traffic_ops;
--
+-- Name: deliveryservices_required_capability; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS deliveryservices_required_capability (
+ required_capability TEXT NOT NULL,
+ deliveryservice_id bigint NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL,
+
+ PRIMARY KEY (deliveryservice_id, required_capability)
+);
+
+--
+-- Name: deliveryservice_consistent_hash_query_param; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS deliveryservice_consistent_hash_query_param (
+ name TEXT NOT NULL,
+ deliveryservice_id bigint NOT NULL,
+ CONSTRAINT name_empty CHECK (length(name) > 0),
+ CONSTRAINT name_reserved CHECK (name NOT IN ('format','trred')),
+ PRIMARY KEY (name, deliveryservice_id)
+);
+
+--
-- Name: deliveryservice_id_seq; Type: SEQUENCE; Schema: public; Owner: traffic_ops
--
@@ -552,6 +704,14 @@ ALTER TABLE division_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE division_id_seq OWNED BY division.id;
+--
+-- Name: dnschallenges; Type: SEQUENCE OWNED BY; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS dnschallenges (
+ fqdn text NOT NULL,
+ record text NOT NULL
+);
--
-- Name: federation; Type: TABLE; Schema: public; Owner: traffic_ops
@@ -705,6 +865,56 @@ ALTER TABLE hwinfo_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE hwinfo_id_seq OWNED BY hwinfo.id;
+--
+-- Name: interface; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS interface (
+ max_bandwidth bigint DEFAULT NULL CHECK (max_bandwidth IS NULL OR max_bandwidth >= 0),
+ monitor boolean NOT NULL,
+ mtu bigint DEFAULT 1500 CHECK (mtu IS NULL OR mtu > 1280),
+ name text NOT NULL CHECK (name != ''),
+ server bigint NOT NULL,
+ PRIMARY KEY (name, server)
+);
+
+--
+-- Name: ip_address; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS ip_address (
+ address inet NOT NULL,
+ gateway inet CHECK (
+ gateway IS NULL OR (
+ family(gateway) = 4 AND
+ masklen(gateway) = 32
+ ) OR (
+ family(gateway) = 6 AND
+ masklen(gateway) = 128
+ )
+ ),
+ interface text NOT NULL,
+ server bigint NOT NULL,
+ service_address boolean NOT NULL DEFAULT FALSE,
+ PRIMARY KEY (address, interface, server)
+);
+
+--
+-- Name: before_create_ip_address_trigger; Type: TRIGGER; Schema: public; Owner: traffic_ops
+--
+DROP TRIGGER IF EXISTS before_create_ip_address_trigger on ip_address;
+CREATE TRIGGER before_create_ip_address_trigger
+ BEFORE INSERT ON ip_address
+ FOR EACH ROW EXECUTE PROCEDURE before_ip_address_table();
+
+--
+-- Name: before_update_ip_address_trigger; Type: TRIGGER; Schema: public; Owner: traffic_ops
+--
+DROP TRIGGER IF EXISTS before_update_ip_address_trigger on ip_address;
+CREATE TRIGGER before_update_ip_address_trigger
+ BEFORE UPDATE ON ip_address
+ FOR EACH ROW WHEN (NEW.address <> OLD.address)
+ EXECUTE PROCEDURE before_ip_address_table();
--
-- Name: job; Type: TABLE; Schema: public; Owner: traffic_ops
@@ -825,6 +1035,10 @@ ALTER TABLE job_status_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE job_status_id_seq OWNED BY job_status.id;
+CREATE TABLE IF NOT EXISTS last_deleted (
+ table_name text NOT NULL PRIMARY KEY,
+ last_updated timestamp with time zone NOT NULL DEFAULT now()
+);
--
-- Name: log; Type: TABLE; Schema: public; Owner: traffic_ops
@@ -1156,13 +1370,6 @@ CREATE TABLE IF NOT EXISTS server (
tcp_port bigint,
xmpp_id text,
xmpp_passwd text,
- interface_name text NOT NULL,
- ip_address text NOT NULL,
- ip_netmask text NOT NULL,
- ip_gateway text NOT NULL,
- ip6_address text,
- ip6_gateway text,
- interface_mtu bigint DEFAULT '9000'::bigint NOT NULL,
phys_location bigint NOT NULL,
rack text,
cachegroup bigint DEFAULT '0'::bigint NOT NULL,
@@ -1186,13 +1393,61 @@ CREATE TABLE IF NOT EXISTS server (
last_updated timestamp with time zone NOT NULL DEFAULT now(),
https_port bigint,
reval_pending boolean NOT NULL DEFAULT FALSE,
- CONSTRAINT idx_89709_primary PRIMARY KEY (id, cachegroup, type, status, profile)
+ status_last_updated timestamp with time zone,
+ CONSTRAINT idx_89709_primary PRIMARY KEY (id)
);
+--
+-- Name: before_update_server_trigger; Type: TRIGGER; Schema: public; Owner: traffic_ops
+--
+DROP TRIGGER IF EXISTS before_update_server_trigger ON server;
+CREATE TRIGGER before_update_server_trigger
+ BEFORE UPDATE ON server
+ FOR EACH ROW WHEN (NEW.profile <> OLD.profile)
+ EXECUTE PROCEDURE before_server_table();
+
+--
+-- Name: before_create_server_trigger; Type: TRIGGER; Schema: public; Owner: traffic_ops
+--
+DROP TRIGGER IF EXISTS before_create_server_trigger ON server;
+CREATE TRIGGER before_create_server_trigger
+ BEFORE INSERT ON server
+ FOR EACH ROW EXECUTE PROCEDURE before_server_table();
+
ALTER TABLE server OWNER TO traffic_ops;
--
+-- Name: server_capability; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS server_capability (
+ name TEXT PRIMARY KEY,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT name_empty CHECK (length(name) > 0)
+);
+
+--
+-- Name: server_server_capability; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS server_server_capability (
+ server_capability TEXT NOT NULL,
+ server bigint NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL,
+
+ PRIMARY KEY (server, server_capability)
+);
+
+--
+-- Name: service_category; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS service_category (
+ name TEXT PRIMARY KEY CHECK (name <> ''),
+ last_updated TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
+);
+--
-- Name: server_id_seq; Type: SEQUENCE; Schema: public; Owner: traffic_ops
--
@@ -1284,8 +1539,9 @@ ALTER SEQUENCE servercheck_id_seq OWNED BY servercheck.id;
CREATE TABLE IF NOT EXISTS snapshot (
cdn text NOT NULL,
- content json NOT NULL,
+ crconfig json NOT NULL,
last_updated timestamp with time zone NOT NULL DEFAULT now(),
+ monitoring json NOT NULL,
CONSTRAINT snapshot_pkey PRIMARY KEY (cdn)
);
@@ -1534,6 +1790,41 @@ ALTER TABLE to_extension_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE to_extension_id_seq OWNED BY to_extension.id;
+--
+-- Name: toplogy; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS topology (
+ name text PRIMARY KEY,
+ description text NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+--
+-- Name: topology_cachegroup; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS topology_cachegroup (
+ id BIGSERIAL PRIMARY KEY,
+ topology text NOT NULL,
+ cachegroup text NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT unique_topology_cachegroup UNIQUE (topology, cachegroup)
+);
+
+--
+-- Name: topology_cachegroup_parents; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS topology_cachegroup_parents (
+ child bigint NOT NULL,
+ parent bigint NOT NULL,
+ rank integer NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT topology_cachegroup_parents_rank_check CHECK (rank = 1 OR rank = 2),
+ CONSTRAINT unique_child_rank UNIQUE (child, rank),
+ CONSTRAINT unique_child_parent UNIQUE (child, parent)
+);
--
-- Name: type; Type: TABLE; Schema: public; Owner: traffic_ops
@@ -2216,24 +2507,6 @@ IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'server' AN
CREATE INDEX IF NOT EXISTS idx_89709_fk_server_cachegroup1 ON server USING btree (cachegroup);
END IF;
-IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'server' AND column_name = 'ip6_address')
- AND EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'server' AND column_name = 'profile') THEN
- --
- -- Name: idx_89709_ip6_profile; Type: INDEX; Schema: public; Owner: traffic_ops
- --
-
- CREATE UNIQUE INDEX IF NOT EXISTS idx_89709_ip6_profile ON server USING btree (ip6_address, profile);
-END IF;
-
-IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'server' AND column_name = 'ip_address')
- AND EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'server' AND column_name = 'profile') THEN
- --
- -- Name: idx_89709_ip_profile; Type: INDEX; Schema: public; Owner: traffic_ops
- --
-
- CREATE UNIQUE INDEX IF NOT EXISTS idx_89709_ip_profile ON server USING btree (ip_address, profile);
-END IF;
-
IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'server' AND column_name = 'id') THEN
--
-- Name: idx_89709_se_id_unique; Type: INDEX; Schema: public; Owner: traffic_ops
@@ -2301,6 +2574,46 @@ IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'staticdnse
CREATE INDEX IF NOT EXISTS idx_89729_fk_staticdnsentry_type ON staticdnsentry USING btree (type);
END IF;
+IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'topology_cachegroup' AND column_name = 'cachegroup') THEN
+ --
+ -- Name: topology_cachegroup_cachegroup_fkey; Type: INDEX; Schema: public; Owner: traffic_ops
+ --
+
+ CREATE INDEX IF NOT EXISTS topology_cachegroup_cachegroup_fkey ON topology_cachegroup USING btree (cachegroup);
+END IF;
+
+IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'topology_cachegroup' AND column_name = 'topology') THEN
+ --
+ -- Name: topology_cachegroup_topology_fkey; Type: INDEX; Schema: public; Owner: traffic_ops
+ --
+
+ CREATE INDEX IF NOT EXISTS topology_cachegroup_topology_fkey ON topology_cachegroup USING btree (topology);
+END IF;
+
+IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'topology_cachegroup_parents' AND column_name = 'child') THEN
+ --
+ -- Name: topology_cachegroup_parents_child_fkey; Type: INDEX; Schema: public; Owner: traffic_ops
+ --
+
+ CREATE INDEX IF NOT EXISTS topology_cachegroup_parents_child_fkey ON topology_cachegroup_parents USING btree (child);
+END IF;
+
+IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'topology_cachegroup_parents' AND column_name = 'parent') THEN
+ --
+ -- Name: topology_cachegroup_parents_parents_fkey; Type: INDEX; Schema: public; Owner: traffic_ops
+ --
+
+ CREATE INDEX IF NOT EXISTS topology_cachegroup_parents_parents_fkey ON topology_cachegroup_parents USING btree (parent);
+END IF;
+
+IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'deliveryservice' AND column_name = 'topology') THEN
+ --
+ -- Name: deliveryservice_topology_fkey; Type: INDEX; Schema: public; Owner: traffic_ops
+ --
+
+ CREATE INDEX IF NOT EXISTS deliveryservice_topology_fkey ON deliveryservice USING btree (topology);
+END IF;
+
IF EXISTS (SELECT FROM information_schema.columns WHERE table_name = 'tenant' AND column_name = 'parent_id') THEN
--
-- Name: idx_k_tenant_parent_tenant_idx; Type: INDEX; Schema: public; Owner: traffic_ops
@@ -2424,6 +2737,121 @@ END IF;
END$$;
+DO $$
+ DECLARE table_names VARCHAR[] := CAST(ARRAY[
+ 'api_capability',
+ 'asn',
+ 'cachegroup',
+ 'cachegroup_fallbacks',
+ 'cachegroup_localization_method',
+ 'cachegroup_parameter',
+ 'capability',
+ 'cdn',
+ 'coordinate',
+ 'deliveryservice',
+ 'deliveryservice_regex',
+ 'deliveryservice_request',
+ 'deliveryservice_request_comment',
+ 'deliveryservice_server',
+ 'deliveryservice_tmuser',
+ 'deliveryservices_required_capability',
+ 'division',
+ 'federation',
+ 'federation_deliveryservice',
+ 'federation_federation_resolver',
+ 'federation_resolver',
+ 'federation_tmuser',
+ 'hwinfo',
+ 'job',
+ 'job_agent',
+ 'job_status',
+ 'log',
+ 'origin',
+ 'parameter',
+ 'phys_location',
+ 'profile',
+ 'profile_parameter',
+ 'regex',
+ 'region',
+ 'role',
+ 'role_capability',
+ 'server',
+ 'server_capability',
+ 'server_server_capability',
+ 'servercheck',
+ 'service_category',
+ 'snapshot',
+ 'staticdnsentry',
+ 'stats_summary',
+ 'status',
+ 'steering_target',
+ 'tenant',
+ 'tm_user',
+ 'to_extension',
+ 'topology',
+ 'topology_cachegroup',
+ 'topology_cachegroup_parents',
+ 'type',
+ 'user_role'
+ ] AS VARCHAR[]);
+ table_name TEXT;
+ trigger_name TEXT := 'on_delete_current_timestamp';
+ trigger_exists BOOLEAN;
+
+BEGIN
+ FOREACH table_name IN ARRAY table_names
+ LOOP
+ EXECUTE FORMAT('SELECT EXISTS (
+ SELECT
+ FROM pg_catalog.pg_trigger
+ WHERE tgname = ''%s''
+ AND tgrelid = CAST(''%s'' AS REGCLASS))
+ ',
+ QUOTE_IDENT(trigger_name),
+ QUOTE_IDENT(table_name)) INTO trigger_exists;
+ IF NOT trigger_exists
+ THEN
+ EXECUTE FORMAT('
+ CREATE TRIGGER %s
+ AFTER DELETE ON %s
+ FOR EACH ROW
+ EXECUTE PROCEDURE %s_last_updated(''%s'');
+ ',
+ QUOTE_IDENT(trigger_name),
+ QUOTE_IDENT(table_name),
+ QUOTE_IDENT(trigger_name),
+ QUOTE_IDENT(table_name)
+ );
+ END IF;
+ IF table_name = 'topology' THEN
+ EXECUTE FORMAT('
+ CREATE INDEX IF NOT EXISTS %s_last_updated_idx
+ ON %s_cachegroup (last_updated DESC NULLS LAST);
+ ',
+ QUOTE_IDENT(table_name),
+ QUOTE_IDENT(table_name)
+ );
+ ELSIF table_name = 'phys_location' THEN
+ EXECUTE FORMAT('
+ CREATE INDEX IF NOT EXISTS pys_location_last_updated_idx
+ ON %s (last_updated DESC NULLS LAST);
+ ',
+ QUOTE_IDENT(table_name)
+ );
+
+ ELSIF NOT (table_name = 'stats_summary' OR table_name = 'cachegroup_fallbacks' OR table_name = 'cachegroup_localization_method')THEN
+ EXECUTE FORMAT('
+ CREATE INDEX IF NOT EXISTS %s_last_updated_idx
+ ON %s (last_updated DESC NULLS LAST);
+ ',
+ QUOTE_IDENT(table_name),
+ QUOTE_IDENT(table_name)
+ );
+ END IF;
+ END LOOP;
+END
+$$;
+
--
-- Add on_update_current_timestamp TRIGGER to all tables
--
@@ -2471,6 +2899,9 @@ DECLARE
'steering_target',
'tenant',
'tm_user',
+ 'topology',
+ 'topology_cachegroup',
+ 'topology_cachegroup_parents',
'type',
'user_role'
] AS VARCHAR[]);
@@ -2515,6 +2946,123 @@ IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint
ADD CONSTRAINT fk_atsprofile_atsparameters_atsparameters1 FOREIGN KEY (parameter) REFERENCES parameter(id) ON DELETE CASCADE;
END IF;
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'deliveryservice_service_category_fkey' AND table_name = 'deliveryservice') THEN
+ --
+ -- Name: deliveryservice_service_category_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY deliveryservice
+ ADD CONSTRAINT deliveryservice_service_category_fkey FOREIGN KEY (service_category) REFERENCES service_category(name) ON UPDATE CASCADE;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'ip_address_server_fkey' AND table_name = 'ip_address') THEN
+ --
+ -- Name: ip_address_server_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY ip_address
+ ADD CONSTRAINT ip_address_server_fkey FOREIGN KEY (interface, server) REFERENCES interface(name, server) ON DELETE CASCADE ON UPDATE CASCADE;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'ip_address_interface_fkey' AND table_name = 'ip_address') THEN
+ --
+ -- Name: ip_address_interface_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY ip_address
+ ADD CONSTRAINT ip_address_interface_fkey FOREIGN KEY (server) REFERENCES server(id) ON DELETE CASCADE ON UPDATE CASCADE;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'topology_cachegroup_cachegroup_fkey' AND table_name = 'topology_cachegroup') THEN
+ --
+ -- Name: topology_cachegroup_cachegroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY topology_cachegroup
+ ADD CONSTRAINT topology_cachegroup_cachegroup_fkey FOREIGN KEY (cachegroup) REFERENCES cachegroup(name) ON UPDATE CASCADE ON DELETE RESTRICT;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'topology_cachegroup_topology_fkey' AND table_name = 'topology_cachegroup') THEN
+ --
+ -- Name: topology_cachegroup_topology_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY topology_cachegroup
+ ADD CONSTRAINT topology_cachegroup_topology_fkey FOREIGN KEY (topology) REFERENCES topology(name) ON UPDATE CASCADE ON DELETE CASCADE;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'topology_cachegroup_parents_child_fkey' AND table_name = 'topology_cachegroup_parents') THEN
+ --
+ -- Name: topology_cachegroup_parents_child_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY topology_cachegroup_parents
+ ADD CONSTRAINT topology_cachegroup_parents_child_fkey FOREIGN KEY (child) REFERENCES topology_cachegroup(id) ON UPDATE CASCADE ON DELETE CASCADE;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'topology_cachegroup_parents_parent_fkey' AND table_name = 'topology_cachegroup_parents') THEN
+ --
+ -- Name: topology_cachegroup_parents_parent_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY topology_cachegroup_parents
+ ADD CONSTRAINT topology_cachegroup_parents_parent_fkey FOREIGN KEY (parent) REFERENCES topology_cachegroup(id) ON UPDATE CASCADE ON DELETE CASCADE;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'fk_deliveryservice_id' AND table_name = 'deliveryservices_required_capability') THEN
+ --
+ -- Name: fk_deliveryservice_id; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY deliveryservices_required_capability
+ ADD CONSTRAINT fk_deliveryservice_id FOREIGN KEY (deliveryservice_id) REFERENCES deliveryservice(id) ON DELETE CASCADE;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'fk_required_capability' AND table_name = 'deliveryservices_required_capability') THEN
+ --
+ -- Name: fk_required_capability; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY deliveryservices_required_capability
+ ADD CONSTRAINT fk_required_capability FOREIGN KEY (required_capability) REFERENCES server_capability(name) ON DELETE RESTRICT;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'deliveryservice_topology_fkey' AND table_name = 'deliveryservice') THEN
+ --
+ -- Name: deliveryservice_topology_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY deliveryservice
+ ADD CONSTRAINT deliveryservice_topology_fkey FOREIGN KEY (topology) REFERENCES topology (name) ON UPDATE CASCADE ON DELETE RESTRICT;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'fk_server' AND table_name = 'server_server_capability') THEN
+ --
+ -- Name: fk_server; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY server_server_capability
+ ADD CONSTRAINT fk_server FOREIGN KEY (server) REFERENCES server(id) ON DELETE CASCADE;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'fk_server_capability' AND table_name = 'server_server_capability') THEN
+ --
+ -- Name: fk_server_capability; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE ONLY server_server_capability
+ ADD CONSTRAINT fk_server_capability FOREIGN KEY (server_capability) REFERENCES server_capability(name) ON DELETE RESTRICT;
+END IF;
+
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'fk_deliveryservice' AND table_name = 'deliveryservice_consistent_hash_query_param') THEN
+ --
+ -- Name: fk_deliveryservice; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE deliveryservice_consistent_hash_query_param
+ ADD CONSTRAINT fk_deliveryservice FOREIGN KEY (deliveryservice_id) REFERENCES deliveryservice(id) ON DELETE CASCADE;
+END IF;
+
IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'fk_atsprofile_atsparameters_atsprofile1' AND table_name = 'profile_parameter') THEN
--
-- Name: fk_atsprofile_atsparameters_atsprofile1; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
@@ -2767,6 +3315,15 @@ IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint
ADD CONSTRAINT fk_hwinfo1 FOREIGN KEY (serverid) REFERENCES server(id) ON DELETE CASCADE;
END IF;
+IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'interface_server_fkey' AND table_name = 'interface') THEN
+ --
+ -- Name: interface_server_fkey; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+ --
+
+ ALTER TABLE interface
+ ADD CONSTRAINT interface_server_fkey FOREIGN KEY (server) REFERENCES server(id) ON DELETE CASCADE ON UPDATE CASCADE;
+END IF;
+
IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE constraint_name = 'fk_job_agent_id1' AND table_name = 'job') THEN
--
-- Name: fk_job_agent_id1; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
diff --git a/traffic_ops/app/db/migrations/20181206000000_create_monitor_snapshots.sql b/traffic_ops/app/db/migrations/20181206000000_create_monitor_snapshots.sql
deleted file mode 100644
index 1c49033..0000000
--- a/traffic_ops/app/db/migrations/20181206000000_create_monitor_snapshots.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
--- snapshots
-ALTER TABLE snapshot ADD COLUMN monitoring json;
-UPDATE snapshot SET monitoring = '{}';
-ALTER TABLE snapshot ALTER COLUMN monitoring SET NOT NULL;
-ALTER TABLE snapshot RENAME content TO crconfig;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE snapshot DROP COLUMN monitoring;
-ALTER TABLE snapshot RENAME crconfig TO content;
diff --git a/traffic_ops/app/db/migrations/20190219000000_add_consistent_hash_regex.sql b/traffic_ops/app/db/migrations/20190219000000_add_consistent_hash_regex.sql
deleted file mode 100644
index 2833868..0000000
--- a/traffic_ops/app/db/migrations/20190219000000_add_consistent_hash_regex.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE deliveryservice ADD COLUMN consistent_hash_regex text;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice DROP COLUMN consistent_hash_regex;
diff --git a/traffic_ops/app/db/migrations/20190319000000_add_max_origin_connections.sql b/traffic_ops/app/db/migrations/20190319000000_add_max_origin_connections.sql
deleted file mode 100644
index c7f4de3..0000000
--- a/traffic_ops/app/db/migrations/20190319000000_add_max_origin_connections.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE deliveryservice ADD COLUMN max_origin_connections bigint NOT NULL DEFAULT 0 CHECK (max_origin_connections >= 0);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice DROP COLUMN max_origin_connections;
diff --git a/traffic_ops/app/db/migrations/20190513000000_add-allowed_query_keys.sql b/traffic_ops/app/db/migrations/20190513000000_add-allowed_query_keys.sql
deleted file mode 100644
index 8388d3e..0000000
--- a/traffic_ops/app/db/migrations/20190513000000_add-allowed_query_keys.sql
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
--- deliveryservice_consistent_hash_query_param
-CREATE TABLE IF NOT EXISTS deliveryservice_consistent_hash_query_param (
- name TEXT NOT NULL,
- deliveryservice_id bigint NOT NULL,
-
- CONSTRAINT name_empty CHECK (length(name) > 0),
- CONSTRAINT name_reserved CHECK (name NOT IN ('format','trred')),
- CONSTRAINT fk_deliveryservice FOREIGN KEY (deliveryservice_id) REFERENCES deliveryservice(id) ON DELETE CASCADE,
- PRIMARY KEY (name, deliveryservice_id)
-);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE IF EXISTS deliveryservice_consistent_hash_query_param;
diff --git a/traffic_ops/app/db/migrations/20191004000000_add_server_capabilities.sql b/traffic_ops/app/db/migrations/20191004000000_add_server_capabilities.sql
deleted file mode 100644
index 224c177..0000000
--- a/traffic_ops/app/db/migrations/20191004000000_add_server_capabilities.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TABLE IF NOT EXISTS server_capability (
- name TEXT PRIMARY KEY,
- last_updated timestamp with time zone DEFAULT now() NOT NULL,
- CONSTRAINT name_empty CHECK (length(name) > 0)
-);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE IF EXISTS server_capability;
diff --git a/traffic_ops/app/db/migrations/20191005000000_add_server_server_capability.sql b/traffic_ops/app/db/migrations/20191005000000_add_server_server_capability.sql
deleted file mode 100644
index 5bf411a..0000000
--- a/traffic_ops/app/db/migrations/20191005000000_add_server_server_capability.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TABLE IF NOT EXISTS server_server_capability (
- server_capability TEXT NOT NULL,
- server bigint NOT NULL,
- last_updated timestamp with time zone DEFAULT now() NOT NULL,
-
- PRIMARY KEY (server, server_capability),
- CONSTRAINT fk_server FOREIGN KEY (server) REFERENCES server(id) ON DELETE CASCADE,
- CONSTRAINT fk_server_capability FOREIGN KEY (server_capability) REFERENCES server_capability(name) ON DELETE RESTRICT
-);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE IF EXISTS server_server_capability;
diff --git a/traffic_ops/app/db/migrations/20191024000000_add_deliveryservices_required_capability.sql b/traffic_ops/app/db/migrations/20191024000000_add_deliveryservices_required_capability.sql
deleted file mode 100644
index 4eeee19..0000000
--- a/traffic_ops/app/db/migrations/20191024000000_add_deliveryservices_required_capability.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TABLE IF NOT EXISTS deliveryservices_required_capability (
- required_capability TEXT NOT NULL,
- deliveryservice_id bigint NOT NULL,
- last_updated timestamp with time zone DEFAULT now() NOT NULL,
-
- PRIMARY KEY (deliveryservice_id, required_capability),
- CONSTRAINT fk_deliveryservice_id FOREIGN KEY (deliveryservice_id) REFERENCES deliveryservice(id) ON DELETE CASCADE,
- CONSTRAINT fk_required_capability FOREIGN KEY (required_capability) REFERENCES server_capability(name) ON DELETE RESTRICT
-);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE IF EXISTS deliveryservices_required_capability;
diff --git a/traffic_ops/app/db/migrations/20191215000000_add_ecs_enabled.sql b/traffic_ops/app/db/migrations/20191215000000_add_ecs_enabled.sql
deleted file mode 100644
index 142239d..0000000
--- a/traffic_ops/app/db/migrations/20191215000000_add_ecs_enabled.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE deliveryservice ADD COLUMN ecs_enabled boolean NOT NULL DEFAULT false;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice DROP COLUMN ecs_enabled;
diff --git a/traffic_ops/app/db/migrations/20200218000000_add_dns_challenges.sql b/traffic_ops/app/db/migrations/20200218000000_add_dns_challenges.sql
deleted file mode 100644
index e89b7e8..0000000
--- a/traffic_ops/app/db/migrations/20200218000000_add_dns_challenges.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
--- dnschallenges
-CREATE TABLE IF NOT EXISTS dnschallenges (
- fqdn text NOT NULL,
- record text NOT NULL
-);
-ALTER TABLE dnschallenges OWNER TO traffic_ops;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE IF EXISTS dnschallenges;
diff --git a/traffic_ops/app/db/migrations/20200227000000_add_ds_slice_block_size.sql b/traffic_ops/app/db/migrations/20200227000000_add_ds_slice_block_size.sql
deleted file mode 100644
index 361536b..0000000
--- a/traffic_ops/app/db/migrations/20200227000000_add_ds_slice_block_size.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE deliveryservice
-ADD COLUMN range_slice_block_size integer
-CHECK (range_slice_block_size >= 262144 AND range_slice_block_size <= 33554432)
-DEFAULT NULL;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice DROP COLUMN range_slice_block_size;
diff --git a/traffic_ops/app/db/migrations/20200313000000_add_server_ip_toggles.sql b/traffic_ops/app/db/migrations/20200313000000_add_server_ip_toggles.sql
deleted file mode 100644
index c543fbb..0000000
--- a/traffic_ops/app/db/migrations/20200313000000_add_server_ip_toggles.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE server ADD COLUMN ip_address_is_service boolean DEFAULT true;
-ALTER TABLE server ADD COLUMN ip6_address_is_service boolean DEFAULT true;
-ALTER TABLE server ALTER COLUMN ip_address DROP NOT NULL;
-ALTER TABLE server ALTER COLUMN ip_netmask DROP NOT NULL;
-ALTER TABLE server ALTER COLUMN ip_gateway DROP NOT NULL;
-ALTER TABLE server ADD CONSTRAINT need_at_least_one_ip CHECK (ip_address IS NOT NULL OR ip6_address IS NOT NULL OR ip_address = '' OR ip6_address = '');
-ALTER TABLE server ADD CONSTRAINT need_gateway_if_ip CHECK (ip_address IS NULL OR ip_address = '' OR ip_gateway IS NOT NULL);
-ALTER TABLE server ADD CONSTRAINT need_netmask_if_ip CHECK (ip_address IS NULL OR ip_address = '' OR ip_netmask IS NOT NULL);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE server DROP COLUMN ip_address_is_service;
-ALTER TABLE server DROP COLUMN ip6_address_is_service;
-ALTER TABLE server ALTER COLUMN ip_address SET NOT NULL;
-ALTER TABLE server ALTER COLUMN ip_netmask SET NOT NULL;
-ALTER TABLE server ALTER COLUMN ip_gateway SET NOT NULL;
-ALTER TABLE server DROP CONSTRAINT need_at_least_one_ip;
-ALTER TABLE server DROP CONSTRAINT need_gateway_if_ip;
-ALTER TABLE server DROP CONSTRAINT need_netmask_if_ip;
diff --git a/traffic_ops/app/db/migrations/20200408000000_add_lets_encrypt_account_info.sql b/traffic_ops/app/db/migrations/20200408000000_add_lets_encrypt_account_info.sql
deleted file mode 100644
index b579810..0000000
--- a/traffic_ops/app/db/migrations/20200408000000_add_lets_encrypt_account_info.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
--- lets_encrypt_account
-CREATE TABLE IF NOT EXISTS lets_encrypt_account (
- email text NOT NULL,
- private_key text NOT NULL,
- uri text NOT NULL,
- PRIMARY KEY (email)
-);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE IF EXISTS lets_encrypt_account;
diff --git a/traffic_ops/app/db/migrations/20200422101648_create_topology_tables.sql b/traffic_ops/app/db/migrations/20200422101648_create_topology_tables.sql
deleted file mode 100644
index f3c1f60..0000000
--- a/traffic_ops/app/db/migrations/20200422101648_create_topology_tables.sql
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-CREATE TABLE topology (
- name text PRIMARY KEY,
- description text NOT NULL,
- last_updated timestamp with time zone DEFAULT now() NOT NULL
-);
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON topology;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON topology FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-CREATE TABLE topology_cachegroup (
- id BIGSERIAL PRIMARY KEY,
- topology text NOT NULL,
- cachegroup text NOT NULL,
- last_updated timestamp with time zone DEFAULT now() NOT NULL,
- CONSTRAINT topology_cachegroup_cachegroup_fkey FOREIGN KEY (cachegroup) REFERENCES cachegroup(name) ON UPDATE CASCADE ON DELETE RESTRICT,
- CONSTRAINT topology_cachegroup_topology_fkey FOREIGN KEY (topology) REFERENCES topology(name) ON UPDATE CASCADE ON DELETE CASCADE,
- CONSTRAINT unique_topology_cachegroup UNIQUE (topology, cachegroup)
-);
-CREATE INDEX topology_cachegroup_cachegroup_fkey ON topology_cachegroup USING btree (cachegroup);
-CREATE INDEX topology_cachegroup_topology_fkey ON topology_cachegroup USING btree (topology);
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON topology_cachegroup;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON topology_cachegroup FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-CREATE TABLE topology_cachegroup_parents (
- child bigint NOT NULL,
- parent bigint NOT NULL,
- rank integer NOT NULL,
- last_updated timestamp with time zone DEFAULT now() NOT NULL,
- CONSTRAINT topology_cachegroup_parents_rank_check CHECK (rank = 1 OR rank = 2),
- CONSTRAINT topology_cachegroup_parents_child_fkey FOREIGN KEY (child) REFERENCES topology_cachegroup(id) ON UPDATE CASCADE ON DELETE CASCADE,
- CONSTRAINT topology_cachegroup_parents_parent_fkey FOREIGN KEY (parent) REFERENCES topology_cachegroup(id) ON UPDATE CASCADE ON DELETE CASCADE,
- CONSTRAINT unique_child_rank UNIQUE (child, rank),
- CONSTRAINT unique_child_parent UNIQUE (child, parent)
-);
-CREATE INDEX topology_cachegroup_parents_child_fkey ON topology_cachegroup_parents USING btree (child);
-CREATE INDEX topology_cachegroup_parents_parents_fkey ON topology_cachegroup_parents USING btree (parent);
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON topology_cachegroup_parents;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON topology_cachegroup_parents FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-ALTER TABLE deliveryservice
- ADD COLUMN topology text,
- ADD CONSTRAINT deliveryservice_topology_fkey FOREIGN KEY (topology) REFERENCES topology (name) ON UPDATE CASCADE ON DELETE RESTRICT;
-CREATE INDEX deliveryservice_topology_fkey ON deliveryservice USING btree (topology);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice DROP COLUMN topology;
-DROP TABLE topology_cachegroup_parents;
-DROP TABLE topology_cachegroup;
-DROP TABLE topology;
diff --git a/traffic_ops/app/db/migrations/20200507000000_interfaces.sql b/traffic_ops/app/db/migrations/20200507000000_interfaces.sql
deleted file mode 100644
index 6cfbee1..0000000
--- a/traffic_ops/app/db/migrations/20200507000000_interfaces.sql
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
-CREATE TABLE interface (
- max_bandwidth bigint DEFAULT NULL CHECK (max_bandwidth IS NULL OR max_bandwidth >= 0),
- monitor boolean NOT NULL,
- mtu bigint DEFAULT 1500 CHECK (mtu IS NULL OR mtu > 1280),
- name text NOT NULL CHECK (name != ''),
- server bigint NOT NULL,
- PRIMARY KEY (name, server),
- FOREIGN KEY (server) REFERENCES server(id) ON DELETE RESTRICT ON UPDATE CASCADE
-);
-CREATE TABLE ip_address (
- address inet NOT NULL,
- gateway inet CHECK (
- gateway IS NULL OR (
- family(gateway) = 4 AND
- masklen(gateway) = 32
- ) OR (
- family(gateway) = 6 AND
- masklen(gateway) = 128
- )
- ),
- interface text NOT NULL,
- server bigint NOT NULL,
- service_address boolean NOT NULL DEFAULT FALSE,
- PRIMARY KEY (address, interface, server),
- FOREIGN KEY (server) REFERENCES server(id) ON DELETE RESTRICT ON UPDATE CASCADE,
- FOREIGN KEY (interface, server) REFERENCES interface(name, server) ON DELETE RESTRICT ON UPDATE CASCADE
-);
-
-CREATE TYPE server_ip_address AS (address inet, gateway inet, service_address boolean);
-CREATE TYPE server_interface AS (ip_addresses server_ip_address ARRAY, max_bandwidth bigint, monitor boolean, mtu bigint, name text);
-
-INSERT INTO interface(
- max_bandwidth,
- monitor,
- mtu,
- name,
- server
-)
-SELECT NULL, TRUE, server.interface_mtu::bigint, server.interface_name, id
-FROM server;
-
-INSERT INTO ip_address(
- address,
- gateway,
- interface,
- server,
- service_address
-)
-SELECT
- set_masklen(
- server.ip_address::inet,
- CASE
- WHEN server.ip_netmask IS NULL THEN 32
- WHEN server.ip_netmask = '' THEN 32
- ELSE
- (SELECT SUM(
- get_bit(digit, 0) +
- get_bit(digit, 1) +
- get_bit(digit, 2) +
- get_bit(digit, 3) +
- get_bit(digit, 4) +
- get_bit(digit, 5) +
- get_bit(digit, 6) +
- get_bit(digit, 7)
- )::int FROM (
- SELECT regexp_split_to_table::int::bit(8) AS digit
- FROM regexp_split_to_table(server.ip_netmask, '\.')
- ) AS digits)
- END
- ),
- NULLIF(regexp_replace(server.ip_gateway, '/\d+$', ''), '')::inet,
- server.interface_name,
- server.id,
- server.ip_address_is_service
-FROM server
-WHERE server.ip_address IS NOT NULL
-AND server.ip_address != '';
-
-INSERT INTO ip_address(
- address,
- gateway,
- interface,
- server,
- service_address
-)
-SELECT
- trim(BOTH '[]' FROM server.ip6_address)::inet,
- NULLIF(regexp_replace(server.ip6_gateway, '/\d+$', ''), '')::inet,
- server.interface_name,
- server.id,
- server.ip6_address_is_service
-FROM server
-WHERE server.ip6_address IS NOT NULL
-AND server.ip6_address != '';
-
--- +goose Down
-DROP TABLE IF EXISTS ip_address;
-DROP TABLE IF EXISTS interface;
-
-DROP TYPE IF EXISTS server_interface;
-DROP TYPE IF EXISTS server_ip_address;
diff --git a/traffic_ops/app/db/migrations/2020061622101648_add_new_header_rewrite.sql b/traffic_ops/app/db/migrations/2020061622101648_add_new_header_rewrite.sql
deleted file mode 100644
index 556a59b..0000000
--- a/traffic_ops/app/db/migrations/2020061622101648_add_new_header_rewrite.sql
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-ALTER TABLE deliveryservice
- ADD COLUMN first_header_rewrite text,
- ADD COLUMN inner_header_rewrite text,
- ADD COLUMN last_header_rewrite text;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE deliveryservice
- DROP COLUMN first_header_rewrite,
- DROP COLUMN inner_header_rewrite,
- DROP COLUMN last_header_rewrite;
diff --git a/traffic_ops/app/db/migrations/2020062923101648_add_deleted_tables.sql b/traffic_ops/app/db/migrations/2020062923101648_add_deleted_tables.sql
deleted file mode 100644
index 4f15b05..0000000
--- a/traffic_ops/app/db/migrations/2020062923101648_add_deleted_tables.sql
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
--- last_deleted
-CREATE TABLE IF NOT EXISTS last_deleted (
- table_name text NOT NULL PRIMARY KEY,
- last_updated timestamp with time zone NOT NULL DEFAULT now()
-);
-
--- +goose StatementBegin
--- SQL in section 'Up' is executed when this migration is applied
---
--- Name: on_delete_current_timestamp_last_updated(); Type: FUNCTION; Schema: public; Owner: traffic_ops
---
-CREATE OR REPLACE FUNCTION public.on_delete_current_timestamp_last_updated()
- RETURNS trigger
- AS $$
-BEGIN
- update last_deleted set last_updated = now() where table_name = TG_ARGV[0];
- RETURN NEW;
-END;
-$$
-LANGUAGE plpgsql;
--- +goose StatementEnd
-
-ALTER FUNCTION public.on_delete_current_timestamp_last_updated() OWNER TO traffic_ops;
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON api_capability
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('api_capability');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON asn
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('asn');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON cachegroup
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('cachegroup');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON cachegroup_fallbacks
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('cachegroup_fallbacks');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON cachegroup_localization_method
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('cachegroup_localization_method');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON cachegroup_parameter
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('cachegroup_parameter');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON capability
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('capability');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON cdn
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('cdn');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON coordinate
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('coordinate');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON deliveryservice
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('deliveryservice');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON deliveryservice_regex
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('deliveryservice_regex');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON deliveryservice_request
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('deliveryservice_request');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON deliveryservice_request_comment
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('deliveryservice_request_comment');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON deliveryservice_server
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('deliveryservice_server');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON deliveryservice_tmuser
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('deliveryservice_tmuser');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON division
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('division');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON federation
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('federation');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON federation_deliveryservice
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('federation_deliveryservice');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON federation_federation_resolver
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('federation_federation_resolver');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON federation_resolver
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('federation_resolver');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON federation_tmuser
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('federation_tmuser');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON hwinfo
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('hwinfo');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON job
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('job');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON job_agent
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('job_agent');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON job_status
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('job_status');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON log
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('log');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON origin
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('origin');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON parameter
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('parameter');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON phys_location
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('phys_location');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON profile
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('profile');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON profile_parameter
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('profile_parameter');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON regex
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('regex');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON region
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('region');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON role
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('role');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON role_capability
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('role_capability');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON server
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('server');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON servercheck
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('servercheck');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON snapshot
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('snapshot');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON staticdnsentry
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('staticdnsentry');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON stats_summary
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('stats_summary');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON status
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('status');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON steering_target
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('steering_target');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON tenant
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('tenant');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON tm_user
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('tm_user');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON to_extension
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('to_extension');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON topology
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('topology');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON topology_cachegroup
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('topology_cachegroup');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON topology_cachegroup_parents
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('topology_cachegroup_parents');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON type
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('type');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON user_role
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('user_role');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON server_capability
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('server_capability');
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON server_server_capability
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('server_server_capability');
-
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON deliveryservices_required_capability
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('deliveryservices_required_capability');
-
-create index api_capability_last_updated_idx on api_capability (last_updated DESC NULLS LAST);
-create index asn_last_updated_idx on asn (last_updated DESC NULLS LAST);
-create index cachegroup_last_updated_idx on cachegroup (last_updated DESC NULLS LAST);
-create index cachegroup_parameter_last_updated_idx on cachegroup_parameter (last_updated DESC NULLS LAST);
-create index capability_last_updated_idx on capability (last_updated DESC NULLS LAST);
-create index cdn_last_updated_idx on cdn (last_updated DESC NULLS LAST);
-create index coordinate_last_updated_idx on coordinate (last_updated DESC NULLS LAST);
-create index deliveryservice_last_updated_idx on deliveryservice (last_updated DESC NULLS LAST);
-create index deliveryservice_regex_last_updated_idx on deliveryservice_regex (last_updated DESC NULLS LAST);
-create index deliveryservice_request_last_updated_idx on deliveryservice_request (last_updated DESC NULLS LAST);
-create index deliveryservice_request_comment_last_updated_idx on deliveryservice_request_comment (last_updated DESC NULLS LAST);
-create index deliveryservice_server_last_updated_idx on deliveryservice_server (last_updated DESC NULLS LAST);
-create index deliveryservice_tmuser_last_updated_idx on deliveryservice_tmuser (last_updated DESC NULLS LAST);
-create index division_last_updated_idx on division (last_updated DESC NULLS LAST);
-create index federation_last_updated_idx on federation (last_updated DESC NULLS LAST);
-create index federation_deliveryservice_last_updated_idx on federation_deliveryservice (last_updated DESC NULLS LAST);
-create index federation_federation_resolver_last_updated_idx on federation_federation_resolver (last_updated DESC NULLS LAST);
-create index federation_resolver_last_updated_idx on federation_resolver (last_updated DESC NULLS LAST);
-create index federation_tmuser_last_updated_idx on federation_tmuser (last_updated DESC NULLS LAST);
-create index hwinfo_last_updated_idx on hwinfo (last_updated DESC NULLS LAST);
-create index job_last_updated_idx on job (last_updated DESC NULLS LAST);
-create index job_agent_last_updated_idx on job_agent (last_updated DESC NULLS LAST);
-create index job_status_last_updated_idx on job_status (last_updated DESC NULLS LAST);
-create index log_last_updated_idx on log (last_updated DESC NULLS LAST);
-create index origin_last_updated_idx on origin (last_updated DESC NULLS LAST);
-create index parameter_last_updated_idx on parameter (last_updated DESC NULLS LAST);
-create index pys_location_last_updated_idx on phys_location (last_updated DESC NULLS LAST);
-create index profile_last_updated_idx on profile (last_updated DESC NULLS LAST);
-create index profile_parameter_last_updated_idx on profile_parameter (last_updated DESC NULLS LAST);
-create index regex_last_updated_idx on regex (last_updated DESC NULLS LAST);
-create index region_last_updated_idx on region (last_updated DESC NULLS LAST);
-create index role_last_updated_idx on role (last_updated DESC NULLS LAST);
-create index role_capability_last_updated_idx on role_capability (last_updated DESC NULLS LAST);
-create index server_last_updated_idx on server (last_updated DESC NULLS LAST);
-create index servercheck_last_updated_idx on servercheck (last_updated DESC NULLS LAST);
-create index snapshot_last_updated_idx on snapshot (last_updated DESC NULLS LAST);
-create index staticdnsentry_last_updated_idx on staticdnsentry (last_updated DESC NULLS LAST);
-create index status_last_updated_idx on status (last_updated DESC NULLS LAST);
-create index steering_target_last_updated_idx on steering_target (last_updated DESC NULLS LAST);
-create index tenant_last_updated_idx on tenant (last_updated DESC NULLS LAST);
-create index tm_user_last_updated_idx on tm_user (last_updated DESC NULLS LAST);
-create index to_extension_last_updated_idx on to_extension (last_updated DESC NULLS LAST);
-create index topology_last_updated_idx on topology_cachegroup (last_updated DESC NULLS LAST);
-create index topology_cachegroup_last_updated_idx on topology_cachegroup (last_updated DESC NULLS LAST);
-create index topology_cachegroup_parents_last_updated_idx on topology_cachegroup_parents (last_updated DESC NULLS LAST);
-create index type_last_updated_idx on type (last_updated DESC NULLS LAST);
-create index user_role_last_updated_idx on user_role (last_updated DESC NULLS LAST);
-create index server_capability_last_updated_idx on server_capability (last_updated DESC NULLS LAST);
-create index server_server_capability_last_updated_idx on server_server_capability (last_updated DESC NULLS LAST);
-create index deliveryservices_required_capability_last_updated_idx on deliveryservices_required_capability (last_updated DESC NULLS LAST);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE IF EXISTS last_deleted;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on api_capability;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on asn;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on cachegroup;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on cachegroup_fallbacks;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on cachegroup_localization_method;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on cachegroup_parameter;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on capability;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on cdn;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on coordinate;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on deliveryservice;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on deliveryservice_regex;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on deliveryservice_request;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on deliveryservice_request_comment;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on deliveryservice_server;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on deliveryservice_tmuser;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on division;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on federation;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on federation_deliveryservice;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on federation_federation_resolver;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on federation_resolver;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on federation_tmuser;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on hwinfo;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on job;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on job_agent;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on job_status;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on log;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on origin;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on parameter;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on phys_location;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on profile;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on profile_parameter;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on regex;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on region;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on role;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on role_capability;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on server;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on servercheck;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on snapshot;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on staticdnsentry;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on stats_summary;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on status;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on steering_target;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on tenant;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on tm_user;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on topology;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on topology_cachegroup;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on topology_cachegroup_parents;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on to_extension;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on type;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on user_role;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on server_capability;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on server_server_capability;
-DROP TRIGGER IF EXISTS on_delete_current_timestamp on deliveryservices_required_capability;
-
-DROP INDEX IF EXISTS api_capability_last_updated_idx;
-DROP INDEX IF EXISTS asn_last_updated_idx;
-DROP INDEX IF EXISTS cachegroup_last_updated_idx;
-DROP INDEX IF EXISTS cachegroup_parameter_last_updated_idx;
-DROP INDEX IF EXISTS capability_last_updated_idx;
-DROP INDEX IF EXISTS cdn_last_updated_idx;
-DROP INDEX IF EXISTS coordinate_last_updated_idx;
-DROP INDEX IF EXISTS deliveryservice_last_updated_idx;
-DROP INDEX IF EXISTS deliveryservice_regex_last_updated_idx;
-DROP INDEX IF EXISTS deliveryservice_request_last_updated_idx;
-DROP INDEX IF EXISTS deliveryservice_request_comment_last_updated_idx;
-DROP INDEX IF EXISTS deliveryservice_server_last_updated_idx;
-DROP INDEX IF EXISTS deliveryservice_tmuser_last_updated_idx;
-DROP INDEX IF EXISTS division_last_updated_idx;
-DROP INDEX IF EXISTS federation_last_updated_idx;
-DROP INDEX IF EXISTS federation_deliveryservice_last_updated_idx;
-DROP INDEX IF EXISTS federation_federation_resolver_last_updated_idx;
-DROP INDEX IF EXISTS federation_resolver_last_updated_idx;
-DROP INDEX IF EXISTS federation_tmuser_last_updated_idx;
-DROP INDEX IF EXISTS hwinfo_last_updated_idx;
-DROP INDEX IF EXISTS job_last_updated_idx;
-DROP INDEX IF EXISTS job_agent_last_updated_idx;
-DROP INDEX IF EXISTS job_status_last_updated_idx;
-DROP INDEX IF EXISTS log_last_updated_idx;
-DROP INDEX IF EXISTS origin_last_updated_idx;
-DROP INDEX IF EXISTS parameter_last_updated_idx;
-DROP INDEX IF EXISTS pys_location_last_updated_idx;
-DROP INDEX IF EXISTS profile_last_updated_idx;
-DROP INDEX IF EXISTS profile_parameter_last_updated_idx;
-DROP INDEX IF EXISTS regex_last_updated_idx;
-DROP INDEX IF EXISTS region_last_updated_idx;
-DROP INDEX IF EXISTS role_last_updated_idx;
-DROP INDEX IF EXISTS role_capability_last_updated_idx;
-DROP INDEX IF EXISTS server_last_updated_idx;
-DROP INDEX IF EXISTS servercheck_last_updated_idx;
-DROP INDEX IF EXISTS snapshot_last_updated_idx;
-DROP INDEX IF EXISTS staticdnsentry_last_updated_idx;
-DROP INDEX IF EXISTS status_last_updated_idx;
-DROP INDEX IF EXISTS steering_target_last_updated_idx;
-DROP INDEX IF EXISTS tenant_last_updated_idx;
-DROP INDEX IF EXISTS tm_user_last_updated_idx;
-DROP INDEX IF EXISTS to_extension_last_updated_idx;
-DROP INDEX IF EXISTS topology_last_updated_idx;
-DROP INDEX IF EXISTS topology_cachegroup_last_updated_idx;
-DROP INDEX IF EXISTS topology_cachegroup_parents_last_updated_idx;
-DROP INDEX IF EXISTS type_last_updated_idx;
-DROP INDEX IF EXISTS user_role_last_updated_idx;
-DROP INDEX IF EXISTS server_capability_last_updated_idx;
-DROP INDEX IF EXISTS server_server_capability_last_updated_idx;
-DROP INDEX IF EXISTS deliveryservices_required_capability_last_updated_idx;
\ No newline at end of file
diff --git a/traffic_ops/app/db/migrations/2020072700000000_remove_redundancy.sql b/traffic_ops/app/db/migrations/2020072700000000_remove_redundancy.sql
deleted file mode 100644
index bc39d63..0000000
--- a/traffic_ops/app/db/migrations/2020072700000000_remove_redundancy.sql
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
-ALTER TABLE server DROP CONSTRAINT need_at_least_one_ip;
-ALTER TABLE server DROP CONSTRAINT need_gateway_if_ip;
-ALTER TABLE server DROP CONSTRAINT need_netmask_if_ip;
-
-ALTER TABLE server DROP COLUMN interface_name;
-ALTER TABLE server DROP COLUMN ip_address;
-ALTER TABLE server DROP COLUMN ip_netmask;
-ALTER TABLE server DROP COLUMN ip_gateway;
-ALTER TABLE server DROP COLUMN ip6_address;
-ALTER TABLE server DROP COLUMN ip6_gateway;
-ALTER TABLE server DROP COLUMN interface_mtu;
-ALTER TABLE server DROP COLUMN ip_address_is_service;
-ALTER TABLE server DROP COLUMN ip6_address_is_service;
-
-
--- +goose Down
-ALTER TABLE server ADD COLUMN interface_name text DEFAULT '' NOT NULL;
-ALTER TABLE server ADD COLUMN ip_address text DEFAULT '';
-ALTER TABLE server ADD COLUMN ip_netmask text DEFAULT '';
-ALTER TABLE server ADD COLUMN ip_gateway text DEFAULT '';
-ALTER TABLE server ADD COLUMN ip6_address text DEFAULT '';
-ALTER TABLE server ADD COLUMN ip6_gateway text DEFAULT '';
-ALTER TABLE server ADD COLUMN interface_mtu bigint DEFAULT '9000'::bigint NOT NULL;
-ALTER TABLE server ADD COLUMN ip_address_is_service boolean DEFAULT true;
-ALTER TABLE server ADD COLUMN ip6_address_is_service boolean DEFAULT true;
-
-ALTER TABLE server ADD CONSTRAINT need_at_least_one_ip CHECK (ip_address IS NOT NULL OR ip6_address IS NOT NULL OR ip_address = '' OR ip6_address = '');
-ALTER TABLE server ADD CONSTRAINT need_gateway_if_ip CHECK (ip_address IS NULL OR ip_address = '' OR ip_gateway IS NOT NULL);
-ALTER TABLE server ADD CONSTRAINT need_netmask_if_ip CHECK (ip_address IS NULL OR ip_address = '' OR ip_netmask IS NOT NULL);
-
-UPDATE server SET ip_address = host(ip_address.address),
- ip_netmask = COALESCE(host(netmask(ip_address.address)), ''),
- ip_gateway = COALESCE(host(ip_address.gateway), ''),
- ip_address_is_service = ip_address.service_address,
- interface_name = ip_address.interface,
- interface_mtu = COALESCE(interface.mtu, 0)
- FROM ip_address
- JOIN interface ON ip_address.interface = interface.name
- WHERE server.id = ip_address.server
- AND family(ip_address.address) = 4
- AND ip_address.service_address;
-
-UPDATE server SET ip6_address = ip_address.address,
- ip6_gateway = ip_address.gateway,
- ip6_address_is_service = ip_address.service_address
- FROM ip_address
- WHERE server.id = ip_address.server
- AND family(ip_address.address) = 6
- AND ip_address.service_address;
diff --git a/traffic_ops/app/db/migrations/2020081000000000_add_deliveryservice_service_category.sql b/traffic_ops/app/db/migrations/2020081000000000_add_deliveryservice_service_category.sql
deleted file mode 100644
index d47bbe8..0000000
--- a/traffic_ops/app/db/migrations/2020081000000000_add_deliveryservice_service_category.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-CREATE TABLE IF NOT EXISTS service_category (
- name TEXT PRIMARY KEY CHECK (name <> ''),
- tenant_id BIGINT NOT NULL REFERENCES tenant(id),
- last_updated TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL
-);
-ALTER TABLE deliveryservice ADD COLUMN service_category TEXT REFERENCES service_category(name) ON UPDATE CASCADE;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice DROP COLUMN service_category;
-DROP TABLE service_category;
diff --git a/traffic_ops/app/db/migrations/2020081108261100_add_server_ip_profile_trigger.sql b/traffic_ops/app/db/migrations/2020081108261100_add_server_ip_profile_trigger.sql
deleted file mode 100644
index 43c0f2d..0000000
--- a/traffic_ops/app/db/migrations/2020081108261100_add_server_ip_profile_trigger.sql
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
--- +goose StatementBegin
-CREATE OR REPLACE FUNCTION before_server_table()
- RETURNS TRIGGER AS
-$$
-DECLARE
- server_count BIGINT;
-BEGIN
- WITH server_ips AS (
- SELECT s.id, i.name, ip.address, s.profile
- FROM server s
- JOIN interface i on i.server = s.ID
- JOIN ip_address ip on ip.Server = s.ID and ip.interface = i.name
- WHERE i.monitor = true
- )
- SELECT count(*)
- INTO server_count
- FROM server_ips sip
- JOIN server_ips sip2 on sip.id <> sip2.id
- WHERE sip.id = NEW.id
- AND sip2.address = sip.address
- AND sip2.profile = sip.profile;
-
- IF server_count > 0 THEN
- RAISE EXCEPTION 'Server [id:%] does not have a unique ip_address over the profile [id:%], [%] conflicts',
- NEW.id,
- NEW.profile,
- server_count;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE plpgsql;
--- +goose StatementEnd
-
--- +goose StatementBegin
-CREATE OR REPLACE FUNCTION before_ip_address_table()
- RETURNS TRIGGER
-AS
-$$
-DECLARE
- server_count BIGINT;
- server_id BIGINT;
- server_profile BIGINT;
-BEGIN
- WITH server_ips AS (
- SELECT s.id as sid, ip.interface, i.name, ip.address, s.profile, ip.server
- FROM server s
- JOIN interface i
- on i.server = s.ID
- JOIN ip_address ip
- on ip.Server = s.ID and ip.interface = i.name
- WHERE i.monitor = true
- )
- SELECT count(sip.sid), sip.sid, sip.profile
- INTO server_count, server_id, server_profile
- FROM server_ips sip
- JOIN server_ips sip2 on sip.sid <> sip2.sid
- WHERE (sip.server = NEW.server AND sip.address = NEW.address AND sip.interface = NEW.interface)
- AND sip2.address = sip.address
- AND sip2.profile = sip.profile
- GROUP BY sip.sid, sip.profile;
-
- IF server_count > 0 THEN
- RAISE EXCEPTION 'ip_address is not unique accross the server [id:%] profile [id:%], [%] conflicts',
- server_id,
- server_profile,
- server_count;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
--- +goose StatementEnd
-
-CREATE TRIGGER before_update_server_trigger
- BEFORE UPDATE
- ON server
- FOR EACH ROW
- WHEN (NEW.profile <> OLD.profile)
-EXECUTE PROCEDURE before_server_table();
-
-CREATE TRIGGER before_create_server_trigger
- BEFORE INSERT
- ON server
- FOR EACH ROW
-EXECUTE PROCEDURE before_server_table();
-
-CREATE TRIGGER before_create_ip_address_trigger
- BEFORE INSERT
- ON ip_address
- FOR EACH ROW
-EXECUTE PROCEDURE before_ip_address_table();
-
-CREATE TRIGGER before_update_ip_address_trigger
- BEFORE UPDATE
- ON ip_address
- FOR EACH ROW
- WHEN (NEW.address <> OLD.address)
-EXECUTE PROCEDURE before_ip_address_table();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TRIGGER IF EXISTS before_update_server_trigger ON server;
-DROP TRIGGER IF EXISTS before_create_server_trigger ON server;
-DROP TRIGGER IF EXISTS before_update_ip_address_trigger ON ip_address;
-DROP TRIGGER IF EXISTS before_create_ip_address_trigger ON ip_address;
-
-DROP FUNCTION IF EXISTS before_server_table();
-DROP FUNCTION IF EXISTS before_ip_address_table();
-
diff --git a/traffic_ops/app/db/migrations/2020082000000000_add_server_status_last_updated.sql b/traffic_ops/app/db/migrations/2020082000000000_add_server_status_last_updated.sql
deleted file mode 100644
index c2f1b7e..0000000
--- a/traffic_ops/app/db/migrations/2020082000000000_add_server_status_last_updated.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-ALTER TABLE server
- ADD COLUMN status_last_updated timestamp with time zone;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE server
- DROP COLUMN status_last_updated;
diff --git a/traffic_ops/app/db/migrations/2020082700000000_server_id_primary_key.sql b/traffic_ops/app/db/migrations/2020082700000000_server_id_primary_key.sql
deleted file mode 100644
index 7581a11..0000000
--- a/traffic_ops/app/db/migrations/2020082700000000_server_id_primary_key.sql
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
--- +goose StatementBegin
-DO $$
-DECLARE r record;
-BEGIN
- FOR r IN (SELECT indexname FROM pg_indexes WHERE tablename = 'server' AND indexname LIKE '%primary%')
- LOOP
- EXECUTE 'ALTER TABLE server DROP CONSTRAINT IF EXISTS '|| quote_ident(r.indexname) || ';';
- END LOOP;
- EXECUTE 'ALTER TABLE ONLY server ADD CONSTRAINT '|| quote_ident(r.indexname) || ' PRIMARY KEY (id);';
-END
-$$ LANGUAGE plpgsql;
--- +goose StatementEnd
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
--- +goose StatementBegin
-DO $$
-DECLARE r record;
-BEGIN
- FOR r IN (SELECT indexname FROM pg_indexes WHERE tablename = 'server' AND indexname LIKE '%primary%')
- LOOP
- EXECUTE 'ALTER TABLE server DROP CONSTRAINT IF EXISTS '|| quote_ident(r.indexname) || ';';
- END LOOP;
- EXECUTE 'ALTER TABLE ONLY server ADD CONSTRAINT '|| quote_ident(r.indexname) || ' PRIMARY KEY (id, cachegroup, type, status, profile);';
-END
-$$ LANGUAGE plpgsql;
--- +goose StatementEnd
diff --git a/traffic_ops/app/db/migrations/2020103000000000_remove_service_category_tenancy.sql b/traffic_ops/app/db/migrations/2020103000000000_remove_service_category_tenancy.sql
deleted file mode 100644
index 1b854a7..0000000
--- a/traffic_ops/app/db/migrations/2020103000000000_remove_service_category_tenancy.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE IF EXISTS service_category DROP COLUMN tenant_id;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE service_category ADD COLUMN tenant_id BIGINT REFERENCES tenant(id);
diff --git a/traffic_ops/app/db/migrations/2020110200000000_add_service_category_deleted.sql b/traffic_ops/app/db/migrations/2020110200000000_add_service_category_deleted.sql
deleted file mode 100644
index 1c1dda5..0000000
--- a/traffic_ops/app/db/migrations/2020110200000000_add_service_category_deleted.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE
-ON service_category
-FOR EACH ROW EXECUTE PROCEDURE on_delete_current_timestamp_last_updated('service_category');
-
-CREATE INDEX service_category_last_updated_idx ON service_category (last_updated DESC NULLS LAST);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-DROP INDEX IF EXISTS service_category_last_updated_idx;
-
-DROP TRIGGER IF EXISTS on_delete_current_timestamp ON service_category;
diff --git a/traffic_ops/app/db/migrations/2021010900000000_server_ip_profile_trigger_update.sql b/traffic_ops/app/db/migrations/2021010900000000_server_ip_profile_trigger_update.sql
deleted file mode 100644
index 35cc584..0000000
--- a/traffic_ops/app/db/migrations/2021010900000000_server_ip_profile_trigger_update.sql
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
-DROP TRIGGER IF EXISTS before_update_ip_address_trigger ON ip_address;
-DROP TRIGGER IF EXISTS before_create_ip_address_trigger ON ip_address;
--- +goose StatementBegin
-CREATE OR REPLACE FUNCTION before_ip_address_table()
- RETURNS TRIGGER
-AS
-$$
-DECLARE
- server_count BIGINT;
- server_id BIGINT;
- server_profile BIGINT;
-BEGIN
- WITH server_ips AS (
- SELECT s.id as sid, ip.interface, i.name, ip.address, s.profile, ip.server
- FROM server s
- JOIN interface i
- on i.server = s.ID
- JOIN ip_address ip
- on ip.Server = s.ID and ip.interface = i.name
- WHERE ip.service_address = true
- )
- SELECT count(distinct(sip.sid)), sip.sid, sip.profile
- INTO server_count, server_id, server_profile
- FROM server_ips sip
- WHERE (sip.server <> NEW.server AND (SELECT host(sip.address)) = (SELECT host(NEW.address)) AND sip.profile = (SELECT profile from server s WHERE s.id = NEW.server))
- GROUP BY sip.sid, sip.profile;
-
- IF server_count > 0 THEN
- RAISE EXCEPTION 'ip_address is not unique across the server [id:%] profile [id:%], [%] conflicts',
- server_id,
- server_profile,
- server_count;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
--- +goose StatementEnd
-
-CREATE TRIGGER before_create_ip_address_trigger
- BEFORE INSERT
- ON ip_address
- FOR EACH ROW
-EXECUTE PROCEDURE before_ip_address_table();
-
-CREATE TRIGGER before_update_ip_address_trigger
- BEFORE UPDATE
- ON ip_address
- FOR EACH ROW
- WHEN (NEW.address <> OLD.address)
-EXECUTE PROCEDURE before_ip_address_table();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TRIGGER IF EXISTS before_update_ip_address_trigger ON ip_address;
-DROP TRIGGER IF EXISTS before_create_ip_address_trigger ON ip_address;
-
-DROP FUNCTION IF EXISTS before_ip_address_table();
-
--- +goose StatementBegin
-CREATE OR REPLACE FUNCTION before_ip_address_table()
- RETURNS TRIGGER
-AS
-$$
-DECLARE
- server_count BIGINT;
- server_id BIGINT;
- server_profile BIGINT;
-BEGIN
- WITH server_ips AS (
- SELECT s.id as sid, ip.interface, i.name, ip.address, s.profile, ip.server
- FROM server s
- JOIN interface i
- on i.server = s.ID
- JOIN ip_address ip
- on ip.Server = s.ID and ip.interface = i.name
- WHERE i.monitor = true
- )
- SELECT count(sip.sid), sip.sid, sip.profile
- INTO server_count, server_id, server_profile
- FROM server_ips sip
- JOIN server_ips sip2 on sip.sid <> sip2.sid
- WHERE (sip.server = NEW.server AND sip.address = NEW.address AND sip.interface = NEW.interface)
- AND sip2.address = sip.address
- AND sip2.profile = sip.profile
- GROUP BY sip.sid, sip.profile;
-
- IF server_count > 0 THEN
- RAISE EXCEPTION 'ip_address is not unique across the server [id:%] profile [id:%], [%] conflicts',
- server_id,
- server_profile,
- server_count;
- END IF;
- RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
--- +goose StatementEnd
-
-CREATE TRIGGER before_create_ip_address_trigger
- BEFORE INSERT
- ON ip_address
- FOR EACH ROW
-EXECUTE PROCEDURE before_ip_address_table();
-
-CREATE TRIGGER before_update_ip_address_trigger
- BEFORE UPDATE
- ON ip_address
- FOR EACH ROW
- WHEN (NEW.address <> OLD.address)
-EXECUTE PROCEDURE before_ip_address_table();
diff --git a/traffic_ops/app/db/migrations/2021010900000001_move_lets_encrypt_to_acme.sql b/traffic_ops/app/db/migrations/2021010900000001_move_lets_encrypt_to_acme.sql
deleted file mode 100644
index b28ed46..0000000
--- a/traffic_ops/app/db/migrations/2021010900000001_move_lets_encrypt_to_acme.sql
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TABLE IF NOT EXISTS acme_account (
- email text NOT NULL,
- private_key text NOT NULL,
- provider text NOT NULL,
- uri text NOT NULL,
- PRIMARY KEY (email, provider)
-);
-
-INSERT INTO acme_account(
- email,
- private_key,
- provider,
- uri
-)
-SELECT
- lets_encrypt_account.email,
- lets_encrypt_account.private_key,
- 'Lets Encrypt',
- lets_encrypt_account.uri
-FROM lets_encrypt_account;
-
-DROP TABLE IF EXISTS lets_encrypt_account;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-CREATE TABLE IF NOT EXISTS lets_encrypt_account (
- email text NOT NULL,
- private_key text NOT NULL,
- uri text NOT NULL,
- PRIMARY KEY (email)
-);
-
-INSERT INTO lets_encrypt_account(
- email,
- private_key,
- uri
-)
-SELECT
- acme_account.email,
- acme_account.private_key,
- acme_account.uri
-FROM acme_account WHERE acme_account.provider = 'Lets Encrypt';
-
-DROP TABLE IF EXISTS acme_account;
diff --git a/traffic_ops/app/db/migrations/2021010900000002_add_max_request_header_size_delivery_service.sql b/traffic_ops/app/db/migrations/2021010900000002_add_max_request_header_size_delivery_service.sql
deleted file mode 100644
index 69b39cd..0000000
--- a/traffic_ops/app/db/migrations/2021010900000002_add_max_request_header_size_delivery_service.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE deliveryservice ADD COLUMN max_request_header_bytes int NOT NULL DEFAULT 131072;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice DROP COLUMN max_request_header_bytes;
diff --git a/traffic_ops/app/db/migrations/2021010900000003_server_interface_ip_address_cascade.sql b/traffic_ops/app/db/migrations/2021010900000003_server_interface_ip_address_cascade.sql
deleted file mode 100644
index 503a0bd..0000000
--- a/traffic_ops/app/db/migrations/2021010900000003_server_interface_ip_address_cascade.sql
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE interface
- DROP CONSTRAINT interface_server_fkey,
- ADD CONSTRAINT interface_server_fkey FOREIGN KEY (server) REFERENCES server(id) ON DELETE CASCADE ON UPDATE CASCADE;
-
--- +goose StatementBegin
-DO $$
-BEGIN
- IF EXISTS(
- SELECT conname
- FROM pg_constraint
- WHERE conrelid = (
- SELECT oid
- FROM pg_class
- WHERE relname LIKE 'ip_address'
- ) AND conname = 'ip_address_interface_server_fkey'
- ) THEN
- ALTER TABLE ip_address
- RENAME CONSTRAINT ip_address_interface_server_fkey TO ip_address_interface_fkey;
- END IF;
-END
-$$ LANGUAGE plpgsql;
--- +goose StatementEnd
-
-ALTER TABLE ip_address
- DROP CONSTRAINT ip_address_interface_fkey,
- ADD CONSTRAINT ip_address_interface_fkey FOREIGN KEY (server) REFERENCES server(id) ON DELETE CASCADE ON UPDATE CASCADE,
- DROP CONSTRAINT ip_address_server_fkey,
- ADD CONSTRAINT ip_address_server_fkey FOREIGN KEY (interface, server) REFERENCES interface(name, server) ON DELETE CASCADE ON UPDATE CASCADE;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE interface
- DROP CONSTRAINT interface_server_fkey,
- ADD CONSTRAINT interface_server_fkey FOREIGN KEY (server) REFERENCES server(id) ON DELETE RESTRICT ON UPDATE CASCADE;
-
-ALTER TABLE ip_address
- DROP CONSTRAINT ip_address_interface_fkey,
- ADD CONSTRAINT ip_address_interface_fkey FOREIGN KEY (server) REFERENCES server(id) ON DELETE RESTRICT ON UPDATE CASCADE,
- DROP CONSTRAINT ip_address_server_fkey,
- ADD CONSTRAINT ip_address_server_fkey FOREIGN KEY (interface, server) REFERENCES interface(name, server) ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/traffic_ops/app/db/migrations/2021012200000000_max_request_header_bytes_default_zero.sql b/traffic_ops/app/db/migrations/2021012200000000_max_request_header_bytes_default_zero.sql
deleted file mode 100644
index 2fc8e5b..0000000
--- a/traffic_ops/app/db/migrations/2021012200000000_max_request_header_bytes_default_zero.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-UPDATE deliveryservice SET max_request_header_bytes = 0;
-ALTER TABLE deliveryservice ALTER COLUMN max_request_header_bytes SET DEFAULT 0;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice ALTER COLUMN max_request_header_bytes SET DEFAULT 131072;