Files
ubicloud/model/postgres/postgres_metric_destination.rb
Jeremy Evans 718370f4c9 Convert ResourceMethods to a plugin
Allow plugin to take an etc_type keyword argument for using the
TYPE_ETC ubid type, and remove the separate definitions in every
model that uses the TYPE_ETC ubid type.

This was the cleanest way to DRY things up.  You cannot extend
the models with a module to do this before including ResourceMethods,
because then ResourceMethods::ClassMethods will override it, and
you cannot extend the models with a module to do this after
including ResourceMethods, because the inclusion will not work
correctly due to the eager definition of @ubid_format.

Best reviewed without whitespace differences.
2025-06-04 04:55:45 +09:00

26 lines
747 B
Ruby

# frozen_string_literal: true
require_relative "../../model"
class PostgresMetricDestination < Sequel::Model
many_to_one :postgres_resource, key: :postgres_resource_id
plugin ResourceMethods
plugin :column_encryption do |enc|
enc.column :password
end
end
# Table: postgres_metric_destination
# Columns:
# id | uuid | PRIMARY KEY
# postgres_resource_id | uuid | NOT NULL
# url | text | NOT NULL
# username | text | NOT NULL
# password | text | NOT NULL
# Indexes:
# postgres_metric_destination_pkey | PRIMARY KEY btree (id)
# Foreign key constraints:
# postgres_metric_destination_postgres_resource_id_fkey | (postgres_resource_id) REFERENCES postgres_resource(id)