Files
ubicloud/model/certs_load_balancers.rb
Jeremy Evans c4b0e3472b Use #before_destroy instead of #destroy in a couple places
This is simpler, and still runs inside the same transaction (#destroy
uses a transaction internally).

Also, use Dataset#destroy instead of all.each(&:destroy).
2025-06-04 04:55:45 +09:00

26 lines
660 B
Ruby

# frozen_string_literal: true
require_relative "../model"
class CertsLoadBalancers < Sequel::Model
many_to_one :cert
plugin ResourceMethods, etc_type: true
def before_destroy
cert.incr_destroy
super
end
end
# Table: certs_load_balancers
# Primary Key: (load_balancer_id, cert_id)
# Columns:
# load_balancer_id | uuid |
# cert_id | uuid |
# Indexes:
# certs_load_balancers_pkey | PRIMARY KEY btree (load_balancer_id, cert_id)
# Foreign key constraints:
# certs_load_balancers_cert_id_fkey | (cert_id) REFERENCES cert(id)
# certs_load_balancers_load_balancer_id_fkey | (load_balancer_id) REFERENCES load_balancer(id)