Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/svenfuchs/data_migrations
https://github.com/svenfuchs/data_migrations
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/svenfuchs/data_migrations
- Owner: svenfuchs
- License: mit
- Created: 2011-08-11T14:06:03.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-08-24T14:05:50.000Z (over 13 years ago)
- Last Synced: 2024-10-26T22:39:38.126Z (2 months ago)
- Language: Ruby
- Size: 105 KB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# data\_migrations [![Build Status](https://secure.travis-ci.org/svenfuchs/data_migrations.png)](http://travis-ci.org/svenfuchs/data_migrations)
class CreateBuilds < ActiveRecord::Migration
def self.up
create_table :tests do |t|
# ...
endmigrate_table :builds, :to => :tests |t|
t.where 'parent_id IS NULL'
t.move :number
t.copy :parent_id, :to => :build_id
t.copy :commit, :result, :to => [:hash, :status]
t.copy :all# t.copy :all, :except => :foo
# t.exec 'UPDATE foo ...'
# t.set :source, 'github'
end
enddef self.down
# revert the whole thing. not sure we can derive this automatically?migrate_table :builds, :to => :tests |t|
t.move :number
t.copy :build_id, :to => :parent_id
t.copy :hash, :status, :to => [:commit, :result]
enddrop_table :tests
end
end