codingelle / django-whatsapp-web-clone

A WhatsApp Web Clone Chat Application for those developers that like to use Django Channel for handling WebSocket request
https://youtu.be/zv7Ra-xW1MU
140 stars 64 forks source link

migrate does not migrate tortoise model #7

Closed modekano closed 3 years ago

modekano commented 3 years ago

when run python manage.py migrate does not migrate tortoise model. after run migrate I get table for ChatGroup only no table for ChatMessage

josnin commented 3 years ago

when run python manage.py migrate does not migrate tortoise model. after run migrate I get table for ChatGroup only no table for ChatMessage

Tortoise ORM doesn't have its own migration yet, you can try to delete the DB first and recreate

rm db.sqlite3.tortoise

Btw, We are using asyncio for our Chat consumer, to have the full performance benefits of using async I decided to use Tortoise ORM (since Django ORM doesn't support the async yet)

modekano commented 3 years ago

Thanks for your response, I did remove the db.sqlite3.tortoise using rm db.sqlite3.tortoise after run migrate again it does not migrate ChatMessage it should generate another instance of sqlite3 as in settings configuration

TORTOISE_INIT = {
    "db_url": "sqlite://db.sqlite3.tortoise",
    "modules" : {
        "models": ["chat.tortoise_models"]
     }
}

do I am right?

josnin commented 3 years ago

Yes, and It will recreate when you start entering the chat message

image

image

modekano commented 3 years ago

It work now, thanks for your kind support regards

Abdul-Rafae-Mohammed commented 2 months ago

Hi,

I am facing this issue as well. I tried deleting the database and ran the runserver command again but still seeing the same issue. Chat doesn't work. Any suggestions?

Abdul-Rafae-Mohammed commented 2 months ago

cursor = self._conn.execute(sql, parameters) sqlite3.OperationalError: no such table: chat_chatmessage Internal Server Error: /chat/history/2/ ..... ..... ..... raise OperationalError(exc) tortoise.exceptions.OperationalError: no such table: chat_chatmessage HTTP GET /chat/history/2/ 500 [0.07, 127.0.0.1:54758]