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

Incorect work with migrations in Django 1.7 #50

Open
zloy531 opened this issue Nov 11, 2014 · 6 comments
Open

Incorect work with migrations in Django 1.7 #50

zloy531 opened this issue Nov 11, 2014 · 6 comments
Assignees
Labels

Comments

@zloy531
Copy link

zloy531 commented Nov 11, 2014

Problem with default values of fields.
For example: roles = IntegerArrayField(blank=True, default=[0, 1])
It create migration like:

...
field=djorm_pgarray.fields.IntegerArrayField(default=[0, 1]),
...

It causes error when migrate: django.db.utils.DataError: missing "]" in array dimensions

Temporarily I manualy changed migration to field=djorm_pgarray.fields.IntegerArrayField(default='{0, 1}'). It works fine.

Do you have any ideas to fix it?

@zloy531 zloy531 changed the title Incorect working with migrations in Django 1.7 Incorect work with migrations in Django 1.7 Nov 11, 2014
@niwinz niwinz added the bug label Nov 18, 2014
@niwinz niwinz self-assigned this Nov 18, 2014
@niwinz
Copy link
Owner

niwinz commented Nov 18, 2014

Can you test the latest version (1.2) it should fix it.

@systemsoverload
Copy link

Seems to be working OK for me on 1.7 with a similar use case.

@niwinz niwinz closed this as completed Jan 16, 2015
@niwinz
Copy link
Owner

niwinz commented Jan 16, 2015

Thanks

@ses4j
Copy link
Contributor

ses4j commented Jan 26, 2015

I think this issue should be reopened. Using pgarray 1.2, if the field is defined as:

    str_array = TextArrayField(default=[], null=False, blank=False)

It fails on Django 1.7 migrate: django.db.utils.DataError: missing dimension value. Though it seems to workaround fine if I do this:

 str_array = TextArrayField(default="{}", null=False, blank=False)

@AJRenold
Copy link

AJRenold commented Jun 8, 2015

@niwinz I found this issue searching Github and has to use the same solution as @ses4j. I also noticed the field definition in the test cases here - https://github.com/niwinz/djorm-pgarray/blob/master/testing/pg_array_fields/models.py#L16 - where a function defines the default value by returning a list.

I don't fully understand the constraints, but setting the default with default=[] seems like the good/correct behavior.

@niwinz niwinz reopened this Jun 9, 2015
@niwinz
Copy link
Owner

niwinz commented Jun 9, 2015

Is clearly not fixed bug! I'll reopen the issue.

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

No branches or pull requests

5 participants