Skip to content

Commit

Permalink
Removed duplicate statements from seeds file (#7790)
Browse files Browse the repository at this point in the history
* cleaned seeds.sql file

* formatting updates.
  • Loading branch information
rimashah25 committed Sep 7, 2023
1 parent fa5eb59 commit 3a43e40
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions traffic_ops/app/db/seeds.sql
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ 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 ('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;
Expand Down Expand Up @@ -103,25 +97,8 @@ 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
INSERT INTO public.role_capability (role_id, cap_name)
SELECT id, perm
FROM public.role
CROSS JOIN ( VALUES
Expand All @@ -136,6 +113,7 @@ CROSS JOIN ( VALUES
('CDNI-CAPACITY:READ'),
('COORDINATE:READ'),
('DELIVERY-SERVICE:READ'),
('DELIVERY-SERVICE-SAFE:UPDATE'),
('DIVISION:READ'),
('DS-REQUEST:READ'),
('DS-SECURITY-KEY:READ'),
Expand Down Expand Up @@ -209,10 +187,10 @@ INSERT INTO public.role_capability
SELECT id, perm
FROM public.role
CROSS JOIN ( VALUES
('ACME:CREATE'),
('ACME:DELETE'),
('ACME:READ'),
('ACME:UPDATE'),
('ACME:CREATE'),
('ACME:DELETE'),
('ACME:READ'),
('ACME:UPDATE'),
('ASN:CREATE'),
('ASN:DELETE'),
('ASN:UPDATE'),
Expand All @@ -236,6 +214,7 @@ CROSS JOIN ( VALUES
('DIVISION:UPDATE'),
('DNS-SEC:READ'),
('DNS-SEC:UPDATE'),
('DNS-SEC:DELETE'),
('ISO:GENERATE'),
('ORIGIN:CREATE'),
('ORIGIN:DELETE'),
Expand Down

0 comments on commit 3a43e40

Please sign in to comment.