Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Migration? #6

Closed
andyl opened this issue Sep 13, 2011 · 1 comment
Closed

Data Migration? #6

andyl opened this issue Sep 13, 2011 · 1 comment

Comments

@andyl
Copy link

andyl commented Sep 13, 2011

MiniRecord looks fantastic - thanks!!!

Question: During a migration, sometimes I need to to more than just modify the database schema. For example, I might want to migrate data from an old column to a new column, before deleting the old column.

class TestMigration < ActiveRecord::Migration
  def self.up
    add_column :phones, :number, :string
    execute ("update phones set number = concat(area_code, prefix, suffix)")
    remove_column :phones, :area_code
    remove_column :phones, :prefix
    remove_column :phones, :suffix
  end
end

Can I do something like this with mini_record ??

@DAddYE
Copy link
Owner

DAddYE commented Sep 13, 2011

Sure! Open your console, in padrino padrino console in rails should be some like rails console, the simply require that file ie: require 'db/migrations/test_migration.rb'.

@DAddYE DAddYE closed this as completed Sep 13, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants