Django Table already exist

2024/10/6 6:49:57

Here is my Django Migration file. When I run

python manage.py makemigrations/migrate 

I get this error.

Error:-django.db.utils.OperationalError: (1050, "Table 'tickets_duration' already exists")

I have dropped the database and running it but still get the same error.

class Migration(migrations.Migration):dependencies = []operations = [migrations.CreateModel(name='Duration',fields=[('Id', models.UUIDField(primary_key=True, db_column=b'duration_id', default=uuid.uuid4, serialize=False, editable=False)),('duration', models.CharField(max_length=200, db_column=b'duration')),],),migrations.CreateModel(name='ErrorCount',fields=[('Id', models.UUIDField(primary_key=True, db_column=b'error_id', default=uuid.uuid4, serialize=False, editable=False)),('error', models.CharField(max_length=200, db_column=b'error')),],),migrations.CreateModel(name='OutageCaused',fields=[('Id', models.UUIDField(primary_key=True, db_column=b'error_id', default=uuid.uuid4, serialize=False, editable=False)),('outage_caused', models.CharField(max_length=200, db_column=b'outage_caused')),],),migrations.CreateModel(name='Pg',fields=[('Id', models.UUIDField(primary_key=True, db_column=b'pg_id', default=uuid.uuid4, serialize=False, editable=False)),('pg_cd', models.CharField(max_length=200, db_column=b'pg_cd')),],),migrations.CreateModel(name='SystemCaused',fields=[('Id', models.UUIDField(primary_key=True, db_column=b'error_id', default=uuid.uuid4, serialize=False, editable=False)),('system_caused', models.CharField(max_length=200, db_column=b'system_caused')),],),migrations.CreateModel(name='Tickets',fields=[('ticket_num', models.CharField(max_length=100, serialize=False, primary_key=True, db_column=b'ticket_id')),('created_dt', models.DateTimeField(db_column=b'created_dt')),('ticket_type', models.CharField(max_length=20, db_column=b'ticket_type')),('addt_notes', models.CharField(max_length=1000, db_column=b'addt_notes')),('row_create_ts', models.DateTimeField(default=datetime.datetime(2016, 2, 29, 16, 58, 31, 584733))),('row_end_ts', models.DateTimeField(default=b'9999-12-31 00:00:00.00000-00', db_column=b'row_end_ts')),('duration', models.ManyToManyField(to='tickets.Duration')),('error_count', models.ManyToManyField(to='tickets.ErrorCount')),('outage_caused', models.ManyToManyField(to='tickets.OutageCaused')),
Answer

try python manage.py migrate your_app --fake. This post talks about it. Django South - table already exists.

https://en.xdnf.cn/q/70395.html

Related Q&A

Python round() too slow, faster way to reduce precision?

I am doing the following:TOLERANCE = 13 some_float = ... round(some_float, TOLERANCE)This is run many times, so performance is important. I have to round some_float due to floating point representation…

Reading .doc file in Python using antiword in Windows (also .docx)

I tried reading a .doc file like - with open(file.doc, errors=ignore) as f:text = f.read()It did read that file but with huge junk, I cant remove that junk as I dont know from where it starts and where…

Error installing package with pip

Im trying to install a charting tool (matplotlib-v1.4.2) for python 3.4 in Windows 7, so far all my trails doesnt seem to do the job.Attempts:Ive downloaded pip from GitHub python -m pip install matplo…

Assign new values to certain tensor elements in Keras

I need to change the value of some elements of a tensor. I know what elements -- they are in a boolean tensor already.I dont see how to do this in keras code. But if I were using TensorFlow code I woul…

Making grid triangular mesh quickly with Numpy

Consider a regular matrix that represents nodes numbered as shown in the figure:I want to make a list with all the triangles represented in the figure. Which would result in the following 2 dimensional…

df [X].unique() and TypeError: unhashable type: numpy.ndarray

all,I have a column in a dataframe that looks like this:allHoldingsFund[BrokerMixed] Out[419]: 78 ML 81 CITI 92 ML 173 CITI 235 ML 262 ML 264 ML 25617 …

Python pandas idxmax for multiple indexes in a dataframe

I have a series that looks like this:delivery 2007-04-26 706 23 2007-04-27 705 10706 1089708 83710 13712 51802 4806 181…

No of Pairs of consecutive prime numbers having difference of 6 like (23,29) from 1 to 2 billion

How to find number of pairs of consecutive prime numbers having difference of 6 like (23,29) from 1 to 2 billion (using any programming language and without using any external libraries) with consideri…

Building a docker image for a flask app fails in pip

from alpine:latest RUN apk add --no-cache python3-dev \&& pip3 install --upgrade pipWORKDIR /backend COPY . /backendRUN pip --no-cache-dir install -r requirements.txt EXPOSE 5000 ENTRYPOINT [py…

Why is numba so fast?

I want to write a function which will take an index lefts of shape (N_ROWS,) I want to write a function which will create a matrix out = (N_ROWS, N_COLS) matrix such that out[i, j] = 1 if and only if j…