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

Missing migrations? #29

Open
rhblind opened this issue Dec 13, 2016 · 3 comments
Open

Missing migrations? #29

rhblind opened this issue Dec 13, 2016 · 3 comments

Comments

@rhblind
Copy link

rhblind commented Dec 13, 2016

When using a custom Device model ie. like the one below, makemigrations want to create migrations for the original model.

class FCMDevice(AbstractDevice):
    """
    Firebase Cloud messaging devices
    """
    user = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True)

    class Meta:
        verbose_name = _("FCM Device")
        verbose_name_plural = _("FCM Devices")
$ python manage.py makemigrations
Migrations for 'fcm':
  /Users/rolf/.virtualenvs/someproject/lib/python3.5/site-packages/fcm/migrations/0002_auto_20161213_1303.py:
    - Change Meta options on device
@rhblind rhblind changed the title Extending Device model cause migration errors Missing migrations? Dec 13, 2016
@rhblind
Copy link
Author

rhblind commented Dec 13, 2016

It seems like there's a missing migration.

@dvkovner
Copy link

(env) C:\Source\hospital>python manage.py makemigrations
Migrations for 'fcm':
0002_auto_20161214_1238.py:
- Change Meta options on device

@AndySun25
Copy link

AndySun25 commented Dec 14, 2016

I think it's generally not advisable to have meta options on the abstract base model, I've relocated model meta options to the child model in my fork and that solved the issue (no migrations were needed).

EDIT
Either that or inherit AbstractDevice's metaclass

class Device(AbstractDevice):
    class Meta(AbstractDevice.Meta):
        swappable = 'FCM_DEVICE_MODEL'

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