datamapper / dm-migrations

DataMapper plugin for writing and speccing migrations
http://datamapper.org/
MIT License
66 stars 42 forks source link

Foreign Key request #50

Open avillagran opened 11 years ago

avillagran commented 11 years ago

Hi!

I added Foreign Key creation, some examples:

migration 1, :create_people_table do
  up do
    create_table :jobs do
      column :id,   Integer, :serial => true
      column :name, String
    end
    create_table :people do
      column :id,   Integer, :serial => true
      column :desc, String
      column :job_id
    end

    modify_table :people do
      add_foreign_key :job_id, :jobs
    end
  end

  down do
    modify_table :people do
      drop_foreign_key :jobs
    end
  end
end
tpitale commented 8 years ago

@avillagran Would you mind rebasing against master and I'll take a look at this? Thanks!

tpitale commented 8 years ago

I think this is going to have to wait until after dm-core 1.3.0 stable is released.