OSDN Git Service
(root)
/
pettanr
/
pettanr.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
v07
[pettanr/pettanr.git]
/
db
/
migrate
/
20130911043458_copy_to_scroll.rb
1
require Rails.root + 'config/environment'
2
class CopyToScroll < ActiveRecord::Migration
3
def up
4
::Comic.find_each do |i|
5
attr = i.attributes
6
attr.delete 'id'
7
::Scroll.create! attr
8
end
9
::Story.find_each do |i|
10
attr = i.attributes
11
attr.delete 'id'
12
attr.delete 'x'
13
attr.delete 'y'
14
attr.delete 'z'
15
attr['scroll_id'] = attr['comic_id']
16
attr.delete 'comic_id'
17
::ScrollPanel.create! attr
18
end
19
end
20
21
def down
22
end
23
end