You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/03/09 19:09:28 UTC

[20/44] incubator-trafficcontrol git commit: Schema changes for mso_profile on deliveryservice table

Schema changes for mso_profile on deliveryservice table


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/62d883f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/62d883f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/62d883f4

Branch: refs/heads/master
Commit: 62d883f427b97c143cc13a5f695ee8c33948e8ba
Parents: 6d9cd74
Author: Jan van Doorn <ja...@cable.comcast.com>
Authored: Fri Dec 23 15:33:22 2016 -0700
Committer: Jan van Doorn <jv...@apache.org>
Committed: Fri Feb 17 17:49:10 2017 +0000

----------------------------------------------------------------------
 .../20161222000000_add_mso_profile.sql          | 29 ++++++++++++++
 .../app/lib/Schema/Result/Deliveryservice.pm    | 40 +++++++++++++++++---
 traffic_ops/app/lib/Schema/Result/Profile.pm    | 23 +++++++++--
 3 files changed, 82 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/62d883f4/traffic_ops/app/db/migrations/20161222000000_add_mso_profile.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/migrations/20161222000000_add_mso_profile.sql b/traffic_ops/app/db/migrations/20161222000000_add_mso_profile.sql
new file mode 100644
index 0000000..69b8592
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20161222000000_add_mso_profile.sql
@@ -0,0 +1,29 @@
+/*
+
+    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 public.deliveryservice ADD COLUMN mso_profile bigint;
+ALTER TABLE public.deliveryservice
+  ADD CONSTRAINT fk_deliveryservice_profile2 FOREIGN KEY (mso_profile)
+      REFERENCES public.profile (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION;
+CREATE INDEX idx_18221_fk_deliveryservice_mso_profile1
+  ON public.deliveryservice
+  USING btree
+  (mso_profile);
+-- +goose Down
+-- SQL section 'Down' is executed when this migration is rolled back
+ALTER TABLE public.deliveryservice DROP COLUMN mso_profile;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/62d883f4/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm b/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm
index afb1877..93bc2a3 100644
--- a/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm
+++ b/traffic_ops/app/lib/Schema/Result/Deliveryservice.pm
@@ -288,6 +288,12 @@ __PACKAGE__->table("deliveryservice");
   data_type: 'text'
   is_nullable: 1
 
+=head2 mso_profile
+
+  data_type: 'bigint'
+  is_foreign_key: 1
+  is_nullable: 1
+
 =cut
 
 __PACKAGE__->add_columns(
@@ -399,6 +405,8 @@ __PACKAGE__->add_columns(
   { data_type => "smallint", is_nullable => 1 },
   "geolimit_redirect_url",
   { data_type => "text", is_nullable => 1 },
+  "mso_profile",
+  { data_type => "bigint", is_foreign_key => 1, is_nullable => 1 },
 );
 
 =head1 PRIMARY KEY
@@ -417,7 +425,7 @@ __PACKAGE__->set_primary_key("id", "type");
 
 =head1 UNIQUE CONSTRAINTS
 
-=head2 C<idx_54278_ds_id_unique>
+=head2 C<idx_18221_ds_id_unique>
 
 =over 4
 
@@ -427,9 +435,9 @@ __PACKAGE__->set_primary_key("id", "type");
 
 =cut
 
-__PACKAGE__->add_unique_constraint("idx_54278_ds_id_unique", ["id"]);
+__PACKAGE__->add_unique_constraint("idx_18221_ds_id_unique", ["id"]);
 
-=head2 C<idx_54278_ds_name_unique>
+=head2 C<idx_18221_ds_name_unique>
 
 =over 4
 
@@ -439,7 +447,7 @@ __PACKAGE__->add_unique_constraint("idx_54278_ds_id_unique", ["id"]);
 
 =cut
 
-__PACKAGE__->add_unique_constraint("idx_54278_ds_name_unique", ["xml_id"]);
+__PACKAGE__->add_unique_constraint("idx_18221_ds_name_unique", ["xml_id"]);
 
 =head1 RELATIONS
 
@@ -533,6 +541,26 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
+=head2 mso_profile
+
+Type: belongs_to
+
+Related object: L<Schema::Result::Profile>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "mso_profile",
+  "Schema::Result::Profile",
+  { id => "mso_profile" },
+  {
+    is_deferrable => 0,
+    join_type     => "LEFT",
+    on_delete     => "NO ACTION",
+    on_update     => "NO ACTION",
+  },
+);
+
 =head2 profile
 
 Type: belongs_to
@@ -609,8 +637,8 @@ __PACKAGE__->belongs_to(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2016-11-18 22:45:19
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OGL35PLFXtZ8BuzgP7IHzQ
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2016-12-23 15:30:11
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aULX21NuOuu6Ow8dfmQ9Ig
 
 # You can replace this text with custom code or comments, and it will be preserved on regeneration
 #

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/62d883f4/traffic_ops/app/lib/Schema/Result/Profile.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/Schema/Result/Profile.pm b/traffic_ops/app/lib/Schema/Result/Profile.pm
index 5e7bc7f..05deb14 100644
--- a/traffic_ops/app/lib/Schema/Result/Profile.pm
+++ b/traffic_ops/app/lib/Schema/Result/Profile.pm
@@ -84,7 +84,7 @@ __PACKAGE__->set_primary_key("id");
 
 =head1 UNIQUE CONSTRAINTS
 
-=head2 C<idx_54441_name_unique>
+=head2 C<idx_18384_name_unique>
 
 =over 4
 
@@ -94,10 +94,25 @@ __PACKAGE__->set_primary_key("id");
 
 =cut
 
-__PACKAGE__->add_unique_constraint("idx_54441_name_unique", ["name"]);
+__PACKAGE__->add_unique_constraint("idx_18384_name_unique", ["name"]);
 
 =head1 RELATIONS
 
+=head2 deliveryservice_mso_profiles
+
+Type: has_many
+
+Related object: L<Schema::Result::Deliveryservice>
+
+=cut
+
+__PACKAGE__->has_many(
+  "deliveryservice_mso_profiles",
+  "Schema::Result::Deliveryservice",
+  { "foreign.mso_profile" => "self.id" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
 =head2 deliveryservices
 
 Type: has_many
@@ -144,8 +159,8 @@ __PACKAGE__->has_many(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2016-11-18 22:45:19
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tmTPl52VUdJsn+y6JuSLlw
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2016-12-23 15:30:11
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:w9Yffpzp/V9wfVSGxX8kaw
 
 
 # You can replace this text with custom code or comments, and it will be preserved on regeneration