Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Issues with db:setup and db:migrate #49

@spockz

Description

@spockz

Given an initial model Foo:

class Rekenservice
  include DataMapper::Resource  

  property :prop1,      Integer
end

We perform a rake db:setup && rake db:migrate and all is fine. Now later in development we add a new
property to our column :prop2.

class Rekenservice
  include DataMapper::Resource  

  property :prop1, Integer
  property :prop2, Integer
end

We write a migration for this that reads as follows:

migration 1, :add_prop2 do
  up do
        modify_table :foos do
            add_column :prop2, Integer
        end
    end
end

Subsequently calling rake db:migrate is no problem. However, now when we run rake db:setup && rake db:migrate again after deleting our database we get the following error:

duplicate column name: prop2

This because auto_migrate! in rake db:setup already created the column for :prop2.

What to do about this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions