Question on migrations vs postgres database

36 views
Skip to first unread message

Ram

unread,
Jun 13, 2020, 1:32:14 AM6/13/20
to django...@googlegroups.com
Hi,

We clone our project repository from GIT hub and deployed our web application in our development server in the past. The application was working fine in the past. Now we merged our new features into the same repository which has new models in our models.py. When we merged the changes into the development server, we tried running these commands

1. python3 manage.py makemigrations
< no changes detected >
2. python3 manage.py migrate
< no migrations to apply >
3. python3 manage.py reset_migrations
< all the migrations are created fine including new tables >

 But the issue is Postgres database does not show 2 of those new tables and we are not able to find any clue in the postgres database logs other than these log lines.

2020-06-13 02:48:34.627 UTC [7463] vxxx@vyyyy ERROR:  relation "pages_rim_classifieds_messages" does not exist
......
2020-06-13 04:03:54.943 UTC [10103] vxxx@vyyyy ERROR:  relation "pages_rim_classifieds_messages" does not exist at character 35
2020-06-13 04:03:54.943 UTC [10103] vxxx@vyyyy STATEMENT:  SELECT COUNT(*) AS "__count" FROM "pages_rim_classifieds_messages" WHERE ("pages_rim_classifieds_messages"."To" IS NULL AND "pages_rim_classifieds_messages"."flag" = 'u')
2020-06-13 04:03:54.965 UTC [10103] vxxx@vyyyy ERROR:  relation "pages_rim_classifieds_messages" does not exist at character 475
2020-06-13 04:03:54.965 UTC [10103] vxxx@vyyyy STATEMENT:  SELECT "pages_rim_classifieds_messages"."id", "pages_rim_classifieds_messages"."adv_id", "pages_rim_classifieds_messages"."message", "pages_rim_classifieds_messages"."username", "pages_rim_classifieds_messages"."flag", "pages_rim_classifieds_messages"."status", "pages_rim_classifieds_messages"."addedon", "pages_rim_classifieds_messages"."From", "pages_rim_classifieds_messages"."To", "pages_rim_classifieds_messages"."ttle", "pages_rim_classifieds_messages"."delete" FROM "pages_rim_classifieds_messages" WHERE ("pages_rim_classifieds_messages"."To" IS NULL AND "pages_rim_classifieds_messages"."flag" = 'u') LIMIT 21


I appreciate if someone can give us some clue if we are missing anything?

Best regards,
~Ram

 



Integr@te System

unread,
Jun 13, 2020, 2:25:42 AM6/13/20
to django...@googlegroups.com
Hi Ram,

Plz check line #44 in reset_migrations.py
try replace square bracket by percent sign.

Or check temp file before your actions execute commands migration.

Goodluck.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BOi5F0rWEhv9c%3Dc9q_%3D6qwUAFuLwRHVc1sPBTjtKbtkHpuoBQ%40mail.gmail.com.

Ram

unread,
Jun 14, 2020, 5:24:30 PM6/14/20
to django...@googlegroups.com
Hi,

I tried replacing square bracket with % and ran this command the result is returned as follows. Hope I'm not missing anything. I tried to use app name in the command but the result is same.

(xxxxx) xxxenv@2332333223:~/xxx/xxxv$ python3 manage.py reset_migrations
Traceback (most recent call last):
  .......
.......
  File "/home/vxxx/vxxx_a/xxxenv/lib/python3.7/site-packages/reset_migrations/management/commands/reset_migrations.py", line 44
    self.cursor.execute("DELETE from django_migrations WHERE app = %s", % app)
                                                                        ^
SyntaxError: invalid syntax
(xxxxx) xxxenv@2332333223:~/xxx/xxxv$

P.S.
Also I did not understand your second suggestion of this one.

Or check temp file before your actions execute commands migration.

thanks,
~Ram


Ram

unread,
Jun 21, 2020, 6:05:19 PM6/21/20
to django...@googlegroups.com
Hi all,

Anyone has a clue on this? I appreciate if someone look into this and help us unblocking this?

Thanks,
~Ram

Mike Dewhirst

unread,
Jun 21, 2020, 9:53:33 PM6/21/20
to Django users
On 22/06/2020 8:04 am, Ram wrote:
>   self.cursor.execute("DELETE from django_migrations WHERE app = %s",
> % app)

There should not be a comma in that line


Reply all
Reply to author
Forward
0 new messages