Files
ubicloud/migrate/20230323_add_vm_display.rb
Enes Cakir 02c8a89c29 Switch TimestampMigrator from IntegerMigrator
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.
2023-07-05 11:15:03 -07:00

20 lines
598 B
Ruby

# frozen_string_literal: true
Sequel.migration do
change do
create_enum(:vm_display_state, %w[creating running])
alter_table(:vm_host) do
add_column :location, :text, collate: '"C"', null: false
end
alter_table(:vm) do
add_column :display_state, :vm_display_state, default: "creating", null: false
add_column :name, :text, collate: '"C"', null: false
add_column :size, String, collate: '"C"', null: false
add_column :location, String, collate: '"C"', null: false
add_column :boot_image, String, collate: '"C"', null: false
end
end
end