zrhoffman commented on code in PR #7586: URL: https://github.com/apache/trafficcontrol/pull/7586#discussion_r1245376002
########## traffic_ops/app/db/migrations/2023062011541800_operations_role_add_perm.down.sql: ########## @@ -0,0 +1,28 @@ +/* + * 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. + */ + +WITH role_id_query AS ( + SELECT id FROM public.role WHERE name = 'operations' +) +DELETE FROM public.role_capability +WHERE role_id IN ( + SELECT id FROM role_id_query +) + AND cap_name = 'DNS-SEC:READ' + AND EXISTS ( + SELECT 1 FROM role_id_query + ); Review Comment: Nit: ```sql AND EXISTS ( SELECT FROM role_id_query ); ``` ########## traffic_ops/app/db/migrations/2023062011541800_operations_role_add_perm.up.sql: ########## @@ -0,0 +1,24 @@ +/* + * 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. + */ + +WITH role_id_query AS ( + SELECT id FROM public.role WHERE name = 'operations' +) +INSERT INTO public.role_capability ("role_id", cap_name) +SELECT id, 'DNS-SEC:READ' +FROM role_id_query +WHERE EXISTS (SELECT 1 FROM role_id_query); Review Comment: Nit: ```sql WHERE EXISTS (SELECT FROM role_id_query); ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
