Last active
August 29, 2015 13:56
-
-
Save metalefty/9223871 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SQLiteを使っていてカラム削除の migration を作るとこんな感じ? | |
class RemoveCFromT1 < ActiveRecord::Migration | |
def up | |
execute " | |
CREATE TEMPORARY TABLE t1_backup(a,b); | |
INSERT INTO t1_backup SELECT a,b FROM t1; | |
DROP TABLE t1; | |
CREATE TABLE t1(a,b); | |
INSERT INTO t1 SELECT a,b FROM t1_backup; | |
DROP TABLE t1_backup;" | |
end | |
def down | |
add_column :t1, :c, :integer | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment