I´m stuck trying to migrate my new models using django 2.1.
For some reason it only creates the id column.
Having done that, I get the following strange behaviour:
makemigrations ui:
No changes detected in app 'ui'
migrate ui
No migrations to apply. Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
Doing as said by the cli I´m ending up in a loop.
Here is my models.py
from django.db import models
from django.contrib.auth.models import User
class Customer(models.Model):
customer_id: models.AutoField(primary_key=True)
customer_su_object: models.ForeignKey(User, on_delete=models.CASCADE)
set_customer_mails: models.BooleanField(default='1')
set_contact_point: models.EmailField(blank=True)
set_tracking_link: models.CharField(max_length=100, blank=True)
set_primary_color: models.CharField(max_length=100, blank=True)
set_warn: models.IntegerField(max_length=2)
stat_saved: models.IntegerField(max_length=100, blank=True)
stat_active: models.IntegerField(max_length=100, blank=True)
stat_warn: models.IntegerField(max_length=100, blank=True)
stat_case: models.IntegerField(max_length=100, blank=True)
I do not get any error messages. As well I already deleted the table and all migrations and tried to do an initial migration from scratch (with all the above set). It again creates the id column and that is it. My 0001_initial.py looks like this:
# Generated by Django 2.1.2 on 2018-11-25 16:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
]
As you can see it does not take any of my models.py into account. I am pretty new to Django and python so I would really appreciate any help on how to unstuck this. Last thing: I´m using SQLite on my dev env.
Thanks for your time!
All of your fields have the she y syntax issue: you used a colon instead of an equals sign. It should be:
set_customer_mails = models.BooleanField(default='1')
etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With