This is an automated email from the ASF dual-hosted git repository.

dangogh 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 41cc65a  Collapse database migrations (#3524)
41cc65a is described below

commit 41cc65a8621094fd7403574e0dd6f9c36b49ea87
Author: ocket8888 <[email protected]>
AuthorDate: Fri May 31 15:32:02 2019 -0600

    Collapse database migrations (#3524)
    
    * collapsed migrations
    
    * Added migrations missing from 3.0.x release
---
 CHANGELOG.md                                       |   1 +
 docs/source/admin/traffic_ops/installation.rst     |  12 +-
 traffic_ops/app/db/create_tables.sql               | 786 ++++++++++++++++++---
 .../20161208000000_alter_cdn_name_not_null.sql     |  23 -
 .../migrations/20161208000001_create_snapshots.sql |  32 -
 .../20170205101432_cdn_table_domain_name.go        | 273 -------
 .../db/migrations/20170315000000_basic_tenancy.sql |  38 -
 .../20170328190847_add_reval_pending.sql           |  27 -
 .../db/migrations/20170401000000_user_tenancy.sql  |  31 -
 .../20170404000000_unique_job_status_name.sql      |  23 -
 .../migrations/20170404000001_unique_role_name.sql |  23 -
 .../20170404000002_unique_status_name.sql          |  23 -
 .../migrations/20170404000003_unique_type_name.sql |  23 -
 .../20170404000004_unique_job_agent_name.sql       |  23 -
 .../db/migrations/20170404000005_unique_param.sql  |  23 -
 ...0170406000001_create_capabilities_and_roles.sql |  91 ---
 .../migrations/20170601183753_steering_target.sql  |  30 -
 .../db/migrations/20170623144818_lastupdated.sql   | 116 ---
 .../20170628000000_delivery_service_tenancy.sql    |  30 -
 .../20170711160724_steering_target_fk.sql          |  29 -
 .../20170816000000_staticdnsentry_ds_fk.sql        |  36 -
 .../20170816000001_job_deliveryservice_fk.sql      |  36 -
 .../migrations/20170822000000_ds_routing_name.sql  |  26 -
 .../migrations/20170825124926_ignore_routing.sql   |  23 -
 .../20171013000000_change_signing_type.sql         |  51 --
 .../migrations/20171023000000_snapshots_cdn_fk.sql |  36 -
 ...0171027000000_remove_fed_user_role_not_null.sql |  22 -
 ...0171204000000_alter_max_dns_answers_default.sql |  22 -
 .../20171220000000_add_cdn_unique_domain_name.sql  |  23 -
 .../20180110000000_add_deep_caching_type.sql       |  27 -
 .../20180131000000_update_portal_priv_level.sql    |  23 -
 ...180201000000_update_client_steering_headers.sql |  28 -
 .../migrations/20180202000000_add-ds-request.sql   |  50 --
 .../db/migrations/20180314000000_add_fq_pacing.sql |  23 -
 .../20180319000000_ds-request-comments.sql         |  36 -
 ...0180402000000_remove_internal_steering_post.sql |  25 -
 .../20180406000000_last_updated_not_null.sql       | 177 -----
 .../migrations/20180420000000_add_coordinate.sql   |  31 -
 .../20180501000000_remove_job_result_table.sql     |  29 -
 .../20180514000000_add_anonymous_blocking.sql      |  19 -
 ...20180515000000_ds_request_add_anon_blocking.sql |  19 -
 .../db/migrations/20180522000000_add_origin.sql    |  52 --
 .../20180528000000_cache_group_fallback.sql        |  38 -
 .../20180606000000_remove_org_server_fqdn.sql      |  46 --
 .../20180627000000_cachegroup_coordinate.sql       |  67 --
 .../20180801101413_cachegroup_delete_restrict.sql  |  24 -
 ...06000000_add_cachegroup_localization_method.sql |  33 -
 ...180808000000_remove_capabilities_for_reseed.sql |  22 -
 ...180814000625_remove_capabilities_for_reseed.sql |  23 -
 .../20190319000000_add_max_origin_connections.sql  |   1 -
 traffic_ops/app/db/patches.sql                     |  62 --
 traffic_ops/app/db/seeds.sql                       |   8 +-
 52 files changed, 702 insertions(+), 2093 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1d0a6c..9f567cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -50,6 +50,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - Issue 3275: Improved the snapshot diff performance and experience.
 - Issue #3605: Fixed Traffic Monitor custom ports in health polling URL.
 - Issue 3587: Fixed Traffic Ops Golang reverse proxy and Riak logs to be 
consistent with the format of other error logs.
+- Database migrations have been collapsed. Rollbacks to migrations that 
previously existed are no longer possible.
 
 ## [3.0.0] - 2018-10-30
 ### Added
diff --git a/docs/source/admin/traffic_ops/installation.rst 
b/docs/source/admin/traffic_ops/installation.rst
index 9becaca..a910a31 100644
--- a/docs/source/admin/traffic_ops/installation.rst
+++ b/docs/source/admin/traffic_ops/installation.rst
@@ -43,7 +43,7 @@ Installation
                su - postgres -c '/usr/pgsql-9.6/bin/initdb -A md5 -W' #-W 
forces the user to provide a superuser (postgres) password
 
 
-#. Edit ``/var/lib/pgsql/9.6/data/pg_hba.conf`` to allow the Traffic Ops 
instance to access the PostgreSQL server. For example, if the IP address of the 
machine to be used as the Traffic Ops host is ``99.33.99.1`` add the line 
``host  all   all     99.33.99.1/32 md5`` to the appropriate section of this 
file.
+#. Edit ``/var/lib/pgsql/9.6/data/pg_hba.conf`` to allow the Traffic Ops 
instance to access the PostgreSQL server. For example, if the IP address of the 
machine to be used as the Traffic Ops host is ``192.0.2.1`` add the line ``host 
 all   all     192.0.2.1/32 md5`` to the appropriate section of this file.
 
 #. Edit the ``/var/lib/pgsql/9.6/data/postgresql.conf`` file to add the 
appropriate listen_addresses or ``listen_addresses = '*'``, set ``timezone = 
'UTC'``, and start the database
 
@@ -91,10 +91,10 @@ Installation
        .. code-block:: console
                :caption: Creating the Traffic Ops User and Database
 
-               to-# psql -U postgres -h 99.33.99.1 -c "CREATE USER traffic_ops 
WITH ENCRYPTED PASSWORD 'tcr0cks';"
+               to-# psql -U postgres -h pg -c "CREATE USER traffic_ops WITH 
ENCRYPTED PASSWORD 'tcr0cks';"
                Password for user postgres:
                CREATE ROLE
-               to-# createdb traffic_ops --owner traffic_ops -U postgres -h 
99.33.99.1
+               to-# createdb traffic_ops --owner traffic_ops -U postgres -h pg
                Password:
                to-#
 
@@ -111,8 +111,8 @@ Installation
                Database type: Pg
                Database name [traffic_ops]:
                Database name: traffic_ops
-               Database server hostname IP or FQDN [localhost]: 99.33.99.1
-               Database server hostname IP or FQDN: 99.33.99.1
+               Database server hostname IP or FQDN [localhost]: pg
+               Database server hostname IP or FQDN: pg
                Database port number [5432]:
                Database port number: 5432
                Traffic Ops database user [traffic_ops]:
@@ -218,6 +218,8 @@ Upgrading Traffic Ops
 =====================
 To upgrade from older Traffic Ops versions, stop the service, use 
:manpage:`yum(8)` to upgrade to the latest available Traffic Ops package, and 
use the ``admin`` tool to perform the database upgrade.
 
+.. tip:: In order to upgrade to the latest version of Traffic Ops, please be 
sure that you have first upgraded to the latest available minor or patch 
version of your current release. For example, if your current Traffic Ops 
version is 3.0.0 and version 3.1.0 is available, you must first upgrade to 
3.1.0 before proceeding to upgrade to 4.0.0. (Specifically, this means running 
all migrations, :file:`traffic_ops/app/db/seeds.sql`, and 
:file:`traffic_ops/app/db/patches.sql` for the latest of [...]
+
 .. seealso:: :ref:`database-management` for more details about `admin`.
 
 .. code-block:: shell
diff --git a/traffic_ops/app/db/create_tables.sql 
b/traffic_ops/app/db/create_tables.sql
index 12ba3d9..418f9fd 100644
--- a/traffic_ops/app/db/create_tables.sql
+++ b/traffic_ops/app/db/create_tables.sql
@@ -29,7 +29,7 @@ SET client_min_messages = warning;
 SET row_security = off;
 
 --
--- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: 
+-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
 --
 
 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
@@ -58,6 +58,111 @@ SET default_tablespace = '';
 SET default_with_oids = false;
 
 --
+-- Name: change_types; Type: TYPE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TYPE change_types AS ENUM (
+    'create',
+    'update',
+    'delete'
+);
+
+--
+-- Name: deep_caching_type; Type: TYPE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TYPE deep_caching_type AS ENUM (
+    'NEVER',
+    'ALWAYS'
+);
+
+--
+-- Name: http_method_t; Type: TYPE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TYPE http_method_t AS ENUM (
+    'GET',
+    'POST',
+    'PUT',
+    'PATCH',
+    'DELETE'
+);
+
+--
+-- Name: localization_method; Type: TYPE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TYPE localization_method AS ENUM (
+    'CZ',
+    'DEEP_CZ',
+    'GEO'
+);
+
+--
+-- Name: origin_protocol; Type: TYPE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TYPE origin_protocol AS ENUM (
+    'http',
+    'https'
+);
+
+--
+-- Name: profile_type; Type: TYPE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TYPE profile_type AS ENUM (
+    'ATS_PROFILE',
+    'TR_PROFILE',
+    'TM_PROFILE',
+    'TS_PROFILE',
+    'TP_PROFILE',
+    'INFLUXDB_PROFILE',
+    'RIAK_PROFILE',
+    'SPLUNK_PROFILE',
+    'DS_PROFILE',
+    'ORG_PROFILE',
+    'KAFKA_PROFILE',
+    'LOGSTASH_PROFILE',
+    'ES_PROFILE',
+    'UNK_PROFILE',
+    'GROVE_PROFILE'
+);
+
+--
+-- Name: workflow_states; Type: TYPE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TYPE workflow_states AS ENUM (
+    'draft',
+    'submitted',
+    'rejected',
+    'pending',
+    'complete'
+);
+
+--
+-- Name: deliveryservice_signature_type; Type: DOMAIN; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE DOMAIN deliveryservice_signature_type AS text CHECK (VALUE IN 
('url_sig', 'uri_signing'));
+
+--
+-- Name: api_capability; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE api_capability (
+    id bigserial PRIMARY KEY,
+    http_method http_method_t NOT NULL,
+    route text NOT NULL,
+    capability text NOT NULL,
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    UNIQUE (http_method, route, capability)
+);
+
+ALTER TABLE api_capability OWNER TO traffic_ops;
+
+--
 -- Name: asn; Type: TABLE; Schema: public; Owner: traffic_ops
 --
 
@@ -65,7 +170,7 @@ CREATE TABLE asn (
     id bigint NOT NULL,
     asn bigint NOT NULL,
     cachegroup bigint DEFAULT '0'::bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -91,21 +196,20 @@ ALTER TABLE asn_id_seq OWNER TO traffic_ops;
 
 ALTER SEQUENCE asn_id_seq OWNED BY asn.id;
 
-
 --
 -- Name: cachegroup; Type: TABLE; Schema: public; Owner: traffic_ops
 --
 
 CREATE TABLE cachegroup (
-    id bigint NOT NULL,
+    id bigint,
     name text NOT NULL,
     short_name text NOT NULL,
-    latitude numeric,
-    longitude numeric,
     parent_cachegroup_id bigint,
     secondary_parent_cachegroup_id bigint,
     type bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    fallback_to_closest boolean DEFAULT TRUE,
+    coordinate bigint
 );
 
 
@@ -131,6 +235,29 @@ ALTER TABLE cachegroup_id_seq OWNER TO traffic_ops;
 
 ALTER SEQUENCE cachegroup_id_seq OWNED BY cachegroup.id;
 
+--
+-- Name: cachegroup_fallbacks; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE cachegroup_fallbacks (
+    primary_cg bigint NOT NULL,
+    backup_cg bigint NOT NULL CHECK (primary_cg != backup_cg),
+    set_order bigint NOT NULL,
+    UNIQUE (primary_cg, backup_cg),
+    UNIQUE (primary_cg, set_order)
+);
+
+ALTER TABLE cachegroup_fallbacks OWNER TO traffic_ops;
+
+--
+-- Name: cachegroup_localization_method; Type: TABLE; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TABLE cachegroup_localization_method (
+    cachegroup bigint NOT NULL,
+    method localization_method NOT NULL,
+    UNIQUE (cachegroup, method)
+);
 
 --
 -- Name: cachegroup_parameter; Type: TABLE; Schema: public; Owner: traffic_ops
@@ -139,21 +266,35 @@ ALTER SEQUENCE cachegroup_id_seq OWNED BY cachegroup.id;
 CREATE TABLE cachegroup_parameter (
     cachegroup bigint DEFAULT '0'::bigint NOT NULL,
     parameter bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
 ALTER TABLE cachegroup_parameter OWNER TO traffic_ops;
 
 --
+-- Name: capability; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE capability (
+    name text NOT NULL,
+    description text,
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
+);
+
+ALTER TABLE capability OWNER TO traffic_ops;
+
+--
 -- Name: cdn; Type: TABLE; Schema: public; Owner: traffic_ops
 --
 
 CREATE TABLE cdn (
-    id bigint NOT NULL,
-    name text,
+    id bigint,
+    name text NOT NULL,
     last_updated timestamp with time zone DEFAULT now() NOT NULL,
-    dnssec_enabled boolean DEFAULT false NOT NULL
+    dnssec_enabled boolean DEFAULT false NOT NULL,
+    domain_name text NOT NULL,
+    CONSTRAINT cdn_domain_name_unique UNIQUE (domain_name)
 );
 
 
@@ -179,26 +320,36 @@ ALTER TABLE cdn_id_seq OWNER TO traffic_ops;
 
 ALTER SEQUENCE cdn_id_seq OWNED BY cdn.id;
 
+--
+-- Name: coordinate; Type: TABLE; Schema: public: Owner: traffic_ops
+--
+
+CREATE TABLE coordinate (
+    id bigserial,
+    name text UNIQUE NOT NULL,
+    latitude numeric NOT NULL DEFAULT 0.0,
+    longitude numeric NOT NULL DEFAULT 0.0,
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
+);
 
 --
 -- Name: deliveryservice; Type: TABLE; Schema: public; Owner: traffic_ops
 --
 
 CREATE TABLE deliveryservice (
-    id bigint NOT NULL,
+    id bigint,
     xml_id text NOT NULL,
     active boolean DEFAULT false NOT NULL,
     dscp bigint NOT NULL,
-    signed boolean DEFAULT false,
+    signing_algorithm deliveryservice_signature_type,
     qstring_ignore smallint,
     geo_limit smallint DEFAULT '0'::smallint,
     http_bypass_fqdn text,
     dns_bypass_ip text,
     dns_bypass_ip6 text,
     dns_bypass_ttl bigint,
-    org_server_fqdn text,
     type bigint NOT NULL,
-    profile bigint NOT NULL,
+    profile bigint,
     cdn_id bigint NOT NULL,
     ccr_dns_ttl bigint,
     global_max_mbps bigint,
@@ -211,7 +362,7 @@ CREATE TABLE deliveryservice (
     miss_lat numeric,
     miss_long numeric,
     check_path text,
-    last_updated timestamp with time zone DEFAULT now(),
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
     protocol smallint DEFAULT '0'::smallint,
     ssl_key_version bigint DEFAULT '0'::bigint,
     ipv6_routing_enabled boolean DEFAULT false,
@@ -233,7 +384,13 @@ CREATE TABLE deliveryservice (
     geo_limit_countries text,
     logs_enabled boolean DEFAULT false,
     multi_site_origin_algorithm smallint,
-    geolimit_redirect_url text
+    geolimit_redirect_url text,
+    tenant_id bigint NOT NULL,
+    routing_name text NOT NULL DEFAULT 'cdn',
+    deep_caching_type deep_caching_type NOT NULL DEFAULT 'NEVER',
+    fq_pacing_rate bigint DEFAULT 0,
+    anonymous_blocking_enabled boolean NOT NULL DEFAULT FALSE,
+    CONSTRAINT routing_name_not_empty CHECK ((length(routing_name) > 0))
 );
 
 
@@ -267,20 +424,51 @@ ALTER SEQUENCE deliveryservice_id_seq OWNED BY 
deliveryservice.id;
 CREATE TABLE deliveryservice_regex (
     deliveryservice bigint NOT NULL,
     regex bigint NOT NULL,
-    set_number bigint DEFAULT '0'::bigint
+    set_number bigint DEFAULT '0'::bigint,
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
 ALTER TABLE deliveryservice_regex OWNER TO traffic_ops;
 
 --
+-- Name: deliveryservice_request; Type: TABLE; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TABLE deliveryservice_request (
+    assignee_id bigint,
+    author_id bigint NOT NULL,
+    change_type change_types NOT NULL,
+    created_at timestamp with time zone NOT NULL DEFAULT now(),
+    id bigserial,
+    last_edited_by_id bigint NOT NULL,
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    deliveryservice jsonb NOT NULL,
+    status workflow_states NOT NULL
+);
+
+ALTER TABLE deliveryservice_request OWNER TO traffic_ops;
+
+--
+-- Name: deliveryservice_request_comment; Type: TABLE; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TABLE deliveryservice_request_comment (
+    author_id bigint NOT NULL,
+    deliveryservice_request_id bigint NOT NULL,
+    id bigserial,
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    value text NOT NULL
+);
+
+--
 -- Name: deliveryservice_server; Type: TABLE; Schema: public; Owner: 
traffic_ops
 --
 
 CREATE TABLE deliveryservice_server (
     deliveryservice bigint NOT NULL,
     server bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone DEFAULT now() NOT NULL
 );
 
 
@@ -293,7 +481,7 @@ ALTER TABLE deliveryservice_server OWNER TO traffic_ops;
 CREATE TABLE deliveryservice_tmuser (
     deliveryservice bigint NOT NULL,
     tm_user_id bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -306,7 +494,7 @@ ALTER TABLE deliveryservice_tmuser OWNER TO traffic_ops;
 CREATE TABLE division (
     id bigint NOT NULL,
     name text NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -342,7 +530,7 @@ CREATE TABLE federation (
     cname text NOT NULL,
     description text,
     ttl integer NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -355,7 +543,7 @@ ALTER TABLE federation OWNER TO traffic_ops;
 CREATE TABLE federation_deliveryservice (
     federation bigint NOT NULL,
     deliveryservice bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -368,7 +556,7 @@ ALTER TABLE federation_deliveryservice OWNER TO traffic_ops;
 CREATE TABLE federation_federation_resolver (
     federation bigint NOT NULL,
     federation_resolver bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -403,7 +591,7 @@ CREATE TABLE federation_resolver (
     id bigint NOT NULL,
     ip_address text NOT NULL,
     type bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -437,8 +625,8 @@ ALTER SEQUENCE federation_resolver_id_seq OWNED BY 
federation_resolver.id;
 CREATE TABLE federation_tmuser (
     federation bigint NOT NULL,
     tm_user bigint NOT NULL,
-    role bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    role bigint,
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -453,7 +641,7 @@ CREATE TABLE hwinfo (
     serverid bigint NOT NULL,
     description text NOT NULL,
     val text NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -497,7 +685,7 @@ CREATE TABLE job (
     start_time timestamp with time zone NOT NULL,
     entered_time timestamp with time zone NOT NULL,
     job_user bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now(),
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
     job_deliveryservice bigint
 );
 
@@ -513,7 +701,8 @@ CREATE TABLE job_agent (
     name text,
     description text,
     active integer DEFAULT 0 NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    CONSTRAINT job_agent_name_unique UNIQUE (name)
 );
 
 
@@ -561,42 +750,6 @@ ALTER TABLE job_id_seq OWNER TO traffic_ops;
 ALTER SEQUENCE job_id_seq OWNED BY job.id;
 
 --
--- Name: job_result; Type: TABLE; Schema: public; Owner: traffic_ops
---
-
-CREATE TABLE job_result (
-    id bigint NOT NULL,
-    job bigint NOT NULL,
-    agent bigint NOT NULL,
-    result text NOT NULL,
-    description text,
-    last_updated timestamp with time zone DEFAULT now()
-);
-
-
-ALTER TABLE job_result OWNER TO traffic_ops;
-
---
--- Name: job_result_id_seq; Type: SEQUENCE; Schema: public; Owner: traffic_ops
---
-
-CREATE SEQUENCE job_result_id_seq
-    START WITH 1
-    INCREMENT BY 1
-    NO MINVALUE
-    NO MAXVALUE
-    CACHE 1;
-
-
-ALTER TABLE job_result_id_seq OWNER TO traffic_ops;
-
---
--- Name: job_result_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: 
traffic_ops
---
-
-ALTER SEQUENCE job_result_id_seq OWNED BY job_result.id;
-
---
 -- Name: job_status; Type: TABLE; Schema: public; Owner: traffic_ops
 --
 
@@ -604,7 +757,8 @@ CREATE TABLE job_status (
     id bigint NOT NULL,
     name text,
     description text,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    CONSTRAINT job_status_name_unique UNIQUE (name)
 );
 
 
@@ -641,7 +795,7 @@ CREATE TABLE log (
     message text NOT NULL,
     tm_user bigint NOT NULL,
     ticketnum text,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -667,6 +821,28 @@ ALTER TABLE log_id_seq OWNER TO traffic_ops;
 
 ALTER SEQUENCE log_id_seq OWNED BY log.id;
 
+--
+-- Name: origin; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE origin (
+    id bigserial NOT NULL,
+    name text UNIQUE NOT NULL,
+    fqdn text NOT NULL,
+    protocol origin_protocol NOT NULL DEFAULT 'http',
+    is_primary boolean NOT NULL DEFAULT FALSE,
+    port bigint, -- TODO: port numbers have a max of 65535 - this could be 
just an integer
+    ip_address text, -- TODO: these should be inet type, not text
+    ip6_address text,
+    deliveryservice bigint NOT NULL,
+    coordinate bigint,
+    profile bigint,
+    cachegroup bigint,
+    tenant bigint NOT NULL,
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
+);
+
+ALTER TABLE origin OWNER TO traffic_ops;
 
 --
 -- Name: parameter; Type: TABLE; Schema: public; Owner: traffic_ops
@@ -677,8 +853,9 @@ CREATE TABLE parameter (
     name text NOT NULL,
     config_file text,
     value text NOT NULL,
-    last_updated timestamp with time zone DEFAULT now(),
-    secure boolean DEFAULT false NOT NULL
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    secure boolean DEFAULT false NOT NULL,
+    CONSTRAINT unique_param UNIQUE (name, config_file, value)
 );
 
 
@@ -722,7 +899,7 @@ CREATE TABLE phys_location (
     email text,
     comments text,
     region bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -748,7 +925,6 @@ ALTER TABLE phys_location_id_seq OWNER TO traffic_ops;
 
 ALTER SEQUENCE phys_location_id_seq OWNED BY phys_location.id;
 
-
 --
 -- Name: profile; Type: TABLE; Schema: public; Owner: traffic_ops
 --
@@ -757,7 +933,10 @@ CREATE TABLE profile (
     id bigint NOT NULL,
     name text NOT NULL,
     description text,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    type profile_type NOT NULL,
+    cdn bigint NOT NULL,
+    routing_disabled boolean NOT NULL DEFAULT FALSE
 );
 
 
@@ -791,7 +970,7 @@ ALTER SEQUENCE profile_id_seq OWNED BY profile.id;
 CREATE TABLE profile_parameter (
     profile bigint NOT NULL,
     parameter bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -805,7 +984,7 @@ CREATE TABLE regex (
     id bigint NOT NULL,
     pattern text DEFAULT ''::text NOT NULL,
     type bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -840,7 +1019,7 @@ CREATE TABLE region (
     id bigint NOT NULL,
     name text NOT NULL,
     division bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -872,10 +1051,12 @@ ALTER SEQUENCE region_id_seq OWNED BY region.id;
 --
 
 CREATE TABLE role (
-    id bigint NOT NULL,
+    id bigint,
     name text NOT NULL,
     description text,
-    priv_level bigint NOT NULL
+    priv_level bigint NOT NULL,
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    CONSTRAINT role_name_unique UNIQUE (name)
 );
 
 
@@ -901,6 +1082,18 @@ ALTER TABLE role_id_seq OWNER TO traffic_ops;
 
 ALTER SEQUENCE role_id_seq OWNED BY role.id;
 
+--
+-- Name: role_capability; Type TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE role_capability (
+    role_id bigint NOT NULL,
+    cap_name text NOT NULL,
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    UNIQUE (role_id, cap_name)
+);
+
+ALTER TABLE role_capability OWNER TO traffic_ops;
 
 --
 -- Name: server; Type: TABLE; Schema: public; Owner: traffic_ops
@@ -940,8 +1133,9 @@ CREATE TABLE server (
     router_host_name text,
     router_port_name text,
     guid text,
-    last_updated timestamp with time zone DEFAULT now(),
-    https_port bigint
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    https_port bigint,
+    reval_pending boolean NOT NULL DEFAULT FALSE
 );
 
 
@@ -1006,7 +1200,7 @@ CREATE TABLE servercheck (
     bc bigint,
     bd bigint,
     be bigint,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -1032,6 +1226,17 @@ ALTER TABLE servercheck_id_seq OWNER TO traffic_ops;
 
 ALTER SEQUENCE servercheck_id_seq OWNED BY servercheck.id;
 
+--
+-- Name: snapshot; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE snapshot (
+    cdn text NOT NULL,
+    content json NOT NULL,
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
+);
+
+ALTER TABLE snapshot OWNER TO traffic_ops;
 
 --
 -- Name: staticdnsentry; Type: TABLE; Schema: public; Owner: traffic_ops
@@ -1045,7 +1250,7 @@ CREATE TABLE staticdnsentry (
     ttl bigint DEFAULT '3600'::bigint NOT NULL,
     deliveryservice bigint NOT NULL,
     cachegroup bigint,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
 );
 
 
@@ -1118,7 +1323,8 @@ CREATE TABLE status (
     id bigint NOT NULL,
     name text NOT NULL,
     description text,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    CONSTRAINT status_name_unique UNIQUE (name)
 );
 
 
@@ -1152,14 +1358,27 @@ ALTER SEQUENCE status_id_seq OWNED BY status.id;
 CREATE TABLE steering_target (
     deliveryservice bigint NOT NULL,
     target bigint NOT NULL,
-    weight bigint NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
+    value bigint NOT NULL,
+    last_updated timestamp with time zone DEFAULT now() NOT NULL,
+    type bigint NOT NULL
 );
 
 
 ALTER TABLE steering_target OWNER TO traffic_ops;
 
 --
+-- Name: tenant; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE tenant (
+    id bigserial,
+    name text UNIQUE NOT NULL,
+    active boolean NOT NULL DEFAULT FALSE,
+    parent_id bigint DEFAULT 1 CHECK (id != parent_id),
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
+);
+
+--
 -- Name: tm_user; Type: TABLE; Schema: public; Owner: traffic_ops
 --
 
@@ -1172,7 +1391,7 @@ CREATE TABLE tm_user (
     gid bigint,
     local_passwd text,
     confirm_local_passwd text,
-    last_updated timestamp with time zone DEFAULT now(),
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
     company text,
     email text,
     full_name text,
@@ -1185,7 +1404,8 @@ CREATE TABLE tm_user (
     postal_code text,
     country text,
     token text,
-    registration_sent timestamp with time zone
+    registration_sent timestamp with time zone,
+    tenant_id bigint NOT NULL
 );
 
 
@@ -1264,7 +1484,8 @@ CREATE TABLE type (
     name text NOT NULL,
     description text,
     use_in_table text,
-    last_updated timestamp with time zone DEFAULT now()
+    last_updated timestamp with time zone NOT NULL DEFAULT now(),
+    CONSTRAINT type_name_unique UNIQUE(name)
 );
 
 
@@ -1290,6 +1511,28 @@ ALTER TABLE type_id_seq OWNER TO traffic_ops;
 
 ALTER SEQUENCE type_id_seq OWNED BY type.id;
 
+--
+-- Name: user_role; Type: TABLE; Schema: public; Owner: traffic_ops
+--
+
+CREATE TABLE user_role (
+    user_id bigint NOT NULL,
+    role_id bigint NOT NULL,
+    last_updated timestamp with time zone NOT NULL DEFAULT now()
+);
+
+ALTER TABLE user_role OWNER TO traffic_ops;
+
+--
+-- Name: profile_type_values; Type: VIEW; Schema: public; Owner: traffic_ops
+--
+
+CREATE VIEW profile_type_values AS
+    SELECT unnest(enum_range(NULL::profile_type)) AS VALUE
+        ORDER BY (unnest(enum_range(NULL::profile_type)));
+
+
+ALTER TABLE profile_type_values OWNER TO traffic_ops;
 
 --
 -- Name: id; Type: DEFAULT; Schema: public; Owner: traffic_ops
@@ -1472,7 +1715,6 @@ ALTER TABLE ONLY to_extension ALTER COLUMN id SET DEFAULT 
nextval('to_extension_
 
 ALTER TABLE ONLY type ALTER COLUMN id SET DEFAULT 
nextval('type_id_seq'::regclass);
 
-
 --
 -- Name: idx_89468_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
 --
@@ -1488,7 +1730,6 @@ ALTER TABLE ONLY asn
 ALTER TABLE ONLY cachegroup
     ADD CONSTRAINT idx_89476_primary PRIMARY KEY (id, type);
 
-
 --
 -- Name: idx_89484_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
 --
@@ -1496,6 +1737,12 @@ ALTER TABLE ONLY cachegroup
 ALTER TABLE ONLY cachegroup_parameter
     ADD CONSTRAINT idx_89484_primary PRIMARY KEY (cachegroup, parameter);
 
+--
+-- Name: capability_pkey; Type: CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY capability
+    ADD CONSTRAINT capability_pkey PRIMARY KEY (name);
 
 --
 -- Name: idx_89491_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
@@ -1504,6 +1751,12 @@ ALTER TABLE ONLY cachegroup_parameter
 ALTER TABLE ONLY cdn
     ADD CONSTRAINT idx_89491_primary PRIMARY KEY (id);
 
+--
+-- Name: coordinate_pkey; Type: CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY coordinate
+    ADD CONSTRAINT coordinate_pkey PRIMARY KEY (id);
 
 --
 -- Name: idx_89502_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
@@ -1520,6 +1773,19 @@ ALTER TABLE ONLY deliveryservice
 ALTER TABLE ONLY deliveryservice_regex
     ADD CONSTRAINT idx_89517_primary PRIMARY KEY (deliveryservice, regex);
 
+--
+-- Name: deliveryservice_request_pkey; Type: CONSTRAINT; Schema: public; 
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY deliveryservice_request
+    ADD CONSTRAINT deliveryservice_request_pkey PRIMARY KEY (id);
+
+--
+-- Name: deliveryservice_request_comment_pkey; Type: CONSTRAINT; Schema: 
public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY deliveryservice_request_comment
+    ADD CONSTRAINT deliveryservice_request_comment_pkey PRIMARY KEY (id);
 
 --
 -- Name: idx_89521_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
@@ -1616,7 +1882,6 @@ ALTER TABLE ONLY job_agent
 ALTER TABLE ONLY job_status
     ADD CONSTRAINT idx_89624_primary PRIMARY KEY (id);
 
-
 --
 -- Name: idx_89634_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
 --
@@ -1624,6 +1889,12 @@ ALTER TABLE ONLY job_status
 ALTER TABLE ONLY log
     ADD CONSTRAINT idx_89634_primary PRIMARY KEY (id, tm_user);
 
+--
+-- Name: origin_pkey; Type: CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY origin
+    ADD CONSTRAINT origin_pkey PRIMARY KEY (id);
 
 --
 -- Name: idx_89644_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
@@ -1680,7 +1951,6 @@ ALTER TABLE ONLY region
 ALTER TABLE ONLY role
     ADD CONSTRAINT idx_89700_primary PRIMARY KEY (id);
 
-
 --
 -- Name: idx_89709_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
 --
@@ -1696,6 +1966,12 @@ ALTER TABLE ONLY server
 ALTER TABLE ONLY servercheck
     ADD CONSTRAINT idx_89722_primary PRIMARY KEY (id, server);
 
+--
+-- Name: snapshot_pkey; Type: CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY snapshot
+    ADD CONSTRAINT snapshot_pkey PRIMARY KEY (cdn);
 
 --
 -- Name: idx_89729_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
@@ -1728,6 +2004,12 @@ ALTER TABLE ONLY status
 ALTER TABLE ONLY steering_target
     ADD CONSTRAINT idx_89759_primary PRIMARY KEY (deliveryservice, target);
 
+--
+-- Name: tenant_pkey; Type: CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY tenant
+    ADD CONSTRAINT tenant_pkey PRIMARY KEY (id);
 
 --
 -- Name: idx_89765_primary; Type: CONSTRAINT; Schema: public; Owner: 
traffic_ops
@@ -1752,7 +2034,6 @@ ALTER TABLE ONLY to_extension
 ALTER TABLE ONLY type
     ADD CONSTRAINT idx_89786_primary PRIMARY KEY (id);
 
-
 --
 -- Name: idx_89468_cr_id_unique; Type: INDEX; Schema: public; Owner: 
traffic_ops
 --
@@ -1822,13 +2103,17 @@ CREATE INDEX idx_89484_fk_parameter ON 
cachegroup_parameter USING btree (paramet
 
 CREATE UNIQUE INDEX idx_89491_cdn_cdn_unique ON cdn USING btree (name);
 
-
 --
 -- Name: idx_89502_ds_id_unique; Type: INDEX; Schema: public; Owner: 
traffic_ops
 --
 
 CREATE UNIQUE INDEX idx_89502_ds_id_unique ON deliveryservice USING btree (id);
 
+--
+-- Name: idx_k_deliveryservice_tenant_idx; Type: INDEX; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE INDEX idx_k_deliveryservice_tenant_idx ON deliveryservice USING btree 
(tenant_id);
 
 --
 -- Name: idx_89502_ds_name_unique; Type: INDEX; Schema: public; Owner: 
traffic_ops
@@ -2032,6 +2317,12 @@ CREATE UNIQUE INDEX idx_89655_short_name_unique ON 
phys_location USING btree (sh
 
 CREATE UNIQUE INDEX idx_89665_name_unique ON profile USING btree (name);
 
+--
+-- Name: idx_181818_fk_cdn1; Type: INDEX; Schema: public; Owner: traffic_ops
+--
+
+CREATE INDEX idx_181818_fk_cdn1 ON profile USING btree (cdn);
+
 
 --
 -- Name: idx_89673_fk_atsprofile_atsparameters_atsparameters1; Type: INDEX; 
Schema: public; Owner: traffic_ops
@@ -2186,6 +2477,11 @@ CREATE INDEX idx_89729_fk_staticdnsentry_ds ON 
staticdnsentry USING btree (deliv
 
 CREATE INDEX idx_89729_fk_staticdnsentry_type ON staticdnsentry USING btree 
(type);
 
+--
+-- Name: idx_k_tenant_parent_tenant_idx; Type: INDEX; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE INDEX idx_k_tenant_parent_tenant_idx ON tenant USING btree (parent_id);
 
 --
 -- Name: idx_89765_fk_user_1; Type: INDEX; Schema: public; Owner: traffic_ops
@@ -2193,6 +2489,11 @@ CREATE INDEX idx_89729_fk_staticdnsentry_type ON 
staticdnsentry USING btree (typ
 
 CREATE INDEX idx_89765_fk_user_1 ON tm_user USING btree (role);
 
+--
+-- Name: idx_k_tm_user_tenant_idx; Type: INDEX; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE INDEX idx_k_tm_user_tenant_idx ON tm_user USING btree (tenant_id);
 
 --
 -- Name: idx_89765_tmuser_email_unique; Type: INDEX; Schema: public; Owner: 
traffic_ops
@@ -2221,6 +2522,60 @@ CREATE INDEX idx_89776_fk_ext_type_idx ON to_extension 
USING btree (type);
 
 CREATE UNIQUE INDEX idx_89776_id_unique ON to_extension USING btree (id);
 
+--
+-- Name: cachegroup_coordinate_fkey; Type: INDEX; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE INDEX cachegroup_coordinate_fkey ON cachegroup USING btree (coordinate);
+
+--
+-- Name: cachegroup_localization_method_cachegroup_fkey; Type: INDEX; Schema: 
public; Owner: traffic_ops
+--
+
+CREATE INDEX cachegroup_localization_method_cachegroup_fkey ON 
cachegroup_localization_method USING btree(cachegroup);
+
+--
+-- Name: origin_is_primary_deliveryservice_constraint; Type: INDEX; Schema: 
public; Owner: traffic_ops
+--
+
+CREATE UNIQUE INDEX origin_is_primary_deliveryservice_constraint ON origin 
(is_primary, deliveryservice) WHERE is_primary;
+
+--
+-- Name: origin_deliveryservice_fkey; Type: INDEX; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE INDEX origin_deliveryservice_fkey ON origin USING btree 
(deliveryservice);
+
+--
+-- Name: origin_coordinate_fkey; Type: INDEX; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE INDEX origin_coordinate_fkey ON origin USING btree (coordinate);
+
+--
+-- Name: origin_profile_fkey; Type: INDEX; Schema: public; Owner: traffic_ops
+--
+
+CREATE INDEX origin_profile_fkey ON origin USING btree (profile);
+
+--
+-- Name: origin_cachegroup_fkey; Type: INDEX; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE INDEX origin_cachegroup_fkey ON origin USING btree (cachegroup);
+
+--
+-- Name: origin_tenant_fkey; Type: INDEX; Schema: public; Owner: traffic_ops
+--
+
+CREATE INDEX origin_tenant_fkey ON origin USING btree (tenant);
+
+
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON api_capability FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
 --
 -- Name: idx_89786_name_unique; Type: INDEX; Schema: public; Owner: traffic_ops
@@ -2242,6 +2597,11 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON cachegroup FOR EACH
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
cachegroup_parameter FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
 
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON capability FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
 --
 -- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
@@ -2249,6 +2609,11 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON cachegroup_parameter
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON cdn FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON coordinate FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
 --
 -- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
@@ -2256,6 +2621,23 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON cdn FOR EACH ROW EXE
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON deliveryservice 
FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
deliveryservice_regex FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
+
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
deliveryservice_request FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
+
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
deliveryservice_request_comment FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
 
 --
 -- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
@@ -2333,7 +2715,6 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON job FOR EACH ROW EXE
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON job_agent FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
-
 --
 -- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
 --
@@ -2347,6 +2728,11 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON job_status FOR EACH
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON log FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON origin FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
 --
 -- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
@@ -2389,6 +2775,17 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON regex FOR EACH ROW E
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON region FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON role FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
+
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON role_capability 
FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
 --
 -- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
@@ -2403,6 +2800,11 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON server FOR EACH ROW
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON servercheck FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON snapshot FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
 --
 -- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
@@ -2424,6 +2826,11 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON status FOR EACH ROW
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON steering_target 
FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON tenant FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
 --
 -- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
@@ -2438,6 +2845,11 @@ CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE 
ON tm_user FOR EACH ROW
 
 CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON type FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
+--
+-- Name: on_update_current_timestamp; Type: TRIGGER; Schema: public; Owner: 
traffic_ops
+--
+
+CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON user_role FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
 
 --
 -- Name: fk_atsprofile_atsparameters_atsparameters1; Type: FK CONSTRAINT; 
Schema: public; Owner: traffic_ops
@@ -2684,7 +3096,7 @@ ALTER TABLE ONLY job
 --
 
 ALTER TABLE ONLY job
-    ADD CONSTRAINT fk_job_deliveryservice1 FOREIGN KEY (job_deliveryservice) 
REFERENCES deliveryservice(id);
+    ADD CONSTRAINT fk_job_deliveryservice1 FOREIGN KEY (job_deliveryservice) 
REFERENCES deliveryservice(id) ON DELETE CASCADE ON UPDATE CASCADE;
 
 
 --
@@ -2748,7 +3160,7 @@ ALTER TABLE ONLY region
 --
 
 ALTER TABLE ONLY server
-    ADD CONSTRAINT fk_server_cachegroup1 FOREIGN KEY (cachegroup) REFERENCES 
cachegroup(id) ON UPDATE RESTRICT ON DELETE CASCADE;
+    ADD CONSTRAINT fk_server_cachegroup1 FOREIGN KEY (cachegroup) REFERENCES 
cachegroup(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
 
 
 --
@@ -2772,7 +3184,7 @@ ALTER TABLE ONLY staticdnsentry
 --
 
 ALTER TABLE ONLY staticdnsentry
-    ADD CONSTRAINT fk_staticdnsentry_ds FOREIGN KEY (deliveryservice) 
REFERENCES deliveryservice(id);
+    ADD CONSTRAINT fk_staticdnsentry_ds FOREIGN KEY (deliveryservice) 
REFERENCES deliveryservice(id) ON DELETE CASCADE ON UPDATE CASCADE;
 
 
 --
@@ -2796,7 +3208,7 @@ ALTER TABLE ONLY steering_target
 --
 
 ALTER TABLE ONLY steering_target
-    ADD CONSTRAINT fk_steering_target_target FOREIGN KEY (deliveryservice) 
REFERENCES deliveryservice(id) ON UPDATE CASCADE ON DELETE CASCADE;
+    ADD CONSTRAINT fk_steering_target_target FOREIGN KEY (target) REFERENCES 
deliveryservice(id) ON UPDATE CASCADE ON DELETE CASCADE;
 
 
 --
@@ -2824,6 +3236,182 @@ ALTER TABLE ONLY tm_user
 
 
 --
+-- Name: fk_capability; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY api_capability
+    ADD CONSTRAINT fk_capability FOREIGN KEY (capability) REFERENCES 
capability (name) ON DELETE RESTRICT;
+
+--
+-- Name: steering_target_type_fkey; Type: FK CONSTRAINT; Schema: public; 
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY steering_target
+    ADD CONSTRAINT steering_target_type_fkey FOREIGN KEY (type) REFERENCES 
type (id);
+
+--
+-- Name: fk_tenantid; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY deliveryservice
+    ADD CONSTRAINT fk_tenantid FOREIGN KEY (tenant_id) REFERENCES tenant (id) 
MATCH FULL;
+
+--
+-- Name: fk_author; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY deliveryservice_request
+    ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES tm_user(id) ON 
DELETE CASCADE;
+
+--
+-- Name: fk_assignee; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY deliveryservice_request
+    ADD CONSTRAINT fk_assignee FOREIGN KEY (assignee_id) REFERENCES 
tm_user(id) ON DELETE SET NULL;
+
+--
+-- Name: fk_last_edited_by; Type: FK CONSTRAINT; Schema: public; Owner: 
traffic_ops
+--
+
+ALTER TABLE ONLY deliveryservice_request
+    ADD CONSTRAINT fk_last_edited_by FOREIGN KEY (last_edited_by_id) 
REFERENCES tm_user (id) ON DELETE CASCADE;
+
+--
+-- Name: fk_author; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY deliveryservice_request_comment
+    ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES tm_user (id) 
ON DELETE CASCADE;
+
+--
+-- Name: origin_profile_fkey; Type: FK CONSTRAINT; Schema: public; Owner: 
traffic_ops
+--
+
+ALTER TABLE ONLY origin
+    ADD CONSTRAINT origin_profile_fkey FOREIGN KEY (profile) REFERENCES 
profile (id) ON DELETE RESTRICT;
+
+--
+-- Name: origin_deliveryservice_fkey; Type: FK CONSTRAINT; Schema: public; 
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY origin
+    ADD CONSTRAINT origin_deliveryservice_fkey FOREIGN KEY (deliveryservice) 
REFERENCES deliveryservice (id) ON DELETE CASCADE;
+
+--
+-- Name: origin_coordinate_fkey; Type: FK CONSTRAINT; Schema: public; Owner: 
traffic_ops
+--
+
+ALTER TABLE ONLY origin
+    ADD CONSTRAINT origin_coordinate_fkey FOREIGN KEY (coordinate) REFERENCES 
coordinate (id) ON DELETE RESTRICT;
+
+--
+-- Name: origin_cachegroup_fkey; Type: FK CONSTRAINT; Schema: public; Owner: 
traffic_ops
+--
+
+ALTER TABLE ONLY origin
+    ADD CONSTRAINT origin_cachegroup_fkey FOREIGN KEY (cachegroup) REFERENCES 
cachegroup (id) ON DELETE RESTRICT;
+
+--
+-- Name: origin_tenant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: 
traffic_ops
+--
+
+ALTER TABLE ONLY origin
+    ADD CONSTRAINT origin_tenant_fkey FOREIGN KEY (tenant) REFERENCES tenant 
(id) ON DELETE RESTRICT;
+
+--
+-- Name: cachegroup_coordinate_fkey; Type: FK CONSTRAINT; Schema: public; 
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cachegroup
+    ADD CONSTRAINT cachegroup_coordinate_fkey FOREIGN KEY (coordinate) 
REFERENCES coordinate (id);
+
+--
+-- Name: fk_primary_cg; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cachegroup_fallbacks
+    ADD CONSTRAINT fk_primary_cg FOREIGN KEY (primary_cg) REFERENCES 
cachegroup (id) ON DELETE CASCADE;
+
+--
+-- Name: fk_backup_cg; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cachegroup_fallbacks
+    ADD CONSTRAINT fk_backup_cg FOREIGN KEY (backup_cg) REFERENCES cachegroup 
(id) ON DELETE CASCADE;
+
+--
+-- Name: cachegroup_localization_method_cachegroup_fkey; Type: FK CONSTRAINT; 
Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY cachegroup_localization_method
+    ADD CONSTRAINT cachegroup_localization_method_cachegroup_fkey FOREIGN KEY 
(cachegroup) REFERENCES cachegroup (id) ON DELETE CASCADE;
+
+--
+-- Name: fk_deliveryservice_request; Type: FK CONSTRAINT; Schema: public; 
Owner: traffic_ops
+--
+
+ALTER TABLE ONLY deliveryservice_request_comment
+    ADD CONSTRAINT fk_deliveryservice_request FOREIGN KEY 
(deliveryservice_request_id) REFERENCES deliveryservice_request (id) ON DELETE 
CASCADE;
+
+--
+-- Name: fk_cdn1; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY profile
+    ADD CONSTRAINT fk_cdn1 FOREIGN KEY (cdn) REFERENCES cdn (id) ON UPDATE 
RESTRICT ON DELETE RESTRICT;
+
+--
+-- Name: fk_role_id; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY role_capability
+    ADD CONSTRAINT fk_role_id FOREIGN KEY (role_id) REFERENCES role (id) ON 
DELETE CASCADE;
+
+--
+-- Name: fk_cap_name; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY role_capability
+    ADD CONSTRAINT fk_cap_name FOREIGN KEY (cap_name) REFERENCES capability 
(name) ON DELETE RESTRICT;
+
+--
+-- Name: snapshot_cdn_fkey; Type: FK CONSTRAINT; Schema: public; Owner: 
traffic_ops
+--
+
+ALTER TABLE ONLY snapshot
+    ADD CONSTRAINT snapshot_cdn_fkey FOREIGN KEY (cdn) REFERENCES cdn (name) 
ON UPDATE CASCADE ON DELETE CASCADE;
+
+--
+-- Name: fk_parentid; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY tenant
+    ADD CONSTRAINT fk_parentid FOREIGN KEY (parent_id) REFERENCES tenant (id);
+
+--
+-- Name: fk_tenantid; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY tm_user
+    ADD CONSTRAINT fk_tenantid FOREIGN KEY (tenant_id) REFERENCES tenant (id) 
MATCH FULL;
+
+--
+-- Name: fk_user_1; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY user_role
+    ADD CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES tm_user (id) ON 
DELETE CASCADE;
+
+--
+-- Name: fk_role_id; Type: FK CONSTRAINT; Schema: public; Owner: traffic_ops
+--
+
+ALTER TABLE ONLY user_role
+    ADD CONSTRAINT fk_role_id FOREIGN KEY (role_id) REFERENCES role (id) ON 
DELETE RESTRICT;
+
+
+--
 -- Name: public; Type: ACL; Schema: -; Owner: traffic_ops
 --
 
diff --git 
a/traffic_ops/app/db/migrations/20161208000000_alter_cdn_name_not_null.sql 
b/traffic_ops/app/db/migrations/20161208000000_alter_cdn_name_not_null.sql
deleted file mode 100644
index a11d269..0000000
--- a/traffic_ops/app/db/migrations/20161208000000_alter_cdn_name_not_null.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE CDN ALTER COLUMN NAME SET NOT NULL;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE CDN ALTER COLUMN NAME SET NULL;
-
diff --git a/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql 
b/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
deleted file mode 100644
index d5c2d9a..0000000
--- a/traffic_ops/app/db/migrations/20161208000001_create_snapshots.sql
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
--- snapshots
-CREATE TABLE snapshot (
-    cdn text primary key REFERENCES cdn (name) ON UPDATE CASCADE NOT NULL,
-    content json NOT NULL,
-    last_updated timestamp with time zone DEFAULT now()
-);
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON snapshot FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TRIGGER on_update_current_timestamp ON snapshot;
-
-DROP TABLE snapshot;
diff --git 
a/traffic_ops/app/db/migrations/20170205101432_cdn_table_domain_name.go 
b/traffic_ops/app/db/migrations/20170205101432_cdn_table_domain_name.go
deleted file mode 100644
index 89bb5e1..0000000
--- a/traffic_ops/app/db/migrations/20170205101432_cdn_table_domain_name.go
+++ /dev/null
@@ -1,273 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-
-// http://www.apache.org/licenses/LICENSE-2.0
-
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file was initially generated by gen_to_start.go (add link), as a start
-// of the Traffic Ops golang data model
-
-package main
-
-import (
-       "database/sql"
-       "fmt"
-       "os"
-       "regexp"
-       "strings"
-)
-
-func checkErr(err error, txn *sql.Tx) {
-       if err != nil {
-               fmt.Println("Error 33:", err)
-               fmt.Println("Attempting Roll back!")
-               txn.Rollback()
-               os.Exit(1)
-       }
-}
-
-func doExec(stmt string, txn *sql.Tx) {
-       fmt.Println("  " + stmt)
-       _, err := txn.Exec(stmt)
-       if err != nil {
-               fmt.Println("Error:", err)
-               fmt.Println("Attempting Roll back!")
-               txn.Rollback()
-               os.Exit(1)
-       }
-}
-
-// Up is executed when this migration is applied
-func Up_20170205101432(txn *sql.Tx) {
-
-       algorithmStr := map[int64]string{
-               0: "consistent_hash",
-               1: "false",
-               2: "strict",
-               3: "true",
-               4: "latched",
-       }
-
-       fmt.Println("  Starting migration 20170205101432...")
-       doExec("CREATE TYPE profile_type AS ENUM ("+
-               "'ATS_PROFILE', 'TR_PROFILE', 'TM_PROFILE', 'TS_PROFILE', 
'TP_PROFILE', 'INFLUXDB_PROFILE',"+
-               "'RIAK_PROFILE', 'SPLUNK_PROFILE', 'DS_PROFILE', 'ORG_PROFILE', 
'KAFKA_PROFILE', 'LOGSTASH_PROFILE',"+
-               "'ES_PROFILE', 'UNK_PROFILE')", txn)
-
-       doExec("CREATE OR REPLACE VIEW \"profile_type_values\" AS SELECT 
unnest(enum_range(NULL::profile_type )) AS value ORDER BY value", txn)
-
-       doExec("ALTER TABLE profile ADD COLUMN type profile_type", txn)
-       doExec("UPDATE profile SET type='UNK_PROFILE'", txn) // So we don't get 
any NULL, these should be checked.
-       doExec("UPDATE profile SET type='TR_PROFILE' WHERE name like 'CCR_%' OR 
name like 'TR_%'", txn)
-       doExec("UPDATE profile SET type='TM_PROFILE' WHERE name like 'RASCAL_%' 
OR name like 'TM_%'", txn)
-       doExec("UPDATE profile SET type='TS_PROFILE' WHERE name like 
'TRAFFIC_STATS%'", txn)
-       doExec("UPDATE profile SET type='TP_PROFILE' WHERE name like 
'TRAFFIC_PORTAL%'", txn)
-       doExec("UPDATE profile SET type='INFLUXDB_PROFILE' WHERE name like 
'INFLUXDB%'", txn)
-       doExec("UPDATE profile SET type='RIAK_PROFILE' WHERE name like 
'RIAK%'", txn)
-       doExec("UPDATE profile SET type='SPLUNK_PROFILE' WHERE name like 
'SPLUNK%'", txn)
-       doExec("UPDATE profile SET type='ORG_PROFILE' WHERE name like '%ORG%' 
or name like 'MSO%' or name like '%ORIGIN%'", txn)
-       doExec("UPDATE profile SET type='KAFKA_PROFILE' WHERE name like 
'KAFKA%'", txn)
-       doExec("UPDATE profile SET type='LOGSTASH_PROFILE' WHERE name like 
'LOGSTASH_%'", txn)
-       doExec("UPDATE profile SET type='ES_PROFILE' WHERE name like 
'ELASTICSEARCH%'", txn)
-       doExec("UPDATE profile SET type='ATS_PROFILE' WHERE name like 'EDGE%' 
or name like 'MID%'", txn)
-
-       doExec("ALTER TABLE profile ALTER type SET NOT NULL", txn)
-
-       doExec("ALTER TABLE cdn ADD COLUMN domain_name text", txn)
-
-       doExec("UPDATE cdn SET domain_name=domainlist.value "+
-               "FROM (SELECT distinct cdn_id,value FROM server,parameter WHERE 
type=(SELECT id FROM type WHERE name='EDGE') "+
-               "AND parameter.id in (select parameter from profile_parameter 
WHERE profile_parameter.profile=server.profile) "+
-               "AND parameter.name='domain_name' "+
-               "AND config_file='CRConfig.json') AS domainlist "+
-               "WHERE id = domainlist.cdn_id", txn)
-
-       doExec("UPDATE cdn SET domain_name='-' WHERE name='ALL'", txn)
-
-       doExec("ALTER TABLE cdn ALTER COLUMN domain_name SET NOT NULL", txn)
-
-       doExec("ALTER TABLE profile ADD COLUMN cdn bigint", txn)
-
-       doExec("ALTER TABLE profile "+
-               "ADD CONSTRAINT fk_cdn1 FOREIGN KEY (cdn) "+
-               "REFERENCES cdn (id) MATCH SIMPLE "+
-               "ON UPDATE RESTRICT ON DELETE RESTRICT", txn)
-
-       doExec("CREATE INDEX idx_181818_fk_cdn1 "+
-               "ON profile "+
-               "USING btree "+
-               "(cdn)", txn)
-
-       doExec("UPDATE profile set cdn=domainlist.cdn_id "+
-               "FROM (SELECT distinct profile.id AS profile_id, value AS 
profile_domain_name, cdn.id cdn_id "+
-               "FROM profile, parameter, cdn, profile_parameter "+
-               "WHERE parameter.name='domain_name' "+
-               "AND parameter.config_file='CRConfig.json' "+
-               "AND parameter.value = cdn.domain_name "+
-               "AND parameter.id in (select parameter from profile_parameter 
where profile=profile.id)) as domainlist "+
-               "WHERE id = domainlist.profile_id", txn)
-
-       doExec("ALTER TABLE deliveryservice ALTER profile DROP NOT NULL", txn)
-
-       doExec("UPDATE deliveryservice SET profile=NULL", txn)
-
-       doExec("INSERT INTO parameter (name, config_file, value) VALUES 
('mso.parent_retry', 'parent.config', 'simple_retry');", txn)
-       doExec("INSERT INTO parameter (name, config_file, value) VALUES 
('mso.parent_retry', 'parent.config', 'unavailable_server_retry');", txn)
-       doExec("INSERT INTO parameter (name, config_file, value) VALUES 
('mso.parent_retry', 'parent.config', 'both');", txn)
-
-       type Profile struct {
-               Id                 int64
-               Name               string
-               Desc               string
-               Type               string
-               Cdn                int64
-               MidHeaderRewrite   string
-               MultiSiteOriginAlg int64
-               XMLId              string
-       }
-       // move data
-       pmap := make(map[string]Profile)
-       rows, err := txn.Query("SELECT 
id,xml_id,mid_header_rewrite,multi_site_origin,multi_site_origin_algorithm,cdn_id
 FROM deliveryservice WHERE multi_site_origin=true")
-       if err != nil {
-               fmt.Println("Error:", err)
-               fmt.Println("Attempting Roll back!")
-               txn.Rollback()
-               os.Exit(1)
-       }
-       existingParam := make(map[string]int64)
-       for rows.Next() {
-               var (
-                       id                          int64
-                       xml_id                      string
-                       mid_header_rewrite          sql.NullString
-                       multi_site_origin           sql.NullBool
-                       multi_site_origin_algorithm sql.NullInt64
-                       cdn_id                      int64
-               )
-               err := rows.Scan(&id, &xml_id, &mid_header_rewrite, 
&multi_site_origin, &multi_site_origin_algorithm, &cdn_id)
-               checkErr(err, txn)
-
-               pName := "DS_" + xml_id
-               pDesc := "Deliveryservice profile for " + xml_id
-               pType := "DS_PROFILE"
-               mhrString := mid_header_rewrite.String
-               pmap[pName] = Profile{
-                       Id:                 -1,
-                       Name:               pName,
-                       Desc:               pDesc,
-                       Type:               pType,
-                       Cdn:                cdn_id,
-                       MidHeaderRewrite:   mhrString,
-                       MultiSiteOriginAlg: multi_site_origin_algorithm.Int64,
-                       XMLId:              xml_id,
-               }
-       }
-       err = rows.Err()
-       checkErr(err, txn)
-       rows.Close()
-
-       for _, prof := range pmap {
-               fmt.Println("--\nINSERT INTO PROFILE (name, description, type, 
cdn) VALUES($1, $2, $3, $4) RETURNING id", prof.Name, prof.Desc, prof.Type, 
prof.Cdn)
-               newRow := txn.QueryRow("INSERT INTO PROFILE (name, description, 
type, cdn) VALUES($1, $2, $3, $4) RETURNING id", prof.Name, prof.Desc, 
prof.Type, prof.Cdn)
-               var newProfileId int64
-               err := newRow.Scan(&newProfileId)
-               checkErr(err, txn)
-
-               remainingString := ""
-               parent_retry := ""
-               var regexpOne = 
regexp.MustCompile(`^\s*set-config\s+proxy.config.http.parent_origin.(\S+)\s+(.*)$`)
-               if prof.MidHeaderRewrite != "" {
-                       remapParts := strings.Split(prof.MidHeaderRewrite, 
"__RETURN__")
-                       for _, line := range remapParts {
-                               fmt.Println(line)
-                               match := regexpOne.FindSubmatch([]byte(line))
-                               if len(match) != 0 {
-                                       var newId int64
-                                       var ok bool
-                                       newId, ok = 
existingParam[string(match[1])+string(match[2])]
-                                       //      fmt.Printf("%s -> %v %v\n", 
string(match[1])+string(match[2]), newId, ok)
-                                       if !ok {
-                                               if string(match[1]) == 
"simple_retry_enabled" || string(match[1]) == "dead_server_retry_enabled" {
-                                                       if parent_retry == "" {
-                                                               parent_retry = 
string(match[1])
-                                                       } else {
-                                                               parent_retry = 
"both"
-                                                       }
-                                               } else if string(match[1]) == 
"dead_server_retry_response_codes" {
-                                                       // 
unavailable_server_retry_responses is the only one that survives?
-                                                       //      if 
string(match[1]) == "dead_server_retry_response_codes" {
-                                                       pName := 
strings.Replace("mso."+string(match[1]), "dead", "unavailable", 1) // 
"mso.unavailable_server_retry_response_codes"
-                                                       pName = 
strings.Replace(pName, "response_codes", "responses", 1) // 
"mso.unavailable_server_retry_responses"
-                                                       fmt.Println("INSERT 
INTO PARAMETER (name, config_file, value) VALUES ($1, $2, $3) RETURNING id",
-                                                               pName, 
"parent.config", string(match[2]))
-                                                       newRow := 
txn.QueryRow("INSERT INTO PARAMETER (name, config_file, value) VALUES ($1, $2, 
$3) RETURNING id",
-                                                               pName, 
"parent.config", string(match[2]))
-                                                       err := 
newRow.Scan(&newId)
-                                                       checkErr(err, txn)
-                                                       
existingParam[string(match[1])+string(match[2])] = newId
-                                               }
-                                       } else {
-                                               newId = 
existingParam[string(match[1])+string(match[2])]
-                                       }
-                                       if newId != 0 {
-                                               fmt.Println("INSERT INTO 
PROFILE_PARAMETER (parameter, profile) VALUES ($1, $2)", newId, newProfileId)
-                                               _, err = txn.Exec("INSERT INTO 
PROFILE_PARAMETER (parameter, profile) VALUES ($1, $2)", newId, newProfileId)
-                                               checkErr(err, txn)
-                                       }
-                               } else {
-                                       if !strings.HasSuffix(line, 
"__RETURN__") {
-                                               remainingString = 
remainingString + line + "__RETURN__"
-                                       }
-                               }
-                       }
-               }
-               /* Not doing the removal of the header_rewrite stuff  at this 
time, so we can support both 5.x and 6.x - 6.x will have a warning if these are
-                  not removed from the DS, but should run just fine.
-
-               fmt.Printf("MHRW was: %s, \nMHRW now: %s\n", 
prof.MidHeaderRewrite, remainingString)
-
-               _, err = txn.Exec("UPDATE deliveryservice set 
mid_header_rewrite=$1 where xml_id=$2", remainingString, prof.XMLId)
-               checkErr(err, txn)
-
-               */
-
-               var newId int64
-               var ok bool
-               newId, ok = 
existingParam["mso.algorithm"+"parent.config"+algorithmStr[prof.MultiSiteOriginAlg]]
-               if !ok {
-                       fmt.Println("INSERT INTO PARAMETER (name, config_file, 
value) VALUES ($1, $2, $3) RETURNING id",
-                               "mso.algorithm", "parent.config", 
algorithmStr[prof.MultiSiteOriginAlg])
-                       newRow = txn.QueryRow("INSERT INTO PARAMETER (name, 
config_file, value) VALUES ($1, $2, $3) RETURNING id",
-                               "mso.algorithm", "parent.config", 
algorithmStr[prof.MultiSiteOriginAlg])
-                       err = newRow.Scan(&newId)
-                       checkErr(err, txn)
-                       
existingParam["mso.algorithm"+"parent.config"+algorithmStr[prof.MultiSiteOriginAlg]]
 = newId
-               } else {
-                       newId = 
existingParam["mso.algorithm"+"parent.config"+algorithmStr[prof.MultiSiteOriginAlg]]
-               }
-
-               fmt.Println("INSERT INTO PROFILE_PARAMETER (parameter, profile) 
VALUES ($1, $2)", newId, newProfileId)
-               _, err = txn.Exec("INSERT INTO PROFILE_PARAMETER (parameter, 
profile) VALUES ($1, $2)", newId, newProfileId)
-               checkErr(err, txn)
-
-               fmt.Println("INSERT INTO profile_parameter (profile, parameter) 
SELECT $1, id FROM parameter "+
-                       "WHERE config_file='parent.config' AND 
name='mso.parent_retry' AND value=$2", newProfileId, parent_retry)
-               _, err = txn.Exec("INSERT INTO profile_parameter (profile, 
parameter) SELECT $1, id FROM parameter "+
-                       "WHERE config_file='parent.config' AND 
name='mso.parent_retry' AND value=$2", newProfileId, parent_retry)
-               checkErr(err, txn)
-
-               _, err = txn.Exec("UPDATE deliveryservice SET profile=$1 WHERE 
xml_id=$2", newProfileId, prof.XMLId)
-               checkErr(err, txn)
-       }
-}
-
-// Down is executed when this migration is rolled back
-func Down_20170205101432(txn *sql.Tx) {
-       //
-}
diff --git a/traffic_ops/app/db/migrations/20170315000000_basic_tenancy.sql 
b/traffic_ops/app/db/migrations/20170315000000_basic_tenancy.sql
deleted file mode 100644
index adfae5b..0000000
--- a/traffic_ops/app/db/migrations/20170315000000_basic_tenancy.sql
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-
--- tenant
-CREATE TABLE tenant (
-    id BIGSERIAL primary key NOT NULL,
-    name text UNIQUE NOT NULL,
-    active boolean NOT NULL DEFAULT false,
-    parent_id bigint DEFAULT 1 CHECK (id != parent_id),
-    CONSTRAINT fk_parentid FOREIGN KEY (parent_id) REFERENCES tenant(id),    
-    last_updated timestamp with time zone DEFAULT now()
-); 
-CREATE INDEX idx_k_tenant_parent_tenant_idx ON tenant USING btree (parent_id);
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON tenant FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-DROP TRIGGER on_update_current_timestamp ON tenant;
-
-DROP TABLE tenant;
diff --git a/traffic_ops/app/db/migrations/20170328190847_add_reval_pending.sql 
b/traffic_ops/app/db/migrations/20170328190847_add_reval_pending.sql
deleted file mode 100644
index 6cfe524..0000000
--- a/traffic_ops/app/db/migrations/20170328190847_add_reval_pending.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE server DROP COLUMN IF EXISTS reval_pending;
-delete from profile_parameter where parameter = (select id from parameter 
where name = 'use_reval_pending');
-delete from parameter where name = 'use_reval_pending';
-ALTER TABLE server ADD COLUMN IF NOT EXISTS reval_pending boolean NOT NULL 
DEFAULT false;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE server DROP COLUMN IF EXISTS reval_pending;
-delete from profile_parameter where parameter = (select id from parameter 
where name = 'use_reval_pending');   
-delete from parameter where name = 'use_reval_pending';
diff --git a/traffic_ops/app/db/migrations/20170401000000_user_tenancy.sql 
b/traffic_ops/app/db/migrations/20170401000000_user_tenancy.sql
deleted file mode 100644
index 9be1ca3..0000000
--- a/traffic_ops/app/db/migrations/20170401000000_user_tenancy.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-
-ALTER TABLE tm_user
-    ADD tenant_id BIGINT,
-    ADD CONSTRAINT fk_tenantid FOREIGN KEY (tenant_id) REFERENCES tenant (id) 
MATCH FULL,
-    ALTER COLUMN tenant_id SET DEFAULT NULL;
-CREATE INDEX idx_k_tm_user_tenant_idx ON tm_user USING btree (tenant_id);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE tm_user
-DROP COLUMN tenant_id;
-
diff --git 
a/traffic_ops/app/db/migrations/20170404000000_unique_job_status_name.sql 
b/traffic_ops/app/db/migrations/20170404000000_unique_job_status_name.sql
deleted file mode 100644
index 107657e..0000000
--- a/traffic_ops/app/db/migrations/20170404000000_unique_job_status_name.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE job_status ADD CONSTRAINT job_status_name_unique UNIQUE (name);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE job_status DROP CONSTRAINT job_status_name_unique;
-
diff --git a/traffic_ops/app/db/migrations/20170404000001_unique_role_name.sql 
b/traffic_ops/app/db/migrations/20170404000001_unique_role_name.sql
deleted file mode 100644
index 3aca9e2..0000000
--- a/traffic_ops/app/db/migrations/20170404000001_unique_role_name.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE role ADD CONSTRAINT role_name_unique UNIQUE (name);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE role DROP CONSTRAINT role_name_unique;
-
diff --git 
a/traffic_ops/app/db/migrations/20170404000002_unique_status_name.sql 
b/traffic_ops/app/db/migrations/20170404000002_unique_status_name.sql
deleted file mode 100644
index 992371d..0000000
--- a/traffic_ops/app/db/migrations/20170404000002_unique_status_name.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE status ADD CONSTRAINT status_name_unique UNIQUE (name);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE status DROP CONSTRAINT status_name_unique;
-
diff --git a/traffic_ops/app/db/migrations/20170404000003_unique_type_name.sql 
b/traffic_ops/app/db/migrations/20170404000003_unique_type_name.sql
deleted file mode 100644
index 39e86fc..0000000
--- a/traffic_ops/app/db/migrations/20170404000003_unique_type_name.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE type ADD CONSTRAINT type_name_unique UNIQUE (name);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE type DROP CONSTRAINT type_name_unique;
-
diff --git 
a/traffic_ops/app/db/migrations/20170404000004_unique_job_agent_name.sql 
b/traffic_ops/app/db/migrations/20170404000004_unique_job_agent_name.sql
deleted file mode 100644
index 5dbed63..0000000
--- a/traffic_ops/app/db/migrations/20170404000004_unique_job_agent_name.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE job_agent ADD CONSTRAINT job_agent_name_unique UNIQUE (name);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE job_agent DROP CONSTRAINT job_agent_name_unique;
-
diff --git a/traffic_ops/app/db/migrations/20170404000005_unique_param.sql 
b/traffic_ops/app/db/migrations/20170404000005_unique_param.sql
deleted file mode 100644
index 35286d4..0000000
--- a/traffic_ops/app/db/migrations/20170404000005_unique_param.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE parameter ADD CONSTRAINT unique_param UNIQUE (name, config_file, 
value);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE type DROP CONSTRAINT unique_param;
-
diff --git 
a/traffic_ops/app/db/migrations/20170406000001_create_capabilities_and_roles.sql
 
b/traffic_ops/app/db/migrations/20170406000001_create_capabilities_and_roles.sql
deleted file mode 100644
index fbedbed..0000000
--- 
a/traffic_ops/app/db/migrations/20170406000001_create_capabilities_and_roles.sql
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-
--- capability
-CREATE TABLE capability (
-    name text primary key UNIQUE NOT NULL,
-    description text,
-    last_updated timestamp with time zone DEFAULT now()
-);
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON capability FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
--- http_method_t (enum)
-CREATE TYPE http_method_t as ENUM ('GET', 'POST', 'PUT', 'PATCH', 'DELETE');
-
--- api_capability
-
-CREATE TABLE api_capability (
-    id BIGSERIAL primary key NOT NULL,
-    http_method http_method_t NOT NULL,
-    route text NOT NULL,
-    capability text NOT NULL,
-    CONSTRAINT fk_capability FOREIGN KEY (capability) REFERENCES 
capability(name) ON DELETE RESTRICT,
-    UNIQUE (http_method, route, capability),
-    last_updated timestamp with time zone DEFAULT now()
-);
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON api_capability FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
--- role_capability
-CREATE TABLE role_capability (
-    role_id bigint NOT NULL,
-    CONSTRAINT fk_role_id FOREIGN KEY (role_id) REFERENCES role(id) ON DELETE 
CASCADE,  
-    cap_name text NOT NULL,
-    CONSTRAINT fk_cap_name FOREIGN KEY (cap_name) REFERENCES capability(name) 
ON DELETE RESTRICT,
-    UNIQUE (role_id, cap_name),
-    last_updated timestamp with time zone DEFAULT now()
-);
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON role_capability 
FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
--- user_role
-CREATE TABLE user_role (
-    user_id bigint NOT NULL,
-    CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES tm_user(id) ON 
DELETE CASCADE,
-    role_id bigint NOT NULL,
-    CONSTRAINT fk_role_id FOREIGN KEY (role_id) REFERENCES role(id) ON DELETE 
RESTRICT,
-    last_updated timestamp with time zone DEFAULT now()
-);
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON user_role FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-
-DROP TRIGGER on_update_current_timestamp ON user_role;
-
-DROP TABLE user_role;
-
-DROP TRIGGER on_update_current_timestamp ON role_capability;
-
-DROP TABLE role_capability;
-
-DROP TRIGGER on_update_current_timestamp ON api_capability;
-
-DROP TABLE api_capability;
-
-DROP TRIGGER on_update_current_timestamp ON capability;
-
-DROP TABLE capability;
-
-
-
diff --git a/traffic_ops/app/db/migrations/20170601183753_steering_target.sql 
b/traffic_ops/app/db/migrations/20170601183753_steering_target.sql
deleted file mode 100644
index 0cd066f..0000000
--- a/traffic_ops/app/db/migrations/20170601183753_steering_target.sql
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE steering_target RENAME COLUMN weight TO value;
-ALTER TABLE steering_target ADD COLUMN IF NOT EXISTS type bigint;
-ALTER TABLE steering_target ADD CONSTRAINT steering_target_type_fkey
-  FOREIGN KEY ("type")
-  REFERENCES "type" (id);
-
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE steering_target DROP CONSTRAINT steering_target_type_fkey;
-ALTER TABLE steering_target DROP COLUMN IF EXISTS type;
-ALTER TABLE steering_target RENAME COLUMN value to weight;
-
diff --git a/traffic_ops/app/db/migrations/20170623144818_lastupdated.sql 
b/traffic_ops/app/db/migrations/20170623144818_lastupdated.sql
deleted file mode 100644
index fd10480..0000000
--- a/traffic_ops/app/db/migrations/20170623144818_lastupdated.sql
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON asn;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON asn FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON cachegroup;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON cachegroup FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON cachegroup_parameter;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
cachegroup_parameter FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON cdn;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON cdn FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON deliveryservice;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON deliveryservice 
FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON deliveryservice_server;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
deliveryservice_server FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON deliveryservice_tmuser;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
deliveryservice_tmuser FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON division;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON division FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON federation;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON federation FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON 
federation_deliveryservice;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
federation_deliveryservice FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON 
federation_federation_resolver;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
federation_federation_resolver FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON federation_resolver;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
federation_resolver FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON federation_tmuser;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON federation_tmuser 
FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON hwinfo;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON hwinfo FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON job;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON job FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON job_agent;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON job_agent FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON job_result;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON job_result FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON job_status;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON job_status FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON log;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON log FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON parameter;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON parameter FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON phys_location;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON phys_location FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON profile;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON profile FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON profile_parameter;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON profile_parameter 
FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON regex;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON regex FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON region;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON region FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON server;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON server FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON servercheck;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON servercheck FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON staticdnsentry;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON staticdnsentry FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON status;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON status FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON steering_target;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON steering_target 
FOR EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON tm_user;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON tm_user FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-DROP TRIGGER IF EXISTS on_update_current_timestamp ON type;
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON type FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
diff --git 
a/traffic_ops/app/db/migrations/20170628000000_delivery_service_tenancy.sql 
b/traffic_ops/app/db/migrations/20170628000000_delivery_service_tenancy.sql
deleted file mode 100644
index a737d0c..0000000
--- a/traffic_ops/app/db/migrations/20170628000000_delivery_service_tenancy.sql
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-ALTER TABLE deliveryservice
-    ADD tenant_id BIGINT,
-    ADD CONSTRAINT fk_tenantid FOREIGN KEY (tenant_id) REFERENCES tenant (id) 
MATCH FULL,
-    ALTER COLUMN tenant_id SET DEFAULT NULL;
-CREATE INDEX idx_k_deliveryservice_tenant_idx ON deliveryservice USING btree 
(tenant_id);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE deliveryservice
-DROP COLUMN tenant_id;
-
diff --git 
a/traffic_ops/app/db/migrations/20170711160724_steering_target_fk.sql 
b/traffic_ops/app/db/migrations/20170711160724_steering_target_fk.sql
deleted file mode 100644
index e299479..0000000
--- a/traffic_ops/app/db/migrations/20170711160724_steering_target_fk.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE steering_target
-DROP CONSTRAINT fk_steering_target_target,
-ADD CONSTRAINT fk_steering_target_target
-  FOREIGN KEY (target)
-  REFERENCES deliveryservice (id)
-  ON DELETE CASCADE
-  ON UPDATE CASCADE;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
diff --git 
a/traffic_ops/app/db/migrations/20170816000000_staticdnsentry_ds_fk.sql 
b/traffic_ops/app/db/migrations/20170816000000_staticdnsentry_ds_fk.sql
deleted file mode 100644
index b4c78c3..0000000
--- a/traffic_ops/app/db/migrations/20170816000000_staticdnsentry_ds_fk.sql
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE staticdnsentry
-DROP CONSTRAINT fk_staticdnsentry_ds,
-ADD CONSTRAINT fk_staticdnsentry_ds
-  FOREIGN KEY (deliveryservice)
-  REFERENCES deliveryservice (id)
-  ON DELETE CASCADE
-  ON UPDATE CASCADE;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE staticdnsentry
-DROP CONSTRAINT fk_staticdnsentry_ds,
-ADD CONSTRAINT fk_staticdnsentry_ds
-  FOREIGN KEY (deliveryservice)
-  REFERENCES deliveryservice (id)
-  ON DELETE NO ACTION
-  ON UPDATE NO ACTION;
-
diff --git 
a/traffic_ops/app/db/migrations/20170816000001_job_deliveryservice_fk.sql 
b/traffic_ops/app/db/migrations/20170816000001_job_deliveryservice_fk.sql
deleted file mode 100644
index 7aa85e9..0000000
--- a/traffic_ops/app/db/migrations/20170816000001_job_deliveryservice_fk.sql
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE job
-DROP CONSTRAINT fk_job_deliveryservice1,
-ADD CONSTRAINT fk_job_deliveryservice1
-  FOREIGN KEY (job_deliveryservice)
-  REFERENCES deliveryservice (id)
-  ON DELETE CASCADE
-  ON UPDATE CASCADE;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE job
-DROP CONSTRAINT fk_job_deliveryservice1,
-ADD CONSTRAINT fk_job_deliveryservice1
-  FOREIGN KEY (job_deliveryservice)
-  REFERENCES deliveryservice (id)
-  ON DELETE NO ACTION
-  ON UPDATE NO ACTION;
-
diff --git a/traffic_ops/app/db/migrations/20170822000000_ds_routing_name.sql 
b/traffic_ops/app/db/migrations/20170822000000_ds_routing_name.sql
deleted file mode 100644
index bb58269..0000000
--- a/traffic_ops/app/db/migrations/20170822000000_ds_routing_name.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-ALTER TABLE deliveryservice
-    ADD routing_name TEXT;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE deliveryservice
-    DROP COLUMN routing_name;
diff --git a/traffic_ops/app/db/migrations/20170825124926_ignore_routing.sql 
b/traffic_ops/app/db/migrations/20170825124926_ignore_routing.sql
deleted file mode 100644
index da8dda9..0000000
--- a/traffic_ops/app/db/migrations/20170825124926_ignore_routing.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-        http://www.apache.org/licenses/LICENSE-2.0
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-ALTER TABLE profile
-    ADD routing_disabled BOOLEAN NOT NULL DEFAULT false;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE profile
-DROP COLUMN routing_disabled;
diff --git 
a/traffic_ops/app/db/migrations/20171013000000_change_signing_type.sql 
b/traffic_ops/app/db/migrations/20171013000000_change_signing_type.sql
deleted file mode 100644
index e4b8172..0000000
--- a/traffic_ops/app/db/migrations/20171013000000_change_signing_type.sql
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-DROP DOMAIN IF EXISTS deliveryservice_signature_type RESTRICT;
-
-CREATE DOMAIN deliveryservice_signature_type AS TEXT
-CHECK(
-   VALUE IN ('url_sig', 'uri_signing')
-);
-
-ALTER TABLE IF EXISTS deliveryservice
-ALTER COLUMN signed
-SET DEFAULT NULL;
-
-ALTER TABLE IF EXISTS deliveryservice
-ALTER COLUMN signed
-SET DATA TYPE deliveryservice_signature_type
-USING CASE WHEN signed THEN 'url_sig'::text::deliveryservice_signature_type 
ELSE NULL END;
-
-ALTER TABLE IF EXISTS deliveryservice
-RENAME COLUMN signed TO signing_algorithm;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE IF EXISTS deliveryservice
-RENAME COLUMN signing_algorithm TO signed;
-
-ALTER TABLE deliveryservice
-ALTER COLUMN signed
-SET DATA TYPE boolean
-USING CASE WHEN signed='url_sig' THEN true ELSE false END;
-
-ALTER TABLE IF EXISTS deliveryservice
-ALTER COLUMN signed
-SET DEFAULT false;
-
-DROP DOMAIN IF EXISTS deliveryservice_signature_type RESTRICT;
diff --git a/traffic_ops/app/db/migrations/20171023000000_snapshots_cdn_fk.sql 
b/traffic_ops/app/db/migrations/20171023000000_snapshots_cdn_fk.sql
deleted file mode 100644
index 76517a3..0000000
--- a/traffic_ops/app/db/migrations/20171023000000_snapshots_cdn_fk.sql
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE snapshot
-DROP CONSTRAINT IF EXISTS snapshot_cdn_fkey,
-ADD CONSTRAINT snapshot_cdn_fkey
-  FOREIGN KEY (cdn)
-  REFERENCES cdn (name)
-  ON DELETE CASCADE
-  ON UPDATE CASCADE;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE snapshot
-DROP CONSTRAINT IF EXISTS snapshot_cdn_fkey,
-ADD CONSTRAINT snapshot_cdn_fkey
-  FOREIGN KEY (cdn)
-  REFERENCES cdn (name)
-  ON DELETE NO ACTION
-  ON UPDATE CASCADE;
-
diff --git 
a/traffic_ops/app/db/migrations/20171027000000_remove_fed_user_role_not_null.sql
 
b/traffic_ops/app/db/migrations/20171027000000_remove_fed_user_role_not_null.sql
deleted file mode 100644
index 9c87b48..0000000
--- 
a/traffic_ops/app/db/migrations/20171027000000_remove_fed_user_role_not_null.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE federation_tmuser ALTER COLUMN role DROP NOT NULL;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE federation_tmuser ALTER COLUMN role SET NOT NULL;
diff --git 
a/traffic_ops/app/db/migrations/20171204000000_alter_max_dns_answers_default.sql
 
b/traffic_ops/app/db/migrations/20171204000000_alter_max_dns_answers_default.sql
deleted file mode 100644
index 89a8675..0000000
--- 
a/traffic_ops/app/db/migrations/20171204000000_alter_max_dns_answers_default.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE deliveryservice ALTER COLUMN max_dns_answers SET DEFAULT 
'5'::bigint;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice ALTER COLUMN max_dns_answers SET DEFAULT 
'0'::bigint;
diff --git 
a/traffic_ops/app/db/migrations/20171220000000_add_cdn_unique_domain_name.sql 
b/traffic_ops/app/db/migrations/20171220000000_add_cdn_unique_domain_name.sql
deleted file mode 100644
index c913c87..0000000
--- 
a/traffic_ops/app/db/migrations/20171220000000_add_cdn_unique_domain_name.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE cdn ADD CONSTRAINT cdn_domain_name_unique UNIQUE (domain_name);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE cdn DROP CONSTRAINT cdn_domain_name_unique;
-
diff --git 
a/traffic_ops/app/db/migrations/20180110000000_add_deep_caching_type.sql 
b/traffic_ops/app/db/migrations/20180110000000_add_deep_caching_type.sql
deleted file mode 100644
index 7c6d94b..0000000
--- a/traffic_ops/app/db/migrations/20180110000000_add_deep_caching_type.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-       Licensed under the Apache License, Version 2.0 (the "License");
-       you may not use this file except in compliance with the License.
-       You may obtain a copy of the License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-       See the License for the specific language governing permissions and
-       limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TYPE deep_caching_type AS ENUM ('NEVER', 'ALWAYS');
-
-ALTER TABLE deliveryservice ADD COLUMN deep_caching_type deep_caching_type 
DEFAULT 'NEVER';
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE deliveryservice DROP COLUMN IF EXISTS deep_caching_type;
-
-DROP TYPE IF EXISTS deep_caching_type;
diff --git 
a/traffic_ops/app/db/migrations/20180131000000_update_portal_priv_level.sql 
b/traffic_ops/app/db/migrations/20180131000000_update_portal_priv_level.sql
deleted file mode 100644
index 3e920db..0000000
--- a/traffic_ops/app/db/migrations/20180131000000_update_portal_priv_level.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-       Licensed under the Apache License, Version 2.0 (the "License");
-       you may not use this file except in compliance with the License.
-       You may obtain a copy of the License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-       See the License for the specific language governing permissions and
-       limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-UPDATE role SET priv_level = 15 WHERE name = 'portal';
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-UPDATE role SET priv_level = 2 WHERE name = 'portal';
diff --git 
a/traffic_ops/app/db/migrations/20180201000000_update_client_steering_headers.sql
 
b/traffic_ops/app/db/migrations/20180201000000_update_client_steering_headers.sql
deleted file mode 100644
index ef233c1..0000000
--- 
a/traffic_ops/app/db/migrations/20180201000000_update_client_steering_headers.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-       Licensed under the Apache License, Version 2.0 (the "License");
-       you may not use this file except in compliance with the License.
-       You may obtain a copy of the License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-       See the License for the specific language governing permissions and
-       limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-UPDATE deliveryservice
-SET tr_response_headers = subquery.tr_response_headers
-FROM (SELECT ds.id, ds.tr_response_headers, st.deliveryservice
-  FROM deliveryservice ds JOIN steering_target st ON ds.id = st.target
-  WHERE ds.tr_response_headers IS NOT NULL)
-AS subquery
-  WHERE subquery.deliveryservice = deliveryservice.id
-  AND type = (SELECT id from type where name = 'CLIENT_STEERING');
-
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
diff --git a/traffic_ops/app/db/migrations/20180202000000_add-ds-request.sql 
b/traffic_ops/app/db/migrations/20180202000000_add-ds-request.sql
deleted file mode 100644
index e943981..0000000
--- a/traffic_ops/app/db/migrations/20180202000000_add-ds-request.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-CREATE TYPE workflow_states AS ENUM ('draft', 'submitted', 'rejected', 
'pending', 'complete');
-CREATE TYPE change_types AS ENUM ('create', 'update', 'delete');
-
-CREATE TABLE deliveryservice_request (
-    assignee_id bigint,
-    author_id bigint NOT NULL,
-    change_type change_types NOT NULL,
-    created_at timestamp WITH time zone NOT NULL DEFAULT now(),
-    id bigserial primary key NOT NULL,
-    last_edited_by_id bigint NOT NULL,
-    last_updated timestamp WITH time zone NOT NULL DEFAULT now(),
-    deliveryservice jsonb NOT NULL,
-    status workflow_states NOT NULL
-);
-
-ALTER TABLE deliveryservice_request
-    ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES tm_user(id) ON 
DELETE CASCADE;
-
-ALTER TABLE deliveryservice_request
-    ADD CONSTRAINT fk_assignee FOREIGN KEY (assignee_id) REFERENCES 
tm_user(id) ON DELETE SET NULL;
-
-ALTER TABLE deliveryservice_request
-    ADD CONSTRAINT fk_last_edited_by FOREIGN KEY (last_edited_by_id) 
REFERENCES tm_user(id) ON DELETE CASCADE;
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
deliveryservice_request FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE deliveryservice_request;
-
-DROP TYPE change_types;
-
-DROP TYPE workflow_states;
diff --git a/traffic_ops/app/db/migrations/20180314000000_add_fq_pacing.sql 
b/traffic_ops/app/db/migrations/20180314000000_add_fq_pacing.sql
deleted file mode 100644
index e033fcd..0000000
--- a/traffic_ops/app/db/migrations/20180314000000_add_fq_pacing.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE deliveryservice ADD COLUMN fq_pacing_rate bigint default 0;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE deliveryservice DROP COLUMN fq_pacing_rate;
-
diff --git 
a/traffic_ops/app/db/migrations/20180319000000_ds-request-comments.sql 
b/traffic_ops/app/db/migrations/20180319000000_ds-request-comments.sql
deleted file mode 100644
index 787f055..0000000
--- a/traffic_ops/app/db/migrations/20180319000000_ds-request-comments.sql
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-CREATE TABLE deliveryservice_request_comment (
-    author_id bigint NOT NULL,
-    deliveryservice_request_id bigint NOT NULL,
-    id bigserial primary key NOT NULL,
-    last_updated timestamp WITH time zone NOT NULL DEFAULT now(),
-    value text NOT NULL
-);
-
-ALTER TABLE deliveryservice_request_comment
-    ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES tm_user(id) ON 
DELETE CASCADE;
-
-ALTER TABLE deliveryservice_request_comment
-    ADD CONSTRAINT fk_deliveryservice_request FOREIGN KEY 
(deliveryservice_request_id) REFERENCES deliveryservice_request(id) ON DELETE 
CASCADE;
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
deliveryservice_request_comment FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE deliveryservice_request_comment;
diff --git 
a/traffic_ops/app/db/migrations/20180402000000_remove_internal_steering_post.sql
 
b/traffic_ops/app/db/migrations/20180402000000_remove_internal_steering_post.sql
deleted file mode 100644
index 91ebc44..0000000
--- 
a/traffic_ops/app/db/migrations/20180402000000_remove_internal_steering_post.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-DELETE FROM api_capability WHERE http_method = 'POST' and route = 
'/internal/api/*/steering';
-
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-INSERT INTO api_capability (http_method, route, capability) VALUES ('POST', 
'/internal/api/*/steering', 'ds-steering-write') ON CONFLICT (http_method, 
route, capability) DO NOTHING;
diff --git 
a/traffic_ops/app/db/migrations/20180406000000_last_updated_not_null.sql 
b/traffic_ops/app/db/migrations/20180406000000_last_updated_not_null.sql
deleted file mode 100644
index d5882f9..0000000
--- a/traffic_ops/app/db/migrations/20180406000000_last_updated_not_null.sql
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-UPDATE api_capability SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE api_capability ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE asn SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE asn ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE cachegroup SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE cachegroup ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE cachegroup_parameter SET last_updated = now() WHERE last_updated IS 
NULL;
-ALTER TABLE cachegroup_parameter ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE capability SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE capability ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE deliveryservice SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE deliveryservice ALTER COLUMN last_updated SET NOT NULL;
-
-ALTER TABLE deliveryservice_regex ADD COLUMN last_updated timestamp with time 
zone NOT NULL DEFAULT now();
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON 
deliveryservice_regex FOR EACH ROW EXECUTE PROCEDURE 
on_update_current_timestamp_last_updated();
-
-UPDATE deliveryservice_server SET last_updated = now() WHERE last_updated IS 
NULL;
-ALTER TABLE deliveryservice_server ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE deliveryservice_tmuser SET last_updated = now() WHERE last_updated IS 
NULL;
-ALTER TABLE deliveryservice_tmuser ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE division SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE division ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE federation SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE federation ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE federation_deliveryservice SET last_updated = now() WHERE last_updated 
IS NULL;
-ALTER TABLE federation_deliveryservice ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE federation_federation_resolver SET last_updated = now() WHERE 
last_updated IS NULL;
-ALTER TABLE federation_federation_resolver ALTER COLUMN last_updated SET NOT 
NULL;
-
-UPDATE federation_resolver SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE federation_resolver ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE federation_tmuser SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE federation_tmuser ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE hwinfo SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE hwinfo ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE job SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE job ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE job_agent SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE job_agent ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE job_result SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE job_result ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE job_status SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE job_status ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE log SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE log ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE parameter SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE parameter ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE phys_location SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE phys_location ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE profile SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE profile ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE profile_parameter SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE profile_parameter ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE regex SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE regex ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE region SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE region ALTER COLUMN last_updated SET NOT NULL;
-
-ALTER TABLE role ADD COLUMN last_updated timestamp with time zone NOT NULL 
DEFAULT now();
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON role FOR EACH ROW 
EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
-UPDATE role_capability SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE role_capability ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE server SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE server ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE servercheck SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE servercheck ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE snapshot SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE snapshot ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE staticdnsentry SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE staticdnsentry ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE status SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE status ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE steering_target SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE steering_target ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE tenant SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE tenant ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE tm_user SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE tm_user ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE type SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE type ALTER COLUMN last_updated SET NOT NULL;
-
-UPDATE user_role SET last_updated = now() WHERE last_updated IS NULL;
-ALTER TABLE user_role ALTER COLUMN last_updated SET NOT NULL;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-DROP TRIGGER on_update_current_timestamp ON deliveryservice_regex;
-DROP TRIGGER on_update_current_timestamp ON role;
-ALTER TABLE api_capability ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE asn ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE cachegroup ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE cachegroup_parameter ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE capability ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE deliveryservice ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE deliveryservice_server ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE deliveryservice_tmuser ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE division ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE federation ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE federation_deliveryservice ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE federation_federation_resolver ALTER COLUMN last_updated DROP NOT 
NULL;
-ALTER TABLE federation_resolver ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE federation_tmuser ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE hwinfo ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE job ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE job_agent ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE job_result ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE job_status ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE log ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE parameter ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE phys_location ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE profile ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE profile_parameter ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE regex ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE region ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE role_capability ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE server ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE servercheck ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE snapshot ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE staticdnsentry ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE status ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE steering_target ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE tenant ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE tm_user ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE type ALTER COLUMN last_updated DROP NOT NULL;
-ALTER TABLE user_role ALTER COLUMN last_updated DROP NOT NULL;
diff --git a/traffic_ops/app/db/migrations/20180420000000_add_coordinate.sql 
b/traffic_ops/app/db/migrations/20180420000000_add_coordinate.sql
deleted file mode 100644
index 89a0f66..0000000
--- a/traffic_ops/app/db/migrations/20180420000000_add_coordinate.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TABLE coordinate (
-    id bigserial primary key NOT NULL,
-    name text UNIQUE NOT NULL,
-    latitude numeric NOT NULL DEFAULT 0.0,
-    longitude numeric NOT NULL DEFAULT 0.0,
-    last_updated timestamp WITH time zone NOT NULL DEFAULT now()
-);
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON coordinate FOR 
EACH ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE coordinate;
diff --git 
a/traffic_ops/app/db/migrations/20180501000000_remove_job_result_table.sql 
b/traffic_ops/app/db/migrations/20180501000000_remove_job_result_table.sql
deleted file mode 100644
index 01443f8..0000000
--- a/traffic_ops/app/db/migrations/20180501000000_remove_job_result_table.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-DROP TABLE job_result;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-CREATE TABLE job_result (
-    id bigint NOT NULL,
-    job bigint NOT NULL,
-    agent bigint NOT NULL,
-    result text NOT NULL,
-    description text,
-    last_updated timestamp with time zone DEFAULT now()
-);
diff --git 
a/traffic_ops/app/db/migrations/20180514000000_add_anonymous_blocking.sql 
b/traffic_ops/app/db/migrations/20180514000000_add_anonymous_blocking.sql
deleted file mode 100644
index afabe9d..0000000
--- a/traffic_ops/app/db/migrations/20180514000000_add_anonymous_blocking.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-      http://www.apache.org/licenses/LICENSE-2.0
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-alter table deliveryservice add column anonymous_blocking_enabled boolean NOT 
NULL default FALSE;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-alter table deliveryservice drop column anonymous_blocking_enabled;
diff --git 
a/traffic_ops/app/db/migrations/20180515000000_ds_request_add_anon_blocking.sql 
b/traffic_ops/app/db/migrations/20180515000000_ds_request_add_anon_blocking.sql
deleted file mode 100644
index 73b4c4a..0000000
--- 
a/traffic_ops/app/db/migrations/20180515000000_ds_request_add_anon_blocking.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-      http://www.apache.org/licenses/LICENSE-2.0
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-UPDATE deliveryservice_request SET deliveryservice = 
jsonb_set(deliveryservice, '{anonymousBlockingEnabled}', 'false') WHERE 
deliveryservice::json->'anonymousBlockingEnabled' IS NULL AND status != 
'complete' AND status != 'rejected';
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-UPDATE deliveryservice_request SET deliveryservice = deliveryservice #- 
'{anonymousBlockingEnabled}' WHERE 
deliveryservice::json->'anonymousBlockingEnabled' is NOT NULL;
diff --git a/traffic_ops/app/db/migrations/20180522000000_add_origin.sql 
b/traffic_ops/app/db/migrations/20180522000000_add_origin.sql
deleted file mode 100644
index 266dfe0..0000000
--- a/traffic_ops/app/db/migrations/20180522000000_add_origin.sql
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TYPE origin_protocol AS ENUM ('http', 'https');
-
-CREATE TABLE origin (
-    id bigserial PRIMARY KEY NOT NULL,
-    name text UNIQUE NOT NULL,
-    fqdn text NOT NULL,
-    protocol origin_protocol NOT NULL DEFAULT 'http',
-    is_primary boolean NOT NULL DEFAULT FALSE,
-    port bigint,
-    ip_address text,
-    ip6_address text,
-    deliveryservice bigint NOT NULL REFERENCES deliveryservice(id) ON DELETE 
CASCADE,
-    coordinate bigint REFERENCES coordinate(id) ON DELETE RESTRICT,
-    profile bigint REFERENCES profile(id) ON DELETE RESTRICT,
-    cachegroup bigint REFERENCES cachegroup(id) ON DELETE RESTRICT,
-    tenant bigint REFERENCES tenant(id) ON DELETE RESTRICT,
-    last_updated timestamp WITH time zone NOT NULL DEFAULT now()
-);
-
-CREATE UNIQUE INDEX origin_is_primary_deliveryservice_constraint ON origin 
(is_primary, deliveryservice) WHERE is_primary;
-
-CREATE INDEX origin_deliveryservice_fkey ON origin USING btree 
(deliveryservice);
-CREATE INDEX origin_coordinate_fkey ON origin USING btree (coordinate);
-CREATE INDEX origin_profile_fkey ON origin USING btree (profile);
-CREATE INDEX origin_cachegroup_fkey ON origin USING btree (cachegroup);
-CREATE INDEX origin_tenant_fkey ON origin USING btree (tenant);
-
-CREATE TRIGGER on_update_current_timestamp BEFORE UPDATE ON origin FOR EACH 
ROW EXECUTE PROCEDURE on_update_current_timestamp_last_updated();
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-DROP TABLE IF EXISTS origin;
-
-DROP TYPE IF EXISTS origin_protocol;
diff --git 
a/traffic_ops/app/db/migrations/20180528000000_cache_group_fallback.sql 
b/traffic_ops/app/db/migrations/20180528000000_cache_group_fallback.sql
deleted file mode 100644
index dbce434..0000000
--- a/traffic_ops/app/db/migrations/20180528000000_cache_group_fallback.sql
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-
--- cachegroup_fallbacks
-CREATE TABLE cachegroup_fallbacks (
-    primary_cg bigint NOT NULL,
-    backup_cg bigint CHECK (primary_cg != backup_cg) NOT NULL,
-    set_order bigint NOT NULL,
-    CONSTRAINT fk_primary_cg FOREIGN KEY (primary_cg) REFERENCES 
cachegroup(id) ON DELETE CASCADE,   
-    CONSTRAINT fk_backup_cg FOREIGN KEY (backup_cg) REFERENCES cachegroup(id) 
ON DELETE CASCADE,
-    UNIQUE (primary_cg, backup_cg),
-    UNIQUE (primary_cg, set_order)
-); 
-
-ALTER TABLE cachegroup ADD COLUMN fallback_to_closest BOOLEAN DEFAULT TRUE;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE cachegroup DROP COLUMN fallback_to_closest;
-
-DROP TABLE cachegroup_fallbacks;
diff --git 
a/traffic_ops/app/db/migrations/20180606000000_remove_org_server_fqdn.sql 
b/traffic_ops/app/db/migrations/20180606000000_remove_org_server_fqdn.sql
deleted file mode 100644
index 967d1f6..0000000
--- a/traffic_ops/app/db/migrations/20180606000000_remove_org_server_fqdn.sql
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-INSERT INTO origin (name, protocol, fqdn, port, deliveryservice, tenant, 
is_primary)
-SELECT
-d.xml_id,
-lower(split_part(d.org_server_fqdn, '://', 1))::origin_protocol,
-regexp_replace(d.org_server_fqdn, '(^https?://)|(:\d+$)', '', 'gi'),
-(SELECT (regexp_matches(d.org_server_fqdn, '(?<=:)\d+$'))[1]::bigint),
-d.id,
-d.tenant_id,
-TRUE
-FROM deliveryservice d
-WHERE d.org_server_fqdn IS NOT NULL;
-
-ALTER TABLE deliveryservice DROP COLUMN org_server_fqdn;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE deliveryservice ADD COLUMN org_server_fqdn text;
-
-UPDATE deliveryservice d
-SET org_server_fqdn = (
-    SELECT o.protocol::text || '://' || o.fqdn || rtrim(concat(':', 
o.port::text), ':')
-    FROM origin o
-    WHERE o.deliveryservice = d.id AND o.is_primary
-);
-
-DELETE FROM origin o
-WHERE o.is_primary;
diff --git 
a/traffic_ops/app/db/migrations/20180627000000_cachegroup_coordinate.sql 
b/traffic_ops/app/db/migrations/20180627000000_cachegroup_coordinate.sql
deleted file mode 100644
index 0cf3df1..0000000
--- a/traffic_ops/app/db/migrations/20180627000000_cachegroup_coordinate.sql
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-INSERT INTO coordinate (name, latitude, longitude)
-SELECT
-'from_cachegroup_' || cg.name,
-cg.latitude,
-cg.longitude
-FROM cachegroup cg
-WHERE cg.latitude IS NOT NULL AND cg.longitude IS NOT NULL;
-
-ALTER TABLE cachegroup ADD COLUMN coordinate bigint REFERENCES coordinate(id);
-
-UPDATE cachegroup
-SET coordinate = (
-    SELECT co.id
-    FROM coordinate co
-    WHERE co.name = 'from_cachegroup_' || cachegroup.name
-);
-
-CREATE INDEX cachegroup_coordinate_fkey ON cachegroup USING btree (coordinate);
-
-ALTER TABLE cachegroup DROP COLUMN latitude;
-ALTER TABLE cachegroup DROP COLUMN longitude;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-ALTER TABLE cachegroup ADD COLUMN latitude numeric;
-ALTER TABLE cachegroup ADD COLUMN longitude numeric;
-
-UPDATE cachegroup
-SET latitude = (
-    SELECT co.latitude
-    FROM coordinate co
-    WHERE cachegroup.coordinate = co.id
-),
-longitude = (
-    SELECT co.longitude
-    FROM coordinate co
-    WHERE cachegroup.coordinate = co.id
-)
-WHERE cachegroup.coordinate IS NOT NULL;
-
-ALTER TABLE cachegroup DROP CONSTRAINT cachegroup_coordinate_fkey;
-
-DELETE FROM coordinate
-WHERE id IN (
-    SELECT cg.coordinate FROM cachegroup cg
-);
-
-ALTER TABLE cachegroup DROP COLUMN coordinate;
diff --git 
a/traffic_ops/app/db/migrations/20180801101413_cachegroup_delete_restrict.sql 
b/traffic_ops/app/db/migrations/20180801101413_cachegroup_delete_restrict.sql
deleted file mode 100644
index 606b7e3..0000000
--- 
a/traffic_ops/app/db/migrations/20180801101413_cachegroup_delete_restrict.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-ALTER TABLE server DROP CONSTRAINT fk_server_cachegroup1;
-ALTER TABLE server ADD CONSTRAINT fk_server_cachegroup1 FOREIGN 
KEY(cachegroup) REFERENCES cachegroup(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-ALTER TABLE server DROP CONSTRAINT fk_server_cachegroup1;
-ALTER TABLE server ADD CONSTRAINT fk_server_cachegroup1 FOREIGN 
KEY(cachegroup) REFERENCES cachegroup(id) ON UPDATE RESTRICT ON DELETE CASCADE;
diff --git 
a/traffic_ops/app/db/migrations/20180806000000_add_cachegroup_localization_method.sql
 
b/traffic_ops/app/db/migrations/20180806000000_add_cachegroup_localization_method.sql
deleted file mode 100644
index da19832..0000000
--- 
a/traffic_ops/app/db/migrations/20180806000000_add_cachegroup_localization_method.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-       Licensed under the Apache License, Version 2.0 (the "License");
-       you may not use this file except in compliance with the License.
-       You may obtain a copy of the License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-       See the License for the specific language governing permissions and
-       limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
-CREATE TYPE localization_method AS ENUM ('CZ', 'DEEP_CZ', 'GEO');
-
-CREATE TABLE cachegroup_localization_method (
-    cachegroup bigint NOT NULL REFERENCES cachegroup(id) ON DELETE CASCADE,
-    method localization_method NOT NULL,
-    UNIQUE(cachegroup, method)
-);
-
-CREATE INDEX cachegroup_localization_method_cachegroup_fkey ON 
cachegroup_localization_method USING btree (cachegroup);
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
-
-DROP TABLE IF EXISTS cachegroup_localization_method;
-
-DROP TYPE IF EXISTS localization_method;
diff --git 
a/traffic_ops/app/db/migrations/20180808000000_remove_capabilities_for_reseed.sql
 
b/traffic_ops/app/db/migrations/20180808000000_remove_capabilities_for_reseed.sql
deleted file mode 100644
index b412cfd..0000000
--- 
a/traffic_ops/app/db/migrations/20180808000000_remove_capabilities_for_reseed.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-       Licensed under the Apache License, Version 2.0 (the "License");
-       you may not use this file except in compliance with the License.
-       You may obtain a copy of the License at
-           http://www.apache.org/licenses/LICENSE-2.0
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-       See the License for the specific language governing permissions and
-       limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
--- we are going to clean up capabilities for a reseed
-DELETE from api_capability;
-DELETE from role_capability;
-DELETE from capability;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
\ No newline at end of file
diff --git 
a/traffic_ops/app/db/migrations/20180814000625_remove_capabilities_for_reseed.sql
 
b/traffic_ops/app/db/migrations/20180814000625_remove_capabilities_for_reseed.sql
deleted file mode 100644
index ec72f33..0000000
--- 
a/traffic_ops/app/db/migrations/20180814000625_remove_capabilities_for_reseed.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-       Licensed under the Apache License, Version 2.0 (the "License");
-       you may not use this file except in compliance with the License.
-       You may obtain a copy of the License at
-           http://www.apache.org/licenses/LICENSE-2.0
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-       See the License for the specific language governing permissions and
-       limitations under the License.
-*/
-
--- +goose Up
--- SQL in section 'Up' is executed when this migration is applied
-
--- we are going to clean up capabilities for a reseed
--- it is really just a few, but I'm deleting everything just so I don't miss 
anything..
-DELETE FROM api_capability;
-DELETE FROM role_capability;
-DELETE FROM capability;
-
--- +goose Down
--- SQL section 'Down' is executed when this migration is rolled back
diff --git 
a/traffic_ops/app/db/migrations/20190319000000_add_max_origin_connections.sql 
b/traffic_ops/app/db/migrations/20190319000000_add_max_origin_connections.sql
index 784d87b..c7f4de3 100644
--- 
a/traffic_ops/app/db/migrations/20190319000000_add_max_origin_connections.sql
+++ 
b/traffic_ops/app/db/migrations/20190319000000_add_max_origin_connections.sql
@@ -20,4 +20,3 @@ ALTER TABLE deliveryservice ADD COLUMN max_origin_connections 
bigint NOT NULL DE
 -- +goose Down
 -- SQL section 'Down' is executed when this migration is rolled back
 ALTER TABLE deliveryservice DROP COLUMN max_origin_connections;
-
diff --git a/traffic_ops/app/db/patches.sql b/traffic_ops/app/db/patches.sql
index 382c66e..70c33ba 100644
--- a/traffic_ops/app/db/patches.sql
+++ b/traffic_ops/app/db/patches.sql
@@ -15,73 +15,11 @@
 
 
 -- THIS FILE INCLUDES POST-MIGRATION DATA FIXES REQUIRED OF TRAFFIC OPS
-UPDATE steering_target SET "type" = (SELECT id FROM type WHERE name = 
'STEERING_WEIGHT') where "type" is NULL;;
-ALTER TABLE steering_target ALTER COLUMN type SET NOT NULL;
 
-UPDATE deliveryservice SET routing_name = 'edge' WHERE routing_name IS NULL 
AND type IN (SELECT id FROM type WHERE name like 'DNS%');
-UPDATE deliveryservice ds
-SET routing_name = (
-  SELECT p.value
-  FROM parameter p
-    JOIN profile_parameter pp ON p.id = pp.parameter
-    JOIN profile pro ON pp.profile = pro.id
-    JOIN cdn ON pro.cdn = cdn.id
-  WHERE p.name = 'upgrade_http_routing_name'
-    AND cdn.id = ds.cdn_id)
-WHERE routing_name IS NULL;
-UPDATE deliveryservice SET routing_name = 'tr' WHERE routing_name IS NULL;
-ALTER TABLE deliveryservice ALTER COLUMN routing_name SET NOT NULL;
-ALTER TABLE deliveryservice ALTER COLUMN routing_name SET DEFAULT 'cdn';
-ALTER TABLE deliveryservice DROP CONSTRAINT IF EXISTS routing_name_not_empty;
-ALTER TABLE deliveryservice ADD CONSTRAINT routing_name_not_empty CHECK 
(length(routing_name) > 0);
--- This patch adds a new enum value to profile_type
--- We need to add the enum directly with sql as postgres will not allow
--- altering any enum values within a transaction block and by default
--- goose runs migrations within a transaction.
-ALTER TYPE profile_type ADD VALUE IF NOT EXISTS 'GROVE_PROFILE';
-
--- If tenancy is not needed, simply default to the root tenant.  This will help
--- to eliminate the use_tenancy property
-
-DO
-$tenantnotnull$
-BEGIN
-    IF EXISTS (SELECT value FROM parameter WHERE name = 'use_tenancy' AND 
config_file = 'global' AND value = '1') THEN
-        -- tenancy turned ON -- anything without a tenant gets the 
"unassigned" tenant
-        UPDATE tm_user SET tenant_id = (SELECT id FROM tenant WHERE name = 
'unassigned')
-        WHERE tenant_id IS NULL;
-        UPDATE deliveryservice SET tenant_id = (SELECT id FROM tenant WHERE 
name = 'unassigned')
-        WHERE tenant_id IS NULL;
-        UPDATE origin SET tenant = (SELECT id FROM tenant WHERE name = 
'unassigned')
-        WHERE tenant IS NULL;
-    ELSE
-        -- tenancy turned OFF -- anything without a tenant gets the "root" 
tenant
-        UPDATE tm_user SET tenant_id = (SELECT id FROM tenant WHERE name = 
'root')
-        WHERE tenant_id IS NULL;
-        UPDATE deliveryservice SET tenant_id = (SELECT id FROM tenant WHERE 
name = 'root')
-        WHERE tenant_id IS NULL;
-        UPDATE origin SET tenant = (SELECT id FROM tenant WHERE name = 'root')
-        WHERE tenant IS NULL;
-    END IF;
-END
-$tenantnotnull$;
-
--- add constraints so we can depend on everything being assigned a tenant
-ALTER TABLE tm_user ALTER COLUMN tenant_id SET NOT NULL;
-ALTER TABLE deliveryservice ALTER COLUMN tenant_id SET NOT NULL;
-ALTER TABLE origin ALTER COLUMN tenant SET NOT NULL;
 -- set use_tenancy to 1 -- this should remain until code that depends on it is 
removed from both TO and TP
 -- NOTE that we know use_tenancy exists b/c it's inserted in seeds.sql
 UPDATE parameter SET value = '1' WHERE name = 'use_tenancy' AND config_file = 
'global';
 
--- never allow deep_caching_type to be NULL
-UPDATE deliveryservice SET deep_caching_type = 'NEVER' WHERE deep_caching_type 
IS NULL;
-ALTER TABLE deliveryservice ALTER COLUMN deep_caching_type SET NOT NULL;
-
--- never allow profiles to have NULL cdn -- global profiles should use 'ALL'
-UPDATE profile SET cdn = (SELECT id FROM cdn WHERE name='ALL') WHERE cdn IS 
NULL;
-ALTER TABLE profile ALTER COLUMN cdn SET NOT NULL;
-
 -- Mapping roles and capabilities: (used to be in a migration)
 
 -- For role 'federation'
diff --git a/traffic_ops/app/db/seeds.sql b/traffic_ops/app/db/seeds.sql
index 6a2960f..e1d6550 100644
--- a/traffic_ops/app/db/seeds.sql
+++ b/traffic_ops/app/db/seeds.sql
@@ -55,6 +55,12 @@ BEGIN
 END
 $do$;
 
+-- parameters
+---------------------------------
+INSERT INTO parameter (name, config_file, value) VALUES ('mso.parent_retry', 
'parent.config', 'simple_retry');
+INSERT INTO parameter (name, config_file, value) VALUES ('mso.parent_retry', 
'parent.config', 'unavailable_server_retry');
+INSERT INTO parameter (name, config_file, value) VALUES ('mso.parent_retry', 
'parent.config', 'both');
+
 -- profiles
 ---------------------------------
 insert into profile (name, description, type, cdn) values 
('TRAFFIC_ANALYTICS', 'Traffic Analytics profile', 'UNK_PROFILE', (SELECT id 
FROM cdn WHERE name='ALL')) ON CONFLICT (name) DO NOTHING;
@@ -78,7 +84,7 @@ insert into tenant (name, active, parent_id) values ('root', 
true, null) ON CONF
 insert into tenant (name, active, parent_id) values ('unassigned', true, 
(select id from tenant where name='root')) ON CONFLICT DO NOTHING;
 
 -- roles
--- out of the box, only 3 roles are defined. Other roles can be created by the 
admin as needed.
+-- out of the box, only 4 roles are defined. Other roles can be created by the 
admin as needed.
 insert into role (name, description, priv_level) values ('admin', 'Has access 
to everything.', 30) ON CONFLICT (name) DO NOTHING;
 insert into role (name, description, priv_level) values ('operations', 'Has 
all reads and most write capabilities', 20) ON CONFLICT (name) DO NOTHING;
 insert into role (name, description, priv_level) values ('read-only', 'Has 
access to all read capabilities', 10) ON CONFLICT (name) DO NOTHING;

Reply via email to