ubicloud/migrate/20251009_add_github_custom_label.rb
Burak Velioglu 37d4ae89b5 Add migration files for github custom labels and actual label column
Adding the migration for github custom labels, which will keep
a custom label which can be used to have label-level limits. Also
adding actual label column to keep what is passed from github as
label.
2025-10-20 15:12:52 +03:00

19 lines
802 B
Ruby

# frozen_string_literal: true
Sequel.migration do
change do
create_table(:github_custom_label) do
# UBID.to_base32_n("gc") => 524
column :id, :uuid, primary_key: true, default: Sequel.lit("gen_random_ubid_uuid(524)")
foreign_key :installation_id, :github_installation, type: :uuid, null: false
column :name, :text, null: false
column :alias_for, :text, null: false
column :concurrent_runner_count_limit, :integer, null: true
column :allocated_runner_count, :integer, null: false, default: 0
unique [:installation_id, :name]
constraint(:allocated_runner_count_limit) { allocated_runner_count <= concurrent_runner_count_limit }
constraint(:concurrent_runner_count_limit_positive) { concurrent_runner_count_limit > 0 }
end
end
end