Skip to content

Instantly share code, notes, and snippets.

@madx
Created December 15, 2009 09:40
Show Gist options
  • Save madx/256812 to your computer and use it in GitHub Desktop.
Save madx/256812 to your computer and use it in GitHub Desktop.
class SplitLog < Sequel::Migration
def up
alter_table :comments do
add_foreign_key :entry_id, :entries
end
alter_table :entries do
drop_column :url
add_column :author, String
end
alter_table :issues do
rename_column :description, :body
end
end
def down
alter_table :comments do
drop_column :entry_id
end
alter_table :entries do
add_column :url, String
drop_column :author
end
alter_table :issues do
rename_column :body, :description
end
end
end
class AddForeignKeysToEvents < Sequel::Migration
def up
alter_table :events do
add_foreign_key :issue_id, :issues
add_foreign_key :entry_id, :entries
end
end
def down
alter_table :events do
drop_column :issue_id
drop_column :entry_id
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment