IntegerMigrator doesn't allow duplicate migrations (1_foo, 1_bar). Requires manual renaming for simultaneous migrations. Here's comparison in detail: https://sequel.jeremyevans.net/rdoc/files/doc/migration_rdoc.html#label-Two+separate+migrators The TimestampMigrator will be used if any filename in the migrations directory has a version greater than 20000101. IntegerMigrator keeps version information at scheme_info table with an integer. But TimestampMigrator keeps version information at scheme_migrations tables with all filenames. It's not backward compatible. You need to reset your database or create and fill scheme_migrations table manually, then drop scheme_info table.
28 lines
1.1 KiB
Ruby
28 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
Sequel.migration do
|
|
change do
|
|
alter_table(:vm) do
|
|
add_column :local_vetho_ip, :text, collate: '"C"'
|
|
end
|
|
create_table :address do
|
|
column :id, :uuid, primary_key: true, default: Sequel.lit("gen_random_uuid()")
|
|
column :cidr, :cidr, null: false, unique: true
|
|
column :is_failover_ip, :boolean, null: false, default: false
|
|
foreign_key :routed_to_host_id, :vm_host, type: :uuid, null: false
|
|
end
|
|
create_table :assigned_vm_address do
|
|
column :id, :uuid, primary_key: true, default: Sequel.lit("gen_random_uuid()")
|
|
column :ip, :cidr, null: false, unique: true
|
|
foreign_key :address_id, :address, type: :uuid, null: false
|
|
foreign_key :dst_vm_id, :vm, type: :uuid, null: false
|
|
end
|
|
create_table :assigned_host_address do
|
|
column :id, :uuid, primary_key: true, default: Sequel.lit("gen_random_uuid()")
|
|
column :ip, :cidr, null: false, unique: true
|
|
foreign_key :address_id, :address, type: :uuid, null: false
|
|
foreign_key :host_id, :vm_host, type: :uuid, null: false
|
|
end
|
|
end
|
|
end
|