Files
ubicloud/model/project_quota.rb
Jeremy Evans 30247a3800 Include model annotations at the bottom of all model files
This makes it easier for developers new to the codebase to
easily get important information on the model's table in the
same file as the model code.

To ensure the model annotations stay accurate, run them on
test_up/test_down.  In CI, regenerate the annotations, and
check for no changes, similar to how the linters work.
2024-11-13 09:13:30 -08:00

30 lines
637 B
Ruby

# frozen_string_literal: true
require_relative "../model"
class ProjectQuota < Sequel::Model
# :nocov:
def self.freeze
default_quotas
super
end
# :nocov:
def self.default_quotas
@default_quotas ||= YAML.load_file("config/default_quotas.yml").each_with_object({}) do |item, hash|
hash[item["resource_type"]] = item
end
end
end
ProjectQuota.unrestrict_primary_key
# Table: project_quota
# Primary Key: (project_id, quota_id)
# Columns:
# project_id | uuid |
# quota_id | uuid |
# value | integer | NOT NULL
# Indexes:
# project_quota_pkey | PRIMARY KEY btree (project_id, quota_id)