Problem with SQLite and migrations

40 views
Skip to first unread message

Jaemin Noh

unread,
Aug 21, 2019, 7:48:50 AM8/21/19
to Django users
Hello.

My application is currently in a development state, so it's using SQLite as a database backend at the moment.

Due to the bad design decisions, my application has a migration with raw CREATE VIEW statements and unmanaged models. These VIEWs refer other tables with JOIN clauses.
The problem is, when a column is being added to or removed from a table with a migration, Django remakes table(https://github.com/django/django/blob/1e429df748867097451bf0b45d1080ae6828d921/django/db/backends/sqlite3/schema.py#L320-L346), and VIEW throws a 'no such table' error when joined table is being deleted.

Maybe this is SQLite's problem since table is being deleted inside a transaction and this should not cause any problem in theory. Maybe it can be fixed in Django to use ALTER TABLE statement.
Ultimately, I can just get away with this problem if I switch to MySQL or PostgreSQL.

So, what should I do? Where should I report this 'bug' or 'problem'? SQLite? Django?

Thanks in advance.

Jonathan Mrutu

unread,
Aug 21, 2019, 12:42:59 PM8/21/19
to django...@googlegroups.com
Hi Jaemin,

You can try to post this question on stack overflow, but why don't you use PostgreSQL this is recommended.
SQLite as the name implies it's more for testing purpose in a small project environment.
//Jona

Virus-free. www.avast.com

--
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/21c59661-bdba-43f6-9551-de1a6bf278de%40googlegroups.com.

Amitesh Sahay

unread,
Aug 21, 2019, 1:18:15 PM8/21/19
to django...@googlegroups.com
Generally SqlLite is enough for any testing. However, if you are planning to test it with par the other regular DBs, then do not do it. I have seen your GIT-HUB code. Use postgres, you will be happy .


Reply all
Reply to author
Forward
0 new messages