require 'sequel'
DB = Sequel.connect('your_database_url')
# Step 1: Define the migration
Sequel.migration do
change do
# Step 2: Alter the table
alter_table(:your_table) do
# Step 3: Add a new column
add_column :new_column, Integer
# Step 4: Set a default value for the new column
add_column :another_column, String, default: 'default_value'
# Step 5: Modify the type and add a constraint to an existing column
set_column_type :existing_column, String
add_index :existing_column, unique: true
# Step 6: Drop a column
drop_column :obsolete_column
end
end
end
# Step 7: Run the migration
DB.run(DB[:schema_info].insert(migrator: 'your_migration_name'))