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 ac091594de Squash db migration that have already been released (7.x.x)
(#7764)
ac091594de is described below
commit ac091594deed5d9582715a9c7ce430429003e820
Author: Rima Shah <[email protected]>
AuthorDate: Thu Sep 7 09:12:37 2023 -0600
Squash db migration that have already been released (7.x.x) (#7764)
* Redump create_tables.sql with migrations through timestamp
2022050916074300
* Redump create_tables.sql with migrations through timestamp
2022050916074300
* Remove migrations that existed at RELEASE-7.0.1
* updated files for DB migration
* removed changes specific to mac
* added changelog entry
* formatting
* formatting-1
* update create_tables file
* missing semicolon
* copy-paste table error
* adding a unique constraint for cdn lock
* addressed review comments.
* addressed review comments-1.
* addressed review comments-2.
* fixed roles
* spelling correction
* Removed extra added fields by migration script and reordered statuses in
seeds.sql
* added owner back for server
* added sed lines back
* updated first migration timestamp for failing tests
---
CHANGELOG.md | 1 +
traffic_ops/app/db/SQUASH.md | 5 +-
traffic_ops/app/db/create_tables.sql | 563 ++++++++++++++-------
...011112591400_added_cdni_capacity_table.down.sql | 23 -
...22011112591400_added_cdni_capacity_table.up.sql | 82 ---
...022020114365100_capacity_updates_queue.down.sql | 18 -
.../2022020114365100_capacity_updates_queue.up.sql | 28 -
...022021611354000_add_user_to_ucdn_table.down.sql | 18 -
.../2022021611354000_add_user_to_ucdn_table.up.sql | 18 -
.../2022022319353588_fix_dsr_geolimit.down.sql | 60 ---
.../2022022319353588_fix_dsr_geolimit.up.sql | 36 --
.../2022030308363540_add_dnssec_perms.down.sql | 23 -
.../2022030308363540_add_dnssec_perms.up.sql | 26 -
...00_assign_correct_permissions_to_roles.down.sql | 27 -
...0000_assign_correct_permissions_to_roles.up.sql | 27 -
...12431414_remove_unused_ds_tmuser_table.down.sql | 49 --
...1612431414_remove_unused_ds_tmuser_table.up.sql | 18 -
.../2022040623082100_server_config_update.down.sql | 28 -
.../2022040623082100_server_config_update.up.sql | 28 -
...2041410185700_add_server_profile_table.down.sql | 36 --
...022041410185700_add_server_profile_table.up.sql | 38 --
...42514493300_add_user_sharing_cdn_locks.down.sql | 20 -
...2042514493300_add_user_sharing_cdn_locks.up.sql | 27 -
...412200_cdni_capacity_limit_with_scopes.down.sql | 51 --
...10412200_cdni_capacity_limit_with_scopes.up.sql | 78 ---
...2022050916074300_add_reserved_statuses.down.sql | 17 -
.../2022050916074300_add_reserved_statuses.up.sql | 23 -
traffic_ops/app/db/seeds.sql | 27 +-
traffic_ops/app/db/squash_migrations.sh | 6 +-
traffic_ops_db/test/docker/run-db-test.sh | 2 +-
30 files changed, 422 insertions(+), 981 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ba39b32fb9..ad95ed6aea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -82,6 +82,7 @@ The format is based on [Keep a
Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7766](https://github.com/apache/trafficcontrol/pull/7766) *Traffic Portal*
now uses TO APIv5
### Fixed
+- [#7764](https://github.com/apache/trafficcontrol/pull/7764) *Traffic Ops*
Collapsed DB migrations
- [#7767](https://github.com/apache/trafficcontrol/pull/7767) *Traffic Ops*
Fixed ASN update logic for APIv5
- [RFC3339](https://github.com/apache/trafficcontrol/issues/5911)
- [#7759](https://github.com/apache/trafficcontrol/pull/7759) *Traffic
Ops* Fixed `/profiles/{{ID}}/parameters` and
`profiles/name/{{name}}/parameters` v5 APIs to respond with `RFC3339`
timestamps.
diff --git a/traffic_ops/app/db/SQUASH.md b/traffic_ops/app/db/SQUASH.md
index b1801f13e0..ec7ff52733 100644
--- a/traffic_ops/app/db/SQUASH.md
+++ b/traffic_ops/app/db/SQUASH.md
@@ -19,7 +19,7 @@ under the License.
# Squashing database migrations
-For convenience,
[`squash_migrations.sh`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/squash_migrations.sh)
script squashes the migrations, but whoever PRs the result is responsible for
verifying that the migrations are squashed and `LastSquashedMigrationVersion`
in
[`db/admin.go`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/admin.go)
is updated correctly, regardless of the result of having run the script.
+For convenience,
[`squash_migrations.sh`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/squash_migrations.sh)
script squashes the migrations, but whoever PRs the result is responsible for
verifying that the migrations are squashed, regardless of the result of having
run the script.
--------
@@ -43,8 +43,7 @@ And suppose the ATC
[`master`](https://github.com/apache/trafficcontrol/commits/
1. In order to prepare database migrations for the next major release, in this
case, ATC 148.0.0, migrations `1` and `3` should be collapsed into
`create_tables.sql` and migrations `4` and `9` should remain in
[`traffic_ops/app/db/migrations/`](https://github.com/apache/trafficcontrol/tree/master/traffic_ops/app/db/migrations/).
-2. * Note that `3` is the migration timestamp of the last up/down migration
set. Find the definition for `LastSquashedMigrationTimestamp` in
[`traffic_ops/app/db/admin.go`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/admin.go)
and change it to `3`.
- * After migrations from ATC 147.5.8 have been collapsed, the first
migration version will be `4`. Find the definition for
`FirstMigrationTimestamp` in
[`traffic_ops/app/db/admin.go`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/admin.go)
and change it to `4`.
+2. * After migrations from ATC 147.5.8 have been collapsed, the first
migration version will be `4`. Find the definition for
`FirstMigrationTimestamp` in
[`traffic_ops/app/db/admin.go`](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/app/db/admin.go)
and change it to `4`.
Past PRs that have collapsed the DB migrations:
- https://github.com/apache/trafficcontrol/pull/6065
diff --git a/traffic_ops/app/db/create_tables.sql
b/traffic_ops/app/db/create_tables.sql
index c3aa89a655..fa2c9b876f 100644
--- a/traffic_ops/app/db/create_tables.sql
+++ b/traffic_ops/app/db/create_tables.sql
@@ -17,8 +17,8 @@
-- PostgreSQL database dump
--
--- Dumped from database version 9.5.4
--- Dumped by pg_dump version 9.5.5
+-- Dumped from database version 13.12
+-- Dumped by pg_dump version 13.12
SET statement_timeout = 0;
SET lock_timeout = 0;
@@ -66,8 +66,8 @@ 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
+ 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(*)
@@ -132,7 +132,7 @@ 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()
+CREATE OR REPLACE FUNCTION on_delete_current_timestamp_last_updated()
RETURNS trigger
AS $$
BEGIN
@@ -142,7 +142,7 @@ END;
$$
LANGUAGE plpgsql;
-ALTER FUNCTION public.on_delete_current_timestamp_last_updated() OWNER TO
traffic_ops;
+ALTER FUNCTION on_delete_current_timestamp_last_updated() OWNER TO traffic_ops;
--
-- Name: update_ds_timestamp_on_insert(); Type: FUNCTION; Schema: public;
Owner: traffic_ops
@@ -348,7 +348,6 @@ CREATE TABLE IF NOT EXISTS asn (
CONSTRAINT idx_89468_primary PRIMARY KEY (id, cachegroup)
);
-
ALTER TABLE asn OWNER TO traffic_ops;
--
@@ -362,7 +361,6 @@ CREATE SEQUENCE IF NOT EXISTS asn_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE asn_id_seq OWNER TO traffic_ops;
--
@@ -398,7 +396,6 @@ CREATE SEQUENCE IF NOT EXISTS async_status_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE async_status_id_seq OWNER TO traffic_ops;
--
@@ -424,7 +421,6 @@ CREATE TABLE IF NOT EXISTS cachegroup (
CONSTRAINT idx_89476_primary PRIMARY KEY (id, type)
);
-
ALTER TABLE cachegroup OWNER TO traffic_ops;
--
@@ -482,7 +478,6 @@ CREATE TABLE IF NOT EXISTS cachegroup_parameter (
CONSTRAINT idx_89484_primary PRIMARY KEY (cachegroup, parameter)
);
-
ALTER TABLE cachegroup_parameter OWNER TO traffic_ops;
--
@@ -512,7 +507,6 @@ CREATE TABLE IF NOT EXISTS cdn (
CONSTRAINT idx_89491_primary PRIMARY KEY (id)
);
-
ALTER TABLE cdn OWNER TO traffic_ops;
--
@@ -526,7 +520,6 @@ CREATE SEQUENCE IF NOT EXISTS cdn_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE cdn_id_seq OWNER TO traffic_ops;
--
@@ -539,7 +532,7 @@ ALTER SEQUENCE cdn_id_seq OWNED BY cdn.id;
-- Name: cdn_lock; Type: TABLE; Schema: public; Owner: traffic_ops
--
-CREATE TABLE IF NOT EXISTS public.cdn_lock (
+CREATE TABLE IF NOT EXISTS cdn_lock (
username text NOT NULL,
cdn text NOT NULL,
message text,
@@ -548,7 +541,6 @@ CREATE TABLE IF NOT EXISTS public.cdn_lock (
CONSTRAINT pk_cdn_lock PRIMARY KEY ("cdn")
);
-
ALTER TABLE cdn_lock OWNER TO traffic_ops;
--
@@ -669,7 +661,6 @@ CREATE TABLE IF NOT EXISTS deliveryservice (
CONSTRAINT idx_89502_primary PRIMARY KEY (id, type)
);
-
ALTER TABLE deliveryservice OWNER TO traffic_ops;
--
@@ -689,11 +680,11 @@ CREATE TABLE IF NOT EXISTS
deliveryservices_required_capability (
--
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 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)
);
--
@@ -707,7 +698,6 @@ CREATE SEQUENCE IF NOT EXISTS deliveryservice_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE deliveryservice_id_seq OWNER TO traffic_ops;
--
@@ -716,7 +706,6 @@ ALTER TABLE deliveryservice_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE deliveryservice_id_seq OWNED BY deliveryservice.id;
-
--
-- Name: deliveryservice_regex; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -729,7 +718,6 @@ CREATE TABLE IF NOT EXISTS deliveryservice_regex (
CONSTRAINT idx_89517_primary PRIMARY KEY (deliveryservice, regex)
);
-
ALTER TABLE deliveryservice_regex OWNER TO traffic_ops;
--
@@ -798,7 +786,6 @@ CREATE TABLE IF NOT EXISTS deliveryservice_server (
CONSTRAINT idx_89521_primary PRIMARY KEY (deliveryservice, server)
);
-
ALTER TABLE deliveryservice_server OWNER TO traffic_ops;
--
@@ -830,20 +817,6 @@ CREATE TRIGGER update_ds_timestamp_on_tls_version_delete
AFTER DELETE ON deliveryservice_tls_version
FOR EACH ROW EXECUTE PROCEDURE update_ds_timestamp_on_delete();
---
--- Name: deliveryservice_tmuser; Type: TABLE; Schema: public; Owner:
traffic_ops
---
-
-CREATE TABLE IF NOT EXISTS deliveryservice_tmuser (
- deliveryservice bigint NOT NULL,
- tm_user_id bigint NOT NULL,
- last_updated timestamp with time zone NOT NULL DEFAULT now(),
- CONSTRAINT idx_89525_primary PRIMARY KEY (deliveryservice, tm_user_id)
-);
-
-
-ALTER TABLE deliveryservice_tmuser OWNER TO traffic_ops;
-
--
-- Name: division; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -855,7 +828,6 @@ CREATE TABLE IF NOT EXISTS division (
CONSTRAINT idx_89531_primary PRIMARY KEY (id)
);
-
ALTER TABLE division OWNER TO traffic_ops;
--
@@ -869,7 +841,6 @@ CREATE SEQUENCE IF NOT EXISTS division_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE division_id_seq OWNER TO traffic_ops;
--
@@ -901,7 +872,6 @@ CREATE TABLE IF NOT EXISTS federation (
CONSTRAINT idx_89541_primary PRIMARY KEY (id)
);
-
ALTER TABLE federation OWNER TO traffic_ops;
--
@@ -915,7 +885,6 @@ CREATE TABLE IF NOT EXISTS federation_deliveryservice (
CONSTRAINT idx_89549_primary PRIMARY KEY (federation, deliveryservice)
);
-
ALTER TABLE federation_deliveryservice OWNER TO traffic_ops;
--
@@ -929,7 +898,6 @@ CREATE TABLE IF NOT EXISTS federation_federation_resolver (
CONSTRAINT idx_89553_primary PRIMARY KEY (federation, federation_resolver)
);
-
ALTER TABLE federation_federation_resolver OWNER TO traffic_ops;
--
@@ -952,7 +920,6 @@ ALTER TABLE federation_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE federation_id_seq OWNED BY federation.id;
-
--
-- Name: federation_resolver; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -979,7 +946,6 @@ CREATE SEQUENCE IF NOT EXISTS federation_resolver_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE federation_resolver_id_seq OWNER TO traffic_ops;
--
@@ -1001,7 +967,6 @@ CREATE TABLE IF NOT EXISTS federation_tmuser (
CONSTRAINT idx_89567_primary PRIMARY KEY (federation, tm_user)
);
-
ALTER TABLE federation_tmuser OWNER TO traffic_ops;
--
@@ -1017,7 +982,6 @@ CREATE TABLE IF NOT EXISTS hwinfo (
CONSTRAINT idx_89583_primary PRIMARY KEY (id)
);
-
ALTER TABLE hwinfo OWNER TO traffic_ops;
--
@@ -1031,7 +995,6 @@ CREATE SEQUENCE IF NOT EXISTS hwinfo_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE hwinfo_id_seq OWNER TO traffic_ops;
--
@@ -1080,23 +1043,6 @@ CREATE TABLE IF NOT EXISTS ip_address (
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
--
@@ -1114,7 +1060,6 @@ CREATE TABLE IF NOT EXISTS job (
CONSTRAINT idx_89593_primary PRIMARY KEY (id)
);
-
ALTER TABLE job OWNER TO traffic_ops;
--
@@ -1128,7 +1073,6 @@ CREATE SEQUENCE IF NOT EXISTS job_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE job_id_seq OWNER TO traffic_ops;
--
@@ -1156,7 +1100,6 @@ CREATE TABLE IF NOT EXISTS log (
CONSTRAINT idx_89634_primary PRIMARY KEY (id, tm_user)
);
-
ALTER TABLE log OWNER TO traffic_ops;
--
@@ -1170,7 +1113,6 @@ CREATE SEQUENCE IF NOT EXISTS log_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE log_id_seq OWNER TO traffic_ops;
--
@@ -1241,7 +1183,6 @@ ALTER TABLE parameter_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE parameter_id_seq OWNED BY parameter.id;
-
--
-- Name: phys_location; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1263,7 +1204,6 @@ CREATE TABLE IF NOT EXISTS phys_location (
CONSTRAINT idx_89655_primary PRIMARY KEY (id)
);
-
ALTER TABLE phys_location OWNER TO traffic_ops;
--
@@ -1277,7 +1217,6 @@ CREATE SEQUENCE IF NOT EXISTS phys_location_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE phys_location_id_seq OWNER TO traffic_ops;
--
@@ -1301,7 +1240,6 @@ CREATE TABLE IF NOT EXISTS profile (
CONSTRAINT idx_89665_primary PRIMARY KEY (id)
);
-
ALTER TABLE profile OWNER TO traffic_ops;
--
@@ -1315,7 +1253,6 @@ CREATE SEQUENCE IF NOT EXISTS profile_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE profile_id_seq OWNER TO traffic_ops;
--
@@ -1324,7 +1261,6 @@ ALTER TABLE profile_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE profile_id_seq OWNED BY profile.id;
-
--
-- Name: profile_parameter; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1351,7 +1287,6 @@ CREATE TABLE IF NOT EXISTS regex (
CONSTRAINT idx_89679_primary PRIMARY KEY (id, type)
);
-
ALTER TABLE regex OWNER TO traffic_ops;
--
@@ -1365,7 +1300,6 @@ CREATE SEQUENCE IF NOT EXISTS regex_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE regex_id_seq OWNER TO traffic_ops;
--
@@ -1374,7 +1308,6 @@ ALTER TABLE regex_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE regex_id_seq OWNED BY regex.id;
-
--
-- Name: region; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1387,7 +1320,6 @@ CREATE TABLE IF NOT EXISTS region (
CONSTRAINT idx_89690_primary PRIMARY KEY (id)
);
-
ALTER TABLE region OWNER TO traffic_ops;
--
@@ -1401,7 +1333,6 @@ CREATE SEQUENCE IF NOT EXISTS region_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE region_id_seq OWNER TO traffic_ops;
--
@@ -1410,7 +1341,6 @@ ALTER TABLE region_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE region_id_seq OWNED BY region.id;
-
--
-- Name: role; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1425,7 +1355,6 @@ CREATE TABLE IF NOT EXISTS role (
CONSTRAINT idx_89700_primary PRIMARY KEY (id)
);
-
ALTER TABLE role OWNER TO traffic_ops;
--
@@ -1439,7 +1368,6 @@ CREATE SEQUENCE IF NOT EXISTS role_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE role_id_seq OWNER TO traffic_ops;
--
@@ -1478,7 +1406,6 @@ CREATE TABLE IF NOT EXISTS server (
type bigint NOT NULL,
status bigint NOT NULL,
offline_reason text,
- upd_pending boolean DEFAULT false NOT NULL,
profile bigint NOT NULL,
cdn_id bigint NOT NULL,
mgmt_ip_address text,
@@ -1492,29 +1419,14 @@ CREATE TABLE IF NOT EXISTS server (
guid text,
last_updated timestamp with time zone NOT NULL DEFAULT now(),
https_port bigint,
- reval_pending boolean NOT NULL DEFAULT FALSE,
status_last_updated timestamp with time zone,
+ config_update_time timestamp with time zone NOT NULL DEFAULT TIMESTAMP
'epoch',
+ config_apply_time timestamp with time zone NOT NULL DEFAULT TIMESTAMP
'epoch',
+ revalidate_update_time timestamp with time zone NOT NULL DEFAULT TIMESTAMP
'epoch',
+ revalidate_apply_time timestamp with time zone NOT NULL DEFAULT TIMESTAMP
'epoch',
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;
--
@@ -1547,6 +1459,7 @@ 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
--
@@ -1567,7 +1480,6 @@ ALTER TABLE server_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE server_id_seq OWNED BY server.id;
-
--
-- Name: servercheck; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1610,7 +1522,6 @@ CREATE TABLE IF NOT EXISTS servercheck (
CONSTRAINT idx_89722_primary PRIMARY KEY (id, server)
);
-
ALTER TABLE servercheck OWNER TO traffic_ops;
--
@@ -1624,7 +1535,6 @@ CREATE SEQUENCE IF NOT EXISTS servercheck_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE servercheck_id_seq OWNER TO traffic_ops;
--
@@ -1663,7 +1573,6 @@ CREATE TABLE IF NOT EXISTS staticdnsentry (
CONSTRAINT idx_89729_primary PRIMARY KEY (id)
);
-
ALTER TABLE staticdnsentry OWNER TO traffic_ops;
--
@@ -1677,7 +1586,6 @@ CREATE SEQUENCE IF NOT EXISTS staticdnsentry_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE staticdnsentry_id_seq OWNER TO traffic_ops;
--
@@ -1686,7 +1594,6 @@ ALTER TABLE staticdnsentry_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE staticdnsentry_id_seq OWNED BY staticdnsentry.id;
-
--
-- Name: stats_summary; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1702,7 +1609,6 @@ CREATE TABLE IF NOT EXISTS stats_summary (
CONSTRAINT idx_89740_primary PRIMARY KEY (id)
);
-
ALTER TABLE stats_summary OWNER TO traffic_ops;
--
@@ -1725,7 +1631,6 @@ ALTER TABLE stats_summary_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE stats_summary_id_seq OWNED BY stats_summary.id;
-
--
-- Name: status; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1739,7 +1644,6 @@ CREATE TABLE IF NOT EXISTS status (
CONSTRAINT idx_89751_primary PRIMARY KEY (id)
);
-
ALTER TABLE status OWNER TO traffic_ops;
--
@@ -1753,7 +1657,6 @@ CREATE SEQUENCE IF NOT EXISTS status_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE status_id_seq OWNER TO traffic_ops;
--
@@ -1762,7 +1665,6 @@ ALTER TABLE status_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE status_id_seq OWNED BY status.id;
-
--
-- Name: steering_target; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1776,7 +1678,6 @@ CREATE TABLE IF NOT EXISTS steering_target (
CONSTRAINT idx_89759_primary PRIMARY KEY (deliveryservice, target)
);
-
ALTER TABLE steering_target OWNER TO traffic_ops;
--
@@ -1821,10 +1722,10 @@ CREATE TABLE IF NOT EXISTS tm_user (
registration_sent timestamp with time zone,
tenant_id bigint NOT NULL,
last_authenticated timestamp with time zone,
+ ucdn text NOT NULL DEFAULT '',
CONSTRAINT idx_89765_primary PRIMARY KEY (id)
);
-
ALTER TABLE tm_user OWNER TO traffic_ops;
--
@@ -1838,7 +1739,6 @@ CREATE SEQUENCE IF NOT EXISTS tm_user_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE tm_user_id_seq OWNER TO traffic_ops;
--
@@ -1847,7 +1747,6 @@ ALTER TABLE tm_user_id_seq OWNER TO traffic_ops;
ALTER SEQUENCE tm_user_id_seq OWNED BY tm_user.id;
-
--
-- Name: to_extension; Type: TABLE; Schema: public; Owner: traffic_ops
--
@@ -1868,7 +1767,6 @@ CREATE TABLE IF NOT EXISTS to_extension (
CONSTRAINT idx_89776_primary PRIMARY KEY (id)
);
-
ALTER TABLE to_extension OWNER TO traffic_ops;
--
@@ -1882,7 +1780,6 @@ CREATE SEQUENCE IF NOT EXISTS to_extension_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE to_extension_id_seq OWNER TO traffic_ops;
--
@@ -1941,7 +1838,6 @@ CREATE TABLE IF NOT EXISTS type (
CONSTRAINT idx_89786_primary PRIMARY KEY (id)
);
-
ALTER TABLE type OWNER TO traffic_ops;
--
@@ -1955,7 +1851,6 @@ CREATE SEQUENCE IF NOT EXISTS type_id_seq
NO MAXVALUE
CACHE 1;
-
ALTER TABLE type_id_seq OWNER TO traffic_ops;
--
@@ -1992,14 +1887,12 @@ ALTER TABLE ONLY asn ALTER COLUMN id SET DEFAULT
nextval('asn_id_seq'::regclass)
ALTER TABLE ONLY async_status ALTER COLUMN id SET DEFAULT
nextval('async_status_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY cachegroup ALTER COLUMN id SET DEFAULT
nextval('cachegroup_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
@@ -2012,63 +1905,54 @@ ALTER TABLE ONLY cdn ALTER COLUMN id SET DEFAULT
nextval('cdn_id_seq'::regclass)
ALTER TABLE ONLY cdn_notification ALTER COLUMN id SET DEFAULT
nextval('cdn_notification_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY deliveryservice ALTER COLUMN id SET DEFAULT
nextval('deliveryservice_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY division ALTER COLUMN id SET DEFAULT
nextval('division_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY federation ALTER COLUMN id SET DEFAULT
nextval('federation_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY federation_resolver ALTER COLUMN id SET DEFAULT
nextval('federation_resolver_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY hwinfo ALTER COLUMN id SET DEFAULT
nextval('hwinfo_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY job ALTER COLUMN id SET DEFAULT
nextval('job_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY log ALTER COLUMN id SET DEFAULT
nextval('log_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY parameter ALTER COLUMN id SET DEFAULT
nextval('parameter_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
@@ -2082,77 +1966,66 @@ ALTER TABLE ONLY phys_location ALTER COLUMN id SET
DEFAULT nextval('phys_locatio
ALTER TABLE ONLY profile ALTER COLUMN id SET DEFAULT
nextval('profile_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY regex ALTER COLUMN id SET DEFAULT
nextval('regex_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY region ALTER COLUMN id SET DEFAULT
nextval('region_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY role ALTER COLUMN id SET DEFAULT
nextval('role_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY server ALTER COLUMN id SET DEFAULT
nextval('server_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY servercheck ALTER COLUMN id SET DEFAULT
nextval('servercheck_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY staticdnsentry ALTER COLUMN id SET DEFAULT
nextval('staticdnsentry_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY stats_summary ALTER COLUMN id SET DEFAULT
nextval('stats_summary_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY status ALTER COLUMN id SET DEFAULT
nextval('status_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY tm_user ALTER COLUMN id SET DEFAULT
nextval('tm_user_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
ALTER TABLE ONLY to_extension ALTER COLUMN id SET DEFAULT
nextval('to_extension_id_seq'::regclass);
-
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
--
@@ -2304,14 +2177,6 @@ IF EXISTS (SELECT FROM information_schema.columns WHERE
table_name = 'deliveryse
CREATE INDEX IF NOT EXISTS idx_89521_fk_ds_to_cs_contentserver1 ON
deliveryservice_server USING btree (server);
END IF;
-IF EXISTS (SELECT FROM information_schema.columns WHERE table_name =
'deliveryservice_tmuser' AND column_name = 'tm_user_id') THEN
- --
- -- Name: idx_89525_fk_tm_userid; Type: INDEX; Schema: public; Owner:
traffic_ops
- --
-
- CREATE INDEX IF NOT EXISTS idx_89525_fk_tm_userid ON
deliveryservice_tmuser USING btree (tm_user_id);
-END IF;
-
IF EXISTS (SELECT FROM information_schema.columns WHERE table_name =
'division' AND column_name = 'name') THEN
--
-- Name: idx_89531_name_unique; Type: INDEX; Schema: public; Owner:
traffic_ops
@@ -2832,7 +2697,6 @@ DO $$
'deliveryservice_request',
'deliveryservice_request_comment',
'deliveryservice_server',
- 'deliveryservice_tmuser',
'deliveryservices_required_capability',
'division',
'federation',
@@ -2948,7 +2812,6 @@ DECLARE
'deliveryservice_request',
'deliveryservice_request_comment',
'deliveryservice_server',
- 'deliveryservice_tmuser',
'division',
'federation',
'federation_deliveryservice',
@@ -3556,24 +3419,6 @@ IF NOT EXISTS (SELECT FROM
information_schema.table_constraints WHERE constraint
ADD CONSTRAINT fk_steering_target_target FOREIGN KEY (target)
REFERENCES deliveryservice(id) ON UPDATE CASCADE ON DELETE CASCADE;
END IF;
-IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE
constraint_name = 'fk_tm_user_ds' AND table_name = 'deliveryservice_tmuser')
THEN
- --
- -- Name: fk_tm_user_ds; Type: FK CONSTRAINT; Schema: public; Owner:
traffic_ops
- --
-
- ALTER TABLE ONLY deliveryservice_tmuser
- ADD CONSTRAINT fk_tm_user_ds FOREIGN KEY (deliveryservice) REFERENCES
deliveryservice(id) ON UPDATE CASCADE ON DELETE CASCADE;
-END IF;
-
-IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE
constraint_name = 'fk_tm_user_id' AND table_name = 'deliveryservice_tmuser')
THEN
- --
- -- Name: fk_tm_user_id; Type: FK CONSTRAINT; Schema: public; Owner:
traffic_ops
- --
-
- ALTER TABLE ONLY deliveryservice_tmuser
- ADD CONSTRAINT fk_tm_user_id FOREIGN KEY (tm_user_id) REFERENCES
tm_user(id) ON UPDATE CASCADE ON DELETE CASCADE;
-END IF;
-
IF NOT EXISTS (SELECT FROM information_schema.table_constraints WHERE
constraint_name = 'fk_user_1' AND table_name = 'tm_user') THEN
--
-- Name: fk_user_1; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
@@ -3811,6 +3656,378 @@ REVOKE ALL ON SCHEMA public FROM traffic_ops;
GRANT ALL ON SCHEMA public TO traffic_ops;
GRANT ALL ON SCHEMA public TO PUBLIC;
+--
+-- Name: cdni_capabilities; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE cdni_capabilities (
+ id bigint NOT NULL,
+ type text NOT NULL,
+ ucdn text NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+ALTER TABLE cdni_capabilities OWNER TO traffic_ops;
+
+--
+-- Name: cdni_capabilities_id_seq; Type: SEQUENCE; Schema: public; Owner:
traffic_ops
+--
+
+CREATE SEQUENCE cdni_capabilities_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER TABLE cdni_capabilities_id_seq OWNER TO traffic_ops;
+
+--
+-- Name: cdni_capabilities_id_seq; Type: SEQUENCE OWNED BY; Schema: public;
Owner: traffic_ops
+--
+
+ALTER SEQUENCE cdni_capabilities_id_seq OWNED BY cdni_capabilities.id;
+
+--
+-- Name: cdni_footprints; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE cdni_footprints (
+ id bigint NOT NULL,
+ footprint_type text NOT NULL,
+ footprint_value text[] NOT NULL,
+ ucdn text NOT NULL,
+ capability_id bigint NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+ALTER TABLE cdni_footprints OWNER TO traffic_ops;
+
+--
+-- Name: cdni_footprints_id_seq; Type: SEQUENCE; Schema: public; Owner:
traffic_ops
+--
+
+CREATE SEQUENCE cdni_footprints_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER TABLE cdni_footprints_id_seq OWNER TO traffic_ops;
+
+--
+-- Name: cdni_footprints_id_seq; Type: SEQUENCE OWNED BY; Schema: public;
Owner: traffic_ops
+--
+
+ALTER SEQUENCE cdni_footprints_id_seq OWNED BY cdni_footprints.id;
+
+--
+-- Name: cdni_limits; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE cdni_limits (
+ id bigint NOT NULL,
+ limit_id text NOT NULL,
+ scope_type text,
+ scope_value text[],
+ limit_type text NOT NULL,
+ maximum_hard bigint NOT NULL,
+ maximum_soft bigint NOT NULL,
+ telemetry_id text NOT NULL,
+ telemetry_metric text NOT NULL,
+ capability_id bigint NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+ALTER TABLE cdni_limits OWNER TO traffic_ops;
+
+--
+-- Name: cdni_limits_id_seq; Type: SEQUENCE; Schema: public; Owner: traffic_ops
+--
+
+CREATE SEQUENCE cdni_limits_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER TABLE cdni_limits_id_seq OWNER TO traffic_ops;
+
+--
+-- Name: cdni_limits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner:
traffic_ops
+--
+
+ALTER SEQUENCE cdni_limits_id_seq OWNED BY cdni_limits.id;
+
+--
+-- Name: cdni_capabilities; Type: SEQUENCE OWNED BY; Schema: public; Owner:
traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS cdni_capabilities (
+ id bigserial NOT NULL,
+ type text NOT NULL,
+ ucdn text NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+ALTER TABLE cdni_capabilities OWNER TO traffic_ops;
+
+--
+-- Name: cdni_footprints; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS cdni_footprints (
+ id bigserial NOT NULL,
+ footprint_type text NOT NULL,
+ footprint_value text[] NOT NULL,
+ ucdn text NOT NULL,
+ capability_id bigint NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+ALTER TABLE cdni_footprints OWNER TO traffic_ops;
+
+--
+-- Name: cdni_telemetry; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE cdni_telemetry (
+ id text NOT NULL,
+ type text NOT NULL,
+ capability_id bigint NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL,
+ configuration_url text DEFAULT ''::text
+);
+
+ALTER TABLE cdni_telemetry OWNER TO traffic_ops;
+
+--
+-- Name: cdni_telemetry_metrics; Type: TABLE; Schema: public; Owner:
traffic_ops
+--
+
+CREATE TABLE cdni_telemetry_metrics (
+ name text NOT NULL,
+ time_granularity bigint NOT NULL,
+ data_percentile bigint NOT NULL,
+ latency integer NOT NULL,
+ telemetry_id text NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+ALTER TABLE cdni_telemetry_metrics OWNER TO traffic_ops;
+
+--
+-- Name: cdni_limits; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS cdni_limits (
+ id bigserial NOT NULL,
+ limit_id text NOT NULL,
+ scope_type text,
+ scope_value text[],
+ limit_type text NOT NULL,
+ maximum_hard bigint NOT NULL,
+ maximum_soft bigint NOT NULL,
+ telemetry_id text NOT NULL,
+ telemetry_metric text NOT NULL,
+ capability_id bigint NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+ALTER TABLE cdni_limits OWNER TO traffic_ops;
+
+--
+-- Name: cdn_lock_user; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS cdn_lock_user (
+ owner text NOT NULL,
+ cdn text NOT NULL,
+ username text NOT NULL
+);
+
+ALTER TABLE cdn_lock_user OWNER TO traffic_ops;
+
+--
+-- Name: server_profile; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS server_profile (
+ server bigint NOT NULL,
+ profile_name text NOT NULL,
+ priority int NOT NULL CHECK (priority >= 0)
+);
+
+ALTER TABLE server_profile OWNER TO traffic_ops;
+
+--
+-- Name: cdni_capability_updates; Type: TABLE; Schema: public; Owner:
traffic_ops
+--
+
+CREATE TABLE IF NOT EXISTS cdni_capability_updates (
+ id bigserial NOT NULL,
+ request_type text NOT NULL,
+ ucdn text NOT NULL,
+ host text,
+ data json NOT NULL,
+ async_status_id bigint NOT NULL,
+ last_updated timestamp with time zone DEFAULT now() NOT NULL
+);
+
+ALTER TABLE cdni_capability_updates OWNER TO traffic_ops;
+
+--
+-- Name: cdni_capabilities id; Type: DEFAULT; Schema: public; Owner:
traffic_ops
+--
+
+ALTER TABLE ONLY cdni_capabilities ALTER COLUMN id SET DEFAULT
nextval('cdni_capabilities_id_seq'::regclass);
+
+--
+-- Name: cdni_footprints id; Type: DEFAULT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_footprints ALTER COLUMN id SET DEFAULT
nextval('cdni_footprints_id_seq'::regclass);
+
+--
+-- Name: cdni_limits id; Type: DEFAULT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_limits ALTER COLUMN id SET DEFAULT
nextval('cdni_limits_id_seq'::regclass);
+
+--
+-- Name: cdn_lock cdn_lock_cdn_username_unique; Type: CONSTRAINT; Schema:
public; Owner: traffic_ops
+--
+
+ALTER TABLE cdn_lock ADD CONSTRAINT cdn_lock_cdn_username_unique UNIQUE
(username, cdn);
+
+--
+-- Name: cdni_capabilities pk_cdni_capabilities; Type: CONSTRAINT; Schema:
public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_capabilities
+ ADD CONSTRAINT pk_cdni_capabilities PRIMARY KEY (id);
+
+--
+-- Name: cdni_footprints pk_cdni_footprints; Type: CONSTRAINT; Schema: public;
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_footprints
+ ADD CONSTRAINT pk_cdni_footprints PRIMARY KEY (id);
+
+--
+-- Name: cdni_limits pk_cdni_limits; Type: CONSTRAINT; Schema: public; Owner:
traffic_ops
+--
+
+ALTER TABLE ONLY cdni_limits
+ ADD CONSTRAINT pk_cdni_limits PRIMARY KEY (id);
+
+--
+-- Name: cdni_telemetry pk_cdni_telemetry; Type: CONSTRAINT; Schema: public;
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_telemetry
+ ADD CONSTRAINT pk_cdni_telemetry PRIMARY KEY (id);
+
+--
+-- Name: cdni_telemetry_metrics pk_cdni_telemetry_metrics; Type: CONSTRAINT;
Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_telemetry_metrics
+ ADD CONSTRAINT pk_cdni_telemetry_metrics PRIMARY KEY (name);
+
+--
+-- Name: cdn_lock_user pk_cdn_lock_user; Type: FK CONSTRAINT; Schema: public;
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdn_lock_user
+ ADD CONSTRAINT pk_cdn_lock_user PRIMARY KEY (owner, cdn, username);
+
+--
+-- Name: server_profile pk_server_profile; Type: FK CONSTRAINT; Schema:
public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY server_profile
+ ADD CONSTRAINT pk_server_profile PRIMARY KEY (profile_name, server);
+
+--
+-- Name: cdni_capability_updates pk_cdni_capability_updates; Type: FK
CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_capability_updates
+ ADD CONSTRAINT pk_cdni_capability_updates PRIMARY KEY (id);
+
+--
+-- Name: cdni_footprints fk_cdni_footprint_capabilities; Type: FK CONSTRAINT;
Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_footprints
+ ADD CONSTRAINT fk_cdni_footprint_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+--
+-- Name: cdni_limits fk_cdni_limits_capabilities; Type: FK CONSTRAINT; Schema:
public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_limits
+ ADD CONSTRAINT fk_cdni_limits_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+--
+-- Name: cdni_limits fk_cdni_limits_telemetry; Type: FK CONSTRAINT; Schema:
public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_limits
+ ADD CONSTRAINT fk_cdni_limits_telemetry FOREIGN KEY (telemetry_id)
REFERENCES cdni_telemetry(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+--
+-- Name: cdni_telemetry fk_cdni_telemetry_capabilities; Type: FK CONSTRAINT;
Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_telemetry
+ ADD CONSTRAINT fk_cdni_telemetry_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE;
+
+--
+-- Name: cdni_telemetry_metrics fk_cdni_telemetry_metrics_telemetry; Type: FK
CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_telemetry_metrics
+ ADD CONSTRAINT fk_cdni_telemetry_metrics_telemetry FOREIGN KEY
(telemetry_id) REFERENCES cdni_telemetry(id) ON UPDATE CASCADE ON DELETE
CASCADE;
+
+--
+-- Name: cdn_lock_user fk_shared_username; Type: FK CONSTRAINT; Schema:
public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdn_lock_user
+ ADD CONSTRAINT fk_shared_username FOREIGN KEY (username) REFERENCES
tm_user(username);
+
+--
+-- Name: cdn_lock_user fk_owner; Type: FK CONSTRAINT; Schema: public; Owner:
traffic_ops
+--
+
+ALTER TABLE ONLY cdn_lock_user
+ ADD CONSTRAINT fk_owner FOREIGN KEY (owner, cdn) REFERENCES
cdn_lock(username, cdn) ON DELETE CASCADE;
+
+--
+-- Name: server_profile fk_server_id; Type: FK CONSTRAINT; Schema: public;
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY server_profile
+ ADD CONSTRAINT fk_server_id FOREIGN KEY (server) REFERENCES server(id) ON
DELETE CASCADE ON UPDATE CASCADE;
+
+--
+-- Name: server_profile fk_server_profile_name_profile; Type: FK CONSTRAINT;
Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY server_profile
+ ADD CONSTRAINT fk_server_profile_name_profile FOREIGN KEY (profile_name)
REFERENCES profile(name) ON UPDATE CASCADE ON DELETE RESTRICT;
+
+--
+-- Name: cdni_capability_updates fk_cdni_capability_updates_async; Type: FK
CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cdni_capability_updates
+ ADD CONSTRAINT fk_cdni_capability_updates_async FOREIGN KEY
(async_status_id) REFERENCES async_status(id) ON UPDATE CASCADE ON DELETE
CASCADE;
+
--
-- PostgreSQL database dump complete
diff --git
a/traffic_ops/app/db/migrations/2022011112591400_added_cdni_capacity_table.down.sql
b/traffic_ops/app/db/migrations/2022011112591400_added_cdni_capacity_table.down.sql
deleted file mode 100644
index 5d3837e00f..0000000000
---
a/traffic_ops/app/db/migrations/2022011112591400_added_cdni_capacity_table.down.sql
+++ /dev/null
@@ -1,23 +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.
- */
-
-DROP TABLE IF EXISTS cdni_total_limits;
-DROP TABLE IF EXISTS cdni_host_limits;
-DROP TABLE IF EXISTS cdni_telemetry_metrics;
-DROP TABLE IF EXISTS cdni_telemetry;
-DROP TABLE IF EXISTS cdni_footprints;
-DROP TABLE IF EXISTS cdni_capabilities;
diff --git
a/traffic_ops/app/db/migrations/2022011112591400_added_cdni_capacity_table.up.sql
b/traffic_ops/app/db/migrations/2022011112591400_added_cdni_capacity_table.up.sql
deleted file mode 100644
index 7c542d057c..0000000000
---
a/traffic_ops/app/db/migrations/2022011112591400_added_cdni_capacity_table.up.sql
+++ /dev/null
@@ -1,82 +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.
- */
-
-CREATE TABLE IF NOT EXISTS cdni_capabilities (
- id bigserial NOT NULL,
- type text NOT NULL,
- ucdn text NOT NULL,
- last_updated timestamp with
time zone DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_capabilities PRIMARY KEY (id)
-);
-
-CREATE TABLE IF NOT EXISTS cdni_footprints (
- id bigserial NOT NULL,
- footprint_type text NOT NULL,
- footprint_value text[] NOT NULL,
- ucdn text NOT NULL,
- capability_id bigint NOT NULL,
- last_updated timestamp with
time zone DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_footprints PRIMARY KEY (id),
- CONSTRAINT fk_cdni_footprint_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE
-);
-
-CREATE TABLE IF NOT EXISTS cdni_telemetry (
- id text NOT NULL,
- type text NOT NULL,
- capability_id bigint NOT NULL,
- last_updated timestamp with time zone
DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_telemetry PRIMARY KEY (id),
- CONSTRAINT fk_cdni_telemetry_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE
-);
-
-CREATE TABLE IF NOT EXISTS cdni_telemetry_metrics (
- name text NOT NULL,
- time_granularity bigint NOT NULL,
- data_percentile bigint NOT NULL,
- latency int NOT NULL,
- telemetry_id text NOT NULL,
- last_updated timestamp with time zone
DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_telemetry_metrics PRIMARY KEY (name),
- CONSTRAINT fk_cdni_telemetry_metrics_telemetry FOREIGN KEY (telemetry_id)
REFERENCES cdni_telemetry(id) ON UPDATE CASCADE ON DELETE CASCADE
-);
-
-CREATE TABLE IF NOT EXISTS cdni_total_limits (
- limit_type text NOT NULL,
- maximum_hard bigint NOT NULL,
- maximum_soft bigint NOT NULL,
- telemetry_id text NOT NULL,
- telemetry_metric text NOT NULL,
- capability_id bigint NOT NULL,
- last_updated timestamp with time zone
DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_total_limits PRIMARY KEY (capability_id, telemetry_id),
- CONSTRAINT fk_cdni_total_limits_telemetry FOREIGN KEY (telemetry_id)
REFERENCES cdni_telemetry(id) ON UPDATE CASCADE ON DELETE CASCADE,
- CONSTRAINT fk_cdni_total_limits_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE
-);
-
-CREATE TABLE IF NOT EXISTS cdni_host_limits (
- limit_type text NOT NULL,
- maximum_hard bigint NOT NULL,
- maximum_soft bigint NOT NULL,
- telemetry_id text NOT NULL,
- telemetry_metric text NOT NULL,
- capability_id bigint NOT NULL,
- host text NOT NULL,
- last_updated timestamp with time zone
DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_host_limits PRIMARY KEY (capability_id, telemetry_id,
host),
- CONSTRAINT fk_cdni_host_limits_telemetry FOREIGN KEY (telemetry_id)
REFERENCES cdni_telemetry(id) ON UPDATE CASCADE ON DELETE CASCADE,
- CONSTRAINT fk_cdni_total_limits_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE
-);
diff --git
a/traffic_ops/app/db/migrations/2022020114365100_capacity_updates_queue.down.sql
b/traffic_ops/app/db/migrations/2022020114365100_capacity_updates_queue.down.sql
deleted file mode 100644
index 381453aba6..0000000000
---
a/traffic_ops/app/db/migrations/2022020114365100_capacity_updates_queue.down.sql
+++ /dev/null
@@ -1,18 +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.
- */
-
-DROP TABLE IF EXISTS cdni_capability_updates;
diff --git
a/traffic_ops/app/db/migrations/2022020114365100_capacity_updates_queue.up.sql
b/traffic_ops/app/db/migrations/2022020114365100_capacity_updates_queue.up.sql
deleted file mode 100644
index 7ea094f8e5..0000000000
---
a/traffic_ops/app/db/migrations/2022020114365100_capacity_updates_queue.up.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.
- */
-
-CREATE TABLE IF NOT EXISTS cdni_capability_updates (
- id bigserial NOT NULL,
- request_type text NOT NULL,
- ucdn text NOT NULL,
- host text,
- data json NOT NULL,
- async_status_id bigint NOT
NULL,
- last_updated timestamp with
time zone DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_capability_updates PRIMARY KEY (id),
- CONSTRAINT fk_cdni_capability_updates_async FOREIGN KEY (async_status_id)
REFERENCES async_status(id) ON UPDATE CASCADE ON DELETE CASCADE
-);
diff --git
a/traffic_ops/app/db/migrations/2022021611354000_add_user_to_ucdn_table.down.sql
b/traffic_ops/app/db/migrations/2022021611354000_add_user_to_ucdn_table.down.sql
deleted file mode 100644
index 4d8916cdc8..0000000000
---
a/traffic_ops/app/db/migrations/2022021611354000_add_user_to_ucdn_table.down.sql
+++ /dev/null
@@ -1,18 +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.
- */
-
-ALTER TABLE tm_user DROP COLUMN IF EXISTS ucdn;
diff --git
a/traffic_ops/app/db/migrations/2022021611354000_add_user_to_ucdn_table.up.sql
b/traffic_ops/app/db/migrations/2022021611354000_add_user_to_ucdn_table.up.sql
deleted file mode 100644
index e5888178c3..0000000000
---
a/traffic_ops/app/db/migrations/2022021611354000_add_user_to_ucdn_table.up.sql
+++ /dev/null
@@ -1,18 +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.
- */
-
-ALTER TABLE tm_user ADD COLUMN IF NOT EXISTS ucdn text NOT NULL DEFAULT '';
diff --git
a/traffic_ops/app/db/migrations/2022022319353588_fix_dsr_geolimit.down.sql
b/traffic_ops/app/db/migrations/2022022319353588_fix_dsr_geolimit.down.sql
deleted file mode 100644
index f0f5e8b52d..0000000000
--- a/traffic_ops/app/db/migrations/2022022319353588_fix_dsr_geolimit.down.sql
+++ /dev/null
@@ -1,60 +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.
- */
-
-UPDATE public.deliveryservice_request
-SET
- deliveryservice =
- CASE
- WHEN deliveryservice -> 'geoLimitCountries' = '[]' OR
deliveryservice -> 'geoLimitCountries' = 'null' THEN jsonb_set(deliveryservice,
'{geoLimitCountries}', '""')
- ELSE jsonb_set(
- deliveryservice,
- '{geoLimitCountries}',
- replace(
- replace(
- trim(both '[]' from
(deliveryservice->'geoLimitCountries')::text),
- ' ',
- ''
- ),
- '","',
- ','
- )::jsonb
- )
- END
-WHERE
- deliveryservice IS NOT NULL;
-
-UPDATE public.deliveryservice_request
-SET
- original =
- CASE
- WHEN original -> 'geoLimitCountries' = '[]' OR original ->
'geoLimitCountries' = 'null' THEN jsonb_set(original, '{geoLimitCountries}',
'""')
- ELSE jsonb_set(
- original,
- '{geoLimitCountries}',
- replace(
- replace(
- trim(both '[]' from
(original->'geoLimitCountries')::text),
- ' ',
- ''
- ),
- '","',
- ','
- )::jsonb
- )
- END
-WHERE
- original IS NOT NULL;
diff --git
a/traffic_ops/app/db/migrations/2022022319353588_fix_dsr_geolimit.up.sql
b/traffic_ops/app/db/migrations/2022022319353588_fix_dsr_geolimit.up.sql
deleted file mode 100644
index 569b72da0e..0000000000
--- a/traffic_ops/app/db/migrations/2022022319353588_fix_dsr_geolimit.up.sql
+++ /dev/null
@@ -1,36 +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.
- */
-
-UPDATE public.deliveryservice_request
-SET
- deliveryservice =
- CASE
- WHEN deliveryservice -> 'geoLimitCountries' = '""' THEN
jsonb_set(deliveryservice, '{geoLimitCountries}', '[]')
- ELSE jsonb_set(deliveryservice, '{geoLimitCountries}', ('[' ||
replace((deliveryservice->'geoLimitCountries')::text, ',', '","') ||
']')::jsonb)
- END
-WHERE
- deliveryservice IS NOT NULL;
-
-UPDATE public.deliveryservice_request
-SET
- original =
- CASE
- WHEN original -> 'geoLimitCountries' = '""' THEN
jsonb_set(original, '{geoLimitCountries}', '[]')
- ELSE jsonb_set(original, '{geoLimitCountries}', ('[' ||
replace((original->'geoLimitCountries')::text, ',', '","') || ']')::jsonb)
- END
-WHERE
- original IS NOT NULL;
diff --git
a/traffic_ops/app/db/migrations/2022030308363540_add_dnssec_perms.down.sql
b/traffic_ops/app/db/migrations/2022030308363540_add_dnssec_perms.down.sql
deleted file mode 100644
index ba7b36d365..0000000000
--- a/traffic_ops/app/db/migrations/2022030308363540_add_dnssec_perms.down.sql
+++ /dev/null
@@ -1,23 +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.
- */
-
-DELETE FROM public.role_capability
-WHERE cap_name IN (
- VALUES
- ('DNS-SEC:READ'),
- ('DNS-SEC:DELETE')
-);
diff --git
a/traffic_ops/app/db/migrations/2022030308363540_add_dnssec_perms.up.sql
b/traffic_ops/app/db/migrations/2022030308363540_add_dnssec_perms.up.sql
deleted file mode 100644
index 835dbaefee..0000000000
--- a/traffic_ops/app/db/migrations/2022030308363540_add_dnssec_perms.up.sql
+++ /dev/null
@@ -1,26 +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.
- */
-
-INSERT INTO public.role_capability
-SELECT id, perm FROM public.role
-CROSS JOIN (
- VALUES
- ('DNS-SEC:READ'),
- ('DNS-SEC:DELETE')
-) AS perms(perm)
-WHERE priv_level >= 30
-ON CONFLICT DO NOTHING;
diff --git
a/traffic_ops/app/db/migrations/2022031610510000_assign_correct_permissions_to_roles.down.sql
b/traffic_ops/app/db/migrations/2022031610510000_assign_correct_permissions_to_roles.down.sql
deleted file mode 100644
index 15e6b9e1d4..0000000000
---
a/traffic_ops/app/db/migrations/2022031610510000_assign_correct_permissions_to_roles.down.sql
+++ /dev/null
@@ -1,27 +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.
- */
-
-DELETE FROM public.role_capability rc WHERE
rc.cap_name='DELIVERY-SERVICE-SAFE:UPDATE' AND rc.role_id IN (SELECT id FROM
public.role r WHERE r.priv_level < 20);
-
-INSERT INTO public.role_capability (role_id, cap_name)
-SELECT id, perm
-FROM public.role
- CROSS JOIN ( VALUES
- ('DELIVERY-SERVICE:UPDATE')
-) AS perms(perm)
-WHERE "priv_level" < 20 AND "priv_level" > 0
- ON CONFLICT DO NOTHING;
diff --git
a/traffic_ops/app/db/migrations/2022031610510000_assign_correct_permissions_to_roles.up.sql
b/traffic_ops/app/db/migrations/2022031610510000_assign_correct_permissions_to_roles.up.sql
deleted file mode 100644
index 1073fde420..0000000000
---
a/traffic_ops/app/db/migrations/2022031610510000_assign_correct_permissions_to_roles.up.sql
+++ /dev/null
@@ -1,27 +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.
- */
-
-DELETE FROM public.role_capability rc WHERE
rc.cap_name='DELIVERY-SERVICE:UPDATE' AND rc.role_id IN (SELECT id FROM
public.role r WHERE r.priv_level < 20);
-
-INSERT INTO public.role_capability (role_id, cap_name)
-SELECT id, perm
-FROM public.role
- CROSS JOIN ( VALUES
- ('DELIVERY-SERVICE-SAFE:UPDATE')
-) AS perms(perm)
-WHERE "priv_level" < 20 AND "priv_level" > 0
- ON CONFLICT DO NOTHING;
diff --git
a/traffic_ops/app/db/migrations/2022031612431414_remove_unused_ds_tmuser_table.down.sql
b/traffic_ops/app/db/migrations/2022031612431414_remove_unused_ds_tmuser_table.down.sql
deleted file mode 100644
index 53dba14c4a..0000000000
---
a/traffic_ops/app/db/migrations/2022031612431414_remove_unused_ds_tmuser_table.down.sql
+++ /dev/null
@@ -1,49 +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.
- */
-
-CREATE TABLE public.deliveryservice_tmuser (
- deliveryservice bigint NOT NULL,
- tm_user_id bigint NOT NULL,
- last_updated timestamp with time zone NOT NULL DEFAULT now(),
- CONSTRAINT idx_89525_primary PRIMARY KEY (deliveryservice, tm_user_id)
-);
-
-CREATE INDEX idx_89525_fk_tm_userid
-ON public.deliveryservice_tmuser
-USING btree (tm_user_id);
-
-CREATE TRIGGER on_delete_current_timestamp
-AFTER DELETE ON public.deliveryservice_tmuser
-FOR EACH ROW EXECUTE PROCEDURE
on_delete_current_timestamp_last_updated('public.deliveryservice_tmuser');
-
-CREATE TRIGGER on_update_current_timestamp
-BEFORE UPDATE ON public.deliveryservice_tmuser
-FOR EACH ROW EXECUTE PROCEDURE
on_update_current_timestamp_last_updated('public.deliveryservice_tmuser');
-
-ALTER TABLE ONLY public.deliveryservice_tmuser
-ADD CONSTRAINT fk_tm_user_ds
-FOREIGN KEY (deliveryservice)
-REFERENCES deliveryservice(id)
-ON UPDATE CASCADE
-ON DELETE CASCADE;
-
-ALTER TABLE ONLY public.deliveryservice_tmuser
-ADD CONSTRAINT fk_tm_user_id
-FOREIGN KEY (tm_user_id)
-REFERENCES tm_user(id)
-ON UPDATE CASCADE
-ON DELETE CASCADE;
diff --git
a/traffic_ops/app/db/migrations/2022031612431414_remove_unused_ds_tmuser_table.up.sql
b/traffic_ops/app/db/migrations/2022031612431414_remove_unused_ds_tmuser_table.up.sql
deleted file mode 100644
index dcfbbf01ef..0000000000
---
a/traffic_ops/app/db/migrations/2022031612431414_remove_unused_ds_tmuser_table.up.sql
+++ /dev/null
@@ -1,18 +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.
- */
-
-DROP TABLE public.deliveryservice_tmuser CASCADE;
diff --git
a/traffic_ops/app/db/migrations/2022040623082100_server_config_update.down.sql
b/traffic_ops/app/db/migrations/2022040623082100_server_config_update.down.sql
deleted file mode 100644
index 4ebde57b61..0000000000
---
a/traffic_ops/app/db/migrations/2022040623082100_server_config_update.down.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.
- */
-
--- Add previously existing columns
-ALTER TABLE public.server
-ADD COLUMN IF NOT EXISTS upd_pending bool NOT NULL DEFAULT false,
-ADD COLUMN IF NOT EXISTS reval_pending bool NOT NULL DEFAULT false;
-
--- Remove new columns
-ALTER TABLE public.server
-DROP COLUMN IF EXISTS config_update_time,
-DROP COLUMN IF EXISTS config_apply_time,
-DROP COLUMN IF EXISTS revalidate_update_time,
-DROP COLUMN IF EXISTS revalidate_apply_time;
diff --git
a/traffic_ops/app/db/migrations/2022040623082100_server_config_update.up.sql
b/traffic_ops/app/db/migrations/2022040623082100_server_config_update.up.sql
deleted file mode 100644
index e8e700084b..0000000000
--- a/traffic_ops/app/db/migrations/2022040623082100_server_config_update.up.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.
- */
-
--- Add columns, timestamp with time zone, nullable, default null
-ALTER TABLE public.server
-ADD COLUMN IF NOT EXISTS config_update_time TIMESTAMPTZ NOT NULL DEFAULT
TIMESTAMP 'epoch',
-ADD COLUMN IF NOT EXISTS config_apply_time TIMESTAMPTZ NOT NULL DEFAULT
TIMESTAMP 'epoch',
-ADD COLUMN IF NOT EXISTS revalidate_update_time TIMESTAMPTZ NOT NULL DEFAULT
TIMESTAMP 'epoch',
-ADD COLUMN IF NOT EXISTS revalidate_apply_time TIMESTAMPTZ NOT NULL DEFAULT
TIMESTAMP 'epoch';
-
--- Drop previous columns
-ALTER TABLE public.server
-DROP COLUMN IF EXISTS upd_pending,
-DROP COLUMN IF EXISTS reval_pending;
diff --git
a/traffic_ops/app/db/migrations/2022041410185700_add_server_profile_table.down.sql
b/traffic_ops/app/db/migrations/2022041410185700_add_server_profile_table.down.sql
deleted file mode 100644
index 261b7f2ce1..0000000000
---
a/traffic_ops/app/db/migrations/2022041410185700_add_server_profile_table.down.sql
+++ /dev/null
@@ -1,36 +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.
- */
-
-DROP TABLE IF EXISTS public.server_profile;
-
-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();
-
-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_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();
diff --git
a/traffic_ops/app/db/migrations/2022041410185700_add_server_profile_table.up.sql
b/traffic_ops/app/db/migrations/2022041410185700_add_server_profile_table.up.sql
deleted file mode 100644
index 428e678e4b..0000000000
---
a/traffic_ops/app/db/migrations/2022041410185700_add_server_profile_table.up.sql
+++ /dev/null
@@ -1,38 +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
undera
- * the License.
- */
-
-CREATE TABLE IF NOT EXISTS public.server_profile (
- server bigint NOT NULL,
- profile_name text NOT
NULL,
- priority int NOT NULL
CHECK (priority >= 0),
- CONSTRAINT pk_server_profile PRIMARY KEY (profile_name, server),
- CONSTRAINT fk_server_id FOREIGN KEY (server) REFERENCES public.server(id)
ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT fk_server_profile_name_profile FOREIGN KEY (profile_name)
REFERENCES public.profile(name) ON UPDATE CASCADE ON DELETE RESTRICT
- );
-
-INSERT into public.server_profile(server, profile_name, priority)
-SELECT s.id, p.name, 0
-FROM public.server AS s
- JOIN public.profile p ON p.id=s.profile;
-
-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 TRIGGER IF EXISTS before_update_server_trigger ON server;
-
-DROP TRIGGER IF EXISTS before_create_server_trigger ON server;
diff --git
a/traffic_ops/app/db/migrations/2022042514493300_add_user_sharing_cdn_locks.down.sql
b/traffic_ops/app/db/migrations/2022042514493300_add_user_sharing_cdn_locks.down.sql
deleted file mode 100644
index ac0d080d6d..0000000000
---
a/traffic_ops/app/db/migrations/2022042514493300_add_user_sharing_cdn_locks.down.sql
+++ /dev/null
@@ -1,20 +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.
- */
-
-DROP TABLE IF EXISTS public.cdn_lock_user;
-ALTER TABLE public.cdn_lock DROP CONSTRAINT cdn_lock_cdn_username_unique;
-
diff --git
a/traffic_ops/app/db/migrations/2022042514493300_add_user_sharing_cdn_locks.up.sql
b/traffic_ops/app/db/migrations/2022042514493300_add_user_sharing_cdn_locks.up.sql
deleted file mode 100644
index 6bd6e94e32..0000000000
---
a/traffic_ops/app/db/migrations/2022042514493300_add_user_sharing_cdn_locks.up.sql
+++ /dev/null
@@ -1,27 +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.
- */
-
-ALTER TABLE public.cdn_lock ADD CONSTRAINT cdn_lock_cdn_username_unique UNIQUE
(username, cdn);
-CREATE TABLE IF NOT EXISTS public.cdn_lock_user (
- owner text NOT NULL,
- cdn text NOT NULL,
- username text NOT NULL,
- CONSTRAINT pk_cdn_lock_user PRIMARY KEY (owner, cdn, username),
- CONSTRAINT fk_shared_username FOREIGN KEY (username) REFERENCES
public.tm_user(username),
- CONSTRAINT fk_owner FOREIGN KEY (owner, cdn) REFERENCES
public.cdn_lock(username, cdn) ON DELETE CASCADE
- );
-
diff --git
a/traffic_ops/app/db/migrations/2022050410412200_cdni_capacity_limit_with_scopes.down.sql
b/traffic_ops/app/db/migrations/2022050410412200_cdni_capacity_limit_with_scopes.down.sql
deleted file mode 100644
index 9c7577b42a..0000000000
---
a/traffic_ops/app/db/migrations/2022050410412200_cdni_capacity_limit_with_scopes.down.sql
+++ /dev/null
@@ -1,51 +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.
- */
-
-/* Downgrading this will lose some data because the specification has changed.
- * Previously, only total and host limits were set. Now with the scope field,
it is not as limited so downgrading
- * cannot put the data back in the old tables since it wont necessarily fit
into those buckets.
-*/
-CREATE TABLE IF NOT EXISTS public.cdni_total_limits (
- limit_type text NOT NULL,
- maximum_hard bigint NOT NULL,
- maximum_soft bigint NOT NULL,
- telemetry_id text NOT NULL,
- telemetry_metric text NOT
NULL,
- capability_id bigint NOT NULL,
- last_updated timestamp with
time zone DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_total_limits PRIMARY KEY (capability_id, telemetry_id),
- CONSTRAINT fk_cdni_total_limits_telemetry FOREIGN KEY (telemetry_id)
REFERENCES cdni_telemetry(id) ON UPDATE CASCADE ON DELETE CASCADE,
- CONSTRAINT fk_cdni_total_limits_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE
- );
-
-CREATE TABLE IF NOT EXISTS public.cdni_host_limits (
- limit_type text NOT NULL,
- maximum_hard bigint NOT NULL,
- maximum_soft bigint NOT NULL,
- telemetry_id text NOT NULL,
- telemetry_metric text NOT NULL,
- capability_id bigint NOT NULL,
- host text NOT NULL,
- last_updated timestamp with
time zone DEFAULT now() NOT NULL,
- CONSTRAINT pk_cdni_host_limits PRIMARY KEY (capability_id, telemetry_id,
host),
- CONSTRAINT fk_cdni_host_limits_telemetry FOREIGN KEY (telemetry_id)
REFERENCES cdni_telemetry(id) ON UPDATE CASCADE ON DELETE CASCADE,
- CONSTRAINT fk_cdni_total_limits_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE
-);
-
-DROP TABLE IF EXISTS public.cdni_limits;
-
-ALTER TABLE public.cdni_telemetry DROP COLUMN IF EXISTS configuration_url;
diff --git
a/traffic_ops/app/db/migrations/2022050410412200_cdni_capacity_limit_with_scopes.up.sql
b/traffic_ops/app/db/migrations/2022050410412200_cdni_capacity_limit_with_scopes.up.sql
deleted file mode 100644
index 17ac9f2a9a..0000000000
---
a/traffic_ops/app/db/migrations/2022050410412200_cdni_capacity_limit_with_scopes.up.sql
+++ /dev/null
@@ -1,78 +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.
- */
-
-CREATE TABLE IF NOT EXISTS public.cdni_limits (
- id bigserial NOT NULL,
- limit_id text NOT NULL,
- scope_type text,
- scope_value text[],
- limit_type text NOT NULL,
- maximum_hard bigint NOT NULL,
- maximum_soft bigint NOT NULL,
- telemetry_id text NOT NULL,
- telemetry_metric text NOT NULL,
- capability_id bigint NOT NULL,
- last_updated timestamp with time zone DEFAULT
now() NOT NULL,
- CONSTRAINT pk_cdni_limits PRIMARY KEY (id),
- CONSTRAINT fk_cdni_limits_telemetry FOREIGN KEY (telemetry_id) REFERENCES
cdni_telemetry(id) ON UPDATE CASCADE ON DELETE CASCADE,
- CONSTRAINT fk_cdni_limits_capabilities FOREIGN KEY (capability_id)
REFERENCES cdni_capabilities(id) ON UPDATE CASCADE ON DELETE CASCADE
-);
-
-INSERT INTO public.cdni_limits (limit_id,
- scope_type,
- scope_value,
- limit_type,
- maximum_hard,
- maximum_soft,
- telemetry_id,
- telemetry_metric,
- capability_id)
-SELECT CONCAT('host_limit_', chl.limit_type, '_', chl.telemetry_metric),
- 'published-host',
- ARRAY[chl.host],
- chl.limit_type,
- chl.maximum_hard,
- chl.maximum_soft,
- chl.telemetry_id,
- chl.telemetry_metric,
- chl.capability_id
-FROM public.cdni_host_limits as chl;
-
-INSERT INTO public.cdni_limits (limit_id,
- scope_type,
- scope_value,
- limit_type,
- maximum_hard,
- maximum_soft,
- telemetry_id,
- telemetry_metric,
- capability_id)
-SELECT CONCAT('total_limit_', thl.limit_type, '_', thl.telemetry_metric),
- NULL,
- NULL,
- thl.limit_type,
- thl.maximum_hard,
- thl.maximum_soft,
- thl.telemetry_id,
- thl.telemetry_metric,
- thl.capability_id
-FROM public.cdni_total_limits as thl;
-
-DROP TABLE IF EXISTS public.cdni_total_limits;
-DROP TABLE IF EXISTS public.cdni_host_limits;
-
-ALTER TABLE public.cdni_telemetry ADD COLUMN configuration_url text DEFAULT '';
diff --git
a/traffic_ops/app/db/migrations/2022050916074300_add_reserved_statuses.down.sql
b/traffic_ops/app/db/migrations/2022050916074300_add_reserved_statuses.down.sql
deleted file mode 100644
index 6b6a6e9174..0000000000
---
a/traffic_ops/app/db/migrations/2022050916074300_add_reserved_statuses.down.sql
+++ /dev/null
@@ -1,17 +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.
- */
-
diff --git
a/traffic_ops/app/db/migrations/2022050916074300_add_reserved_statuses.up.sql
b/traffic_ops/app/db/migrations/2022050916074300_add_reserved_statuses.up.sql
deleted file mode 100644
index ddd9a128d3..0000000000
---
a/traffic_ops/app/db/migrations/2022050916074300_add_reserved_statuses.up.sql
+++ /dev/null
@@ -1,23 +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.
- */
-
-INSERT INTO public.status ("name", description) VALUES ('ONLINE', 'Server is
online.') ON CONFLICT ("name") DO NOTHING;
-INSERT INTO public.status ("name", description) VALUES ('OFFLINE', 'Server is
Offline. Not active in any configuration.') ON CONFLICT ("name") DO NOTHING;
-INSERT INTO public.status ("name", description) VALUES ('REPORTED', 'Server is
online and reported in the health protocol.') ON CONFLICT ("name") DO NOTHING;
-INSERT INTO public.status ("name", description) VALUES ('ADMIN_DOWN', 'Sever
is administrative down and does not receive traffic.') ON CONFLICT ("name") DO
NOTHING;
-INSERT INTO public.status ("name", description) VALUES ('PRE_PROD', 'Pre
Production. Not active in any configuration.') ON CONFLICT ("name") DO NOTHING;
-
diff --git a/traffic_ops/app/db/seeds.sql b/traffic_ops/app/db/seeds.sql
index 4b29587810..ef4f965684 100644
--- a/traffic_ops/app/db/seeds.sql
+++ b/traffic_ops/app/db/seeds.sql
@@ -61,13 +61,19 @@ INSERT INTO public.profile ("name", "description", "type",
cdn) VALUES ('TRAFFIC
INSERT INTO public.profile ("name", "description", "type", cdn) VALUES
('INFLUXDB', 'InfluxDb profile', 'INFLUXDB_PROFILE', (SELECT id FROM cdn WHERE
"name"='ALL')) ON CONFLICT ("name") DO NOTHING;
INSERT INTO public.profile ("name", "description", "type", cdn) VALUES
('RIAK_ALL', 'Riak profile for all CDNs', 'RIAK_PROFILE', (SELECT id FROM cdn
WHERE "name"='ALL')) ON CONFLICT ("name") DO NOTHING;
+-- server_profile
+INSERT into public.server_profile(server, profile_name, priority)
+SELECT s.id, p.name, 0
+FROM public.server AS s
+ JOIN public.profile p ON p.id=s.profile;
+
-- statuses
-INSERT INTO public.status ("name", "description") VALUES ('OFFLINE', 'Server
is Offline. Not active in any configuration.') ON CONFLICT ("name") DO NOTHING;
INSERT INTO public.status ("name", "description") VALUES ('ONLINE', 'Server is
online.') ON CONFLICT ("name") DO NOTHING;
+INSERT INTO public.status ("name", "description") VALUES ('OFFLINE', 'Server
is Offline. Not active in any configuration.') ON CONFLICT ("name") DO NOTHING;
INSERT INTO public.status ("name", "description") VALUES ('REPORTED', 'Server
is online and reported in the health protocol.') ON CONFLICT ("name") DO
NOTHING;
INSERT INTO public.status ("name", "description") VALUES ('ADMIN_DOWN', 'Sever
is administrative down and does not receive traffic.') ON CONFLICT ("name") DO
NOTHING;
-INSERT INTO public.status ("name", "description") VALUES ('CCR_IGNORE',
'Server is ignored by traffic router.') ON CONFLICT ("name") DO NOTHING;
INSERT INTO public.status ("name", "description") VALUES ('PRE_PROD', 'Pre
Production. Not active in any configuration.') ON CONFLICT ("name") DO NOTHING;
+INSERT INTO public.status ("name", "description") VALUES ('CCR_IGNORE',
'Server is ignored by traffic router.') ON CONFLICT ("name") DO NOTHING;
-- tenants
INSERT INTO public.tenant ("name", active, parent_id) VALUES ('root', true,
NULL) ON CONFLICT DO NOTHING;
@@ -97,6 +103,23 @@ FROM public.role
WHERE "name" in ('operations', 'read-only', 'portal', 'federation', 'steering')
ON CONFLICT DO NOTHING;
+INSERT INTO public.role_capability
+SELECT id, perm FROM public.role
+CROSS JOIN (
+ VALUES ('DNS-SEC:READ'), ('DNS-SEC:DELETE')
+) AS perms(perm)
+WHERE "name" = 'operations'
+ ON CONFLICT DO NOTHING;
+
+INSERT INTO public.role_capability (role_id, cap_name)
+SELECT id, perm
+FROM public.role
+CROSS JOIN (
+ VALUES ('DELIVERY-SERVICE-SAFE:UPDATE')
+) AS perms(perm)
+WHERE name in ('operations', 'read-only', 'portal', 'federation', 'steering')
+ ON CONFLICT DO NOTHING;
+
-- Using role 'read-only'
INSERT INTO public.role_capability
SELECT id, perm
diff --git a/traffic_ops/app/db/squash_migrations.sh
b/traffic_ops/app/db/squash_migrations.sh
index 2fbc274d43..9d38d7b90e 100755
--- a/traffic_ops/app/db/squash_migrations.sh
+++ b/traffic_ops/app/db/squash_migrations.sh
@@ -25,9 +25,9 @@ last_squashed_migration="$(<<<"$migrations_to_squash" tail
-n1)"
last_squashed_migration_timestamp="$(<<<"$last_squashed_migration" sed -E
's|migrations/([0-9]+).*|\1|')"
first_migration="$(ls migrations/*.sql | grep -A1
"/${last_squashed_migration_timestamp}_" | tail -n1)"
first_migration_timestamp="$(<<<"$first_migration" sed -E
's|migrations/([0-9]+).*|\1|')"
-sed -i '/^--/,$d' create_tables.sql # keeps the Apache License 2.0 header
-sed -Ei "s|(LastSquashedMigrationTimestamp\s+uint\s+=
).*|\1${last_squashed_migration_timestamp} // ${last_squashed_migration}|"
admin.go
-sed -Ei "s|(FirstMigrationTimestamp\s+uint\s+=
).*|\1${first_migration_timestamp} // ${first_migration}|" admin.go
+sed -i.bak '/^--/,$d' create_tables.sql # keeps the Apache License 2.0 header
+sed -Ei.bak "s|(LastSquashedMigrationTimestamp\s+uint\s+=
).*|\1${last_squashed_migration_timestamp} // ${last_squashed_migration}|"
admin.go
+sed -Ei.bak "s|(FirstMigrationTimestamp\s+uint\s+=
).*|\1${first_migration_timestamp} // ${first_migration}|" admin.go
dump_db_with_migrations() {
trap 'echo "Error on line ${LINENO} of dump_db_with_migrations"
>/dev/stderr; exit 1' ERR
diff --git a/traffic_ops_db/test/docker/run-db-test.sh
b/traffic_ops_db/test/docker/run-db-test.sh
index a31d53cbaa..8a38eb9baa 100755
--- a/traffic_ops_db/test/docker/run-db-test.sh
+++ b/traffic_ops_db/test/docker/run-db-test.sh
@@ -87,7 +87,7 @@ cd "$TO_DIR"
# This NEEDS to be updated if migrations are squashed. It should be the
# timestamp of the oldest extant migration.
# TODO: this can be determined automatically from an inspection of the
migrations dir
-FIRST_MIGRATION=2022011112591400
+FIRST_MIGRATION=2022100210472946
old_db_version=$FIRST_MIGRATION