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

auto:upgrade fails when turning "has n" relation to not required #14

Open
dlo opened this issue May 9, 2011 · 2 comments
Open

auto:upgrade fails when turning "has n" relation to not required #14

dlo opened this issue May 9, 2011 · 2 comments

Comments

@dlo
Copy link

dlo commented May 9, 2011

I have a model like the following

class Task
  include DataMapper::Resource

  property :id, Serial
  has n, :things
end

I run automigrate and this table syncs fine. I change it to the following:

class Task
  include DataMapper::Resource

  property :id, Serial
  has n, :things, :required => false
end

And autoupgrade fails on a hard to parse error.

(in /home/me/xyz)
DataMapper::Sweatshop::Unique - ParseTree could not be loaded, anonymous uniques will not be allowed
rake aborted!
Cannot add a NOT NULL column with default value NULL

(See full trace by running task with --trace)

AFAIK I am not changing the column to "NOT NULL". In fact I am changing it to allow null values, not remove them.

Other migration engines (such as South) handle this change pretty gracefully.

@danielribeiro
Copy link

+1

@sunomie
Copy link

sunomie commented Jun 26, 2014

Also fails when trying to add a new has n, :things, :required => false. The new id table is marked as INTEGER NOT NULL despite the required => false. Note that adding a new belongs_to :thing, :required => false works fine. Database I'm currently using is sqlite3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants