You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/03/22 16:58:01 UTC
[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #6544: Layered profile `servers/` API {GET, POST, PUT & DELETE}
rawlinp commented on a change in pull request #6544:
URL: https://github.com/apache/trafficcontrol/pull/6544#discussion_r832399314
##########
File path: traffic_ops/app/db/migrations/2022011314075900_add_server_profile.up.sql
##########
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you 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.
+ */
+
+CREATE TABLE IF NOT EXISTS public.server_profile (
+ server bigint NOT NULL,
+ profile_names text[] NOT NULL,
+ priority bigint[] NOT NULL,
+ CONSTRAINT pk_server_profile PRIMARY KEY(profile_names, server),
+ CONSTRAINT fk_server_id FOREIGN KEY (server) REFERENCES public.server(id) ON DELETE CASCADE ON UPDATE CASCADE
+);
Review comment:
I haven't been following this closely, but I believe @ocket8888 is correct -- we should generally avoid array-type columns (which are basically unique to PostgreSQL) in order to maintain referential integrity. This means we don't have referential integrity:
> under your current implementation, servers can have entries in their profileNames that aren't the names of any existing Profiles
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org