Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django.db.utils.programmingerror: (1146

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='count',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('stock', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='Esrl',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('location_number', models.CharField(max_length=15)),
            ],
        ),
        migrations.CreateModel(
            name='ESRLequipmentinfo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('equipment_name', models.CharField(max_length=40)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True)),
                ('location_number', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.esrl')),
            ],
        ),
        migrations.CreateModel(
            name='History',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150)),
                ('Previous_location', models.CharField(max_length=40)),
                ('new_location', models.CharField(max_length=40)),
                ('euipment_name', models.CharField(max_length=40)),
                ('equipment_count', models.IntegerField()),
                ('created_date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='move',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150)),
                ('created_date', models.DateTimeField(auto_now_add=True, null=True)),
                ('equipment_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.esrlequipmentinfo')),
                ('location_number', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.esrl')),
                ('stock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.count')),
            ],
        ),
        migrations.AddField(
            model_name='count',
            name='equipment_name',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.esrlequipmentinfo'),
        ),
        # commenting on this section will force Django to create this
        # table after running makemigrations


        # migrations.CreateModel(
        #     name='add',
        #     fields=[
        #         ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
        #         ('name', models.CharField(max_length=150)),
        #         ('created_date', models.DateTimeField(auto_now_add=True, null=True)),
        #         ('equipment_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.esrlequipmentinfo')),
        #         ('location_number', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.esrl')),
        #         ('stock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Lab.count')),
        #     ],
        # ),
    ]
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
3+1 =