mirror of
https://github.com/ubicloud/ubicloud.git
synced 2025-11-28 08:30:27 +08:00
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.
19 lines
802 B
Ruby
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
|