Should I avoid the DELETE if I will use it as RAW SQL

I looked at the database scheme and noticed that the on delete CASCADE is not implemented on the database level

So I think that If I use raw sql DELETE it wil not follow the on delete CASCADE condition.

So should we avoid that ?

what will you do it you need that (maybe a complex WHEREstatement idk) ?

Is it mentioned in the documentation that adding CASCADE manually in the database level is legal ?

1 Like

It’s coming. See:

Yes. In general terms you should avoid using raw sql in any situation where the appropriate ORM functionality is provided.

See the docs for DO_NOTHING.

In general terms, doing anything directly to the database is “legal” - it just ends up being up-to-you to ensure that the database remains consistent and functional when accessing it using Django.

1 Like