mirror of
https://github.com/ubicloud/ubicloud.git
synced 2025-10-05 06:12:09 +08:00
This adds a foreign key in the vm table for the init script, and a string column for the args to the init script. This allows easy separation of per-VM data from multiple VM data Unlike SSH public keys, We will not track per-VM init scripts, all VM init scripts will need to be registered with the project to be used (we can support auto registration on VM creation if we want).
19 lines
557 B
Ruby
19 lines
557 B
Ruby
# frozen_string_literal: true
|
|
|
|
Sequel.migration do
|
|
change do
|
|
create_table(:vm_init_script) do
|
|
# UBID.to_base32_n("1n") => 53
|
|
column :id, :uuid, primary_key: true, default: Sequel.lit("gen_random_ubid_uuid(53)")
|
|
foreign_key :project_id, :project, type: :uuid, null: false
|
|
String :name, null: false
|
|
String :script, null: false
|
|
unique [:project_id, :name]
|
|
end
|
|
|
|
alter_table(:vm) do
|
|
add_foreign_key :init_script_id, :vm_init_script, type: :uuid
|
|
add_column :init_script_args, String
|
|
end
|
|
end
|
|
end
|