Skip to content

Commit

Permalink
Removed extra added fields by migration script and reordered statuses…
Browse files Browse the repository at this point in the history
… in seeds.sql
  • Loading branch information
rimashah25 committed Sep 6, 2023
1 parent eab397b commit 1b37282
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
18 changes: 6 additions & 12 deletions traffic_ops/app/db/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,12 @@

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
Expand Down Expand Up @@ -125,7 +118,7 @@ BEGIN
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',
RAISE EXCEPTION 'ip_address is not unique across the server [id:%] profile [id:%], [%] conflicts',
server_id,
server_profile,
server_count;
Expand All @@ -143,8 +136,8 @@ CREATE OR REPLACE FUNCTION 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;
update last_deleted set last_updated = now() where table_name = TG_ARGV[0];
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
Expand Down Expand Up @@ -460,7 +453,7 @@ CREATE TABLE IF NOT EXISTS cachegroup_fallbacks (
set_order bigint NOT NULL,
UNIQUE (primary_cg, backup_cg),
UNIQUE (primary_cg, set_order)
);
);

ALTER TABLE cachegroup_fallbacks OWNER TO traffic_ops;

Expand Down Expand Up @@ -1023,7 +1016,7 @@ CREATE TABLE IF NOT EXISTS interface (
router_host_name text NOT NULL DEFAULT '',
router_port_name text NOT NULL DEFAULT '',
PRIMARY KEY (name, server)
);
);

ALTER TABLE interface
ADD CONSTRAINT interface_mtu_check
Expand Down Expand Up @@ -1464,6 +1457,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
--
Expand Down
4 changes: 2 additions & 2 deletions traffic_ops/app/db/seeds.sql
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ 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;
Expand Down

0 comments on commit 1b37282

Please sign in to comment.