You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2017/04/10 19:05:46 UTC
[4/8] incubator-trafficcontrol git commit: adds unique constraints to
job_status, role, status, type, job_agent and parameter table
adds unique constraints to job_status, role, status, type, job_agent and parameter 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/994f6f65
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/994f6f65
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/994f6f65
Branch: refs/heads/master
Commit: 994f6f6594f295e4d561a76d09048cc970e7585e
Parents: 032ba33
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Tue Apr 4 14:21:00 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Apr 10 13:05:06 2017 -0600
----------------------------------------------------------------------
.../20170404000000_unique_job_status_name.sql | 23 ++++++++++++++++++++
.../20170404000001_unique_role_name.sql | 23 ++++++++++++++++++++
.../20170404000002_unique_status_name.sql | 23 ++++++++++++++++++++
.../20170404000003_unique_type_name.sql | 23 ++++++++++++++++++++
.../20170404000004_unique_job_agent_name.sql | 23 ++++++++++++++++++++
.../migrations/20170404000005_unique_param.sql | 23 ++++++++++++++++++++
6 files changed, 138 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/994f6f65/traffic_ops/app/db/migrations/20170404000000_unique_job_status_name.sql
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..107657e
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20170404000000_unique_job_status_name.sql
@@ -0,0 +1,23 @@
+/*
+
+ 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;
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/994f6f65/traffic_ops/app/db/migrations/20170404000001_unique_role_name.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/migrations/20170404000001_unique_role_name.sql b/traffic_ops/app/db/migrations/20170404000001_unique_role_name.sql
new file mode 100644
index 0000000..3aca9e2
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20170404000001_unique_role_name.sql
@@ -0,0 +1,23 @@
+/*
+
+ 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;
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/994f6f65/traffic_ops/app/db/migrations/20170404000002_unique_status_name.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/migrations/20170404000002_unique_status_name.sql b/traffic_ops/app/db/migrations/20170404000002_unique_status_name.sql
new file mode 100644
index 0000000..992371d
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20170404000002_unique_status_name.sql
@@ -0,0 +1,23 @@
+/*
+
+ 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;
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/994f6f65/traffic_ops/app/db/migrations/20170404000003_unique_type_name.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/migrations/20170404000003_unique_type_name.sql b/traffic_ops/app/db/migrations/20170404000003_unique_type_name.sql
new file mode 100644
index 0000000..39e86fc
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20170404000003_unique_type_name.sql
@@ -0,0 +1,23 @@
+/*
+
+ 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;
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/994f6f65/traffic_ops/app/db/migrations/20170404000004_unique_job_agent_name.sql
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..5dbed63
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20170404000004_unique_job_agent_name.sql
@@ -0,0 +1,23 @@
+/*
+
+ 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;
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/994f6f65/traffic_ops/app/db/migrations/20170404000005_unique_param.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/migrations/20170404000005_unique_param.sql b/traffic_ops/app/db/migrations/20170404000005_unique_param.sql
new file mode 100644
index 0000000..35286d4
--- /dev/null
+++ b/traffic_ops/app/db/migrations/20170404000005_unique_param.sql
@@ -0,0 +1,23 @@
+/*
+
+ 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;
+