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

migrate error #4

Closed
chobijaeyu opened this issue Sep 6, 2019 · 1 comment
Closed

migrate error #4

chobijaeyu opened this issue Sep 6, 2019 · 1 comment
Assignees

Comments

@chobijaeyu
Copy link

models:
from birthday.fields import BirthdayField
from birthday.managers import BirthdayManager

birthday = BirthdayField()
objects = BirthdayManager()

when run migrate get error
error msg:django.db.utils.OperationalError: duplicate column name: birthday_dayofyear_internal

may i ask how fix this problem?
thanks for your time

@Steckelfisch
Copy link

Steckelfisch commented Feb 12, 2020

I had the same problem when running migrate on a sqlite3 db for a testing database.
The original migration file had the folowing definitions:
.......
('date_of_birth', birthday.fields.BirthdayField(verbose_name='Geboren op')),
....
('date_of_birth_dayofyear_internal', models.PositiveSmallIntegerField(default=None, editable=False, null=True)),
......

When BirthdayField is 'loaded' it creates the "_dayofyear_internal" column. Then the
'internal' definition is loaded. BirthdayField checks the existance of the 'internal' column, PositiveSmallInteger does not.
Place the 'internal'/PositiveSmallInteger definition above the BirthdayField.
That did it for me. (at least I could run migrate again)
(first use with Django 1.x, python 2.7. 'fixed' like above with django 2, python 3)

@bashu bashu self-assigned this Dec 9, 2020
@bashu bashu closed this as completed in fb7d05f Oct 9, 2021
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

3 participants