On 12/02/2019 11:47 am, Victor H. Velasquez Rizo wrote:
> Yes Mike.
> I have done both:
In that case, you need to inspect the database itself using PGAdmin (or
similar for other databases) and confirm that the gallery_photos table
does indeed have a sort_value column.
If not - as the error message says - then the database might have been
rebuilt from a dump taken prior the migration which added sort_value. Or
perhaps restored from an earlier backup. In any case, if it doesn't
exist you have to make it exist.
I'm assuming this is a development database not in production so one way
is to cheat. If anyone else reading this notices a mistake please jump
in and correct it.
Look through the migrations and find the one which first added
sort_value. Delete the migrations.AddField() call for sort_value from
that migration. Look for any mentions of sort_value in other migrations
and get rid of them too. There will also be an AlterTable or Options
line referring to sort_value which needs to have sort_value removed.
That will trick the migration system into thinking it doesn't exist. The
next time you run makemigrations it will discover a new field sort_value
and add it.
There is a potential problem here. If migrations from other apps depend
on sort_value things may come unstuck. However, it is a good bet that
sort_value was added to adjust a display sequence and won't have wider
impact.
This is tricky territory so you should do nothing until you have dumped
your database and proved you can restore it. Keep your dump as a
pre-sort_value backup.
Go carefully
Good luck
Mike
>
> *python manage.py makemigrations*
> /home/vic/dev/scribblitt/scribblitt-app/.env/local/lib/python2.7/site-packages/django/db/models/sql/query.py:1156:
> RemovedInDjango19Warning: Passing callable argumentsto queryset is
> deprecated.
> value, lookups, used_joins = self.prepare_lookup_value(value,
> lookups, can_reuse,allow_joins)
>
> *No changes detected*
>
> *python manage.py migrate*
> /home/vic/dev/scribblitt/scribblitt-app/.env/local/lib/python2.7/site-packages/django/db/models/sql/query.py:1156:
> RemovedInDjango19Warning: Passing callable argumentsto queryset is
> deprecated.
> value, lookups, used_joins = self.prepare_lookup_value(value,
> lookups, can_reuse,allow_joins)
>
> Operations to perform:
> Synchronize unmigrated apps: anymail, filebrowser, staticfiles,
> admindocs, model_utils, tinymce, messages, widget_tweaks, sitemaps,
> humanize, django_extensions, rest_framework, storages, debug_toolbar,
> admin_reorder
> Apply all migrations: invoices, general, chunks, makeaword,
> accounts, images, comic, orders, illustrate, pressroom, sites, write,
> contenttypes, book, thumbnail, django_comments, tellinstories,
> sessions, cart, auth, definition, admin, gift_cards, photologue,
> wordsearch, stationary
> Synchronizing apps without migrations:
> Creating tables...
> Running deferred SQL...
> Installing custom SQL...
> *Running migrations:*
> * No migrations to apply.*
>
>
>
>
>
>
>
> <mailto:
mi...@dewhirst.com.au>> wrote:
>
> On 12/02/2019 10:23 am, Victor H. Velasquez Rizo wrote:
> > Hello Mike.
> > I have ran the migrations for PHOLOGUE:
> > *Running migrations:*
> > * No migrations to apply.*
> >
>
> Ok, have you done manage.py makemigrations followed by manage.py
> migrate?
>
> >
> >
> >
> >
> >
> >
> > On Mon, Feb 11, 2019 at 4:02 PM Mike Dewhirst
> <
mi...@dewhirst.com.au <mailto:
mi...@dewhirst.com.au>
> > <mailto:
mi...@dewhirst.com.au <mailto:
mi...@dewhirst.com.au>>>
> <mailto:
django-users%2Bunsu...@googlegroups.com>
> >> <mailto:
django-users...@googlegroups.com
> <mailto:
django-users%2Bunsu...@googlegroups.com>>.
> <mailto:
django...@googlegroups.com
> <mailto:
django-users%2Bunsu...@googlegroups.com>.
>
https://groups.google.com/d/msgid/django-users/CAFCXTzimx%2BnMPz3-gYgohEsJay5coBrFwOsGPrVGwZLMhrU%2BcQ%40mail.gmail.com
> <
https://groups.google.com/d/msgid/django-users/CAFCXTzimx%2BnMPz3-gYgohEsJay5coBrFwOsGPrVGwZLMhrU%2BcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.