Questions tagged [on-delete]
8 questions
9
votes
4 answers
PROTECT vs RESTRICT for on_delete (Django)
I read the django documentation about PROTECT and RESTRICT to use with "on_delete".
PROTECT
Prevent deletion of the referenced object by raising ProtectedError, a
subclass of django.db.IntegrityError.
Example:
class MyModel(models.Model):
…

Super Kai - Kazuya Ito
- 22,221
- 10
- 124
- 129
1
vote
0 answers
Why is EF Core not using ON DELETE SET NULL when applying a migration?
I am using Entity Framework Core 6.0 and SQL Server.
I am trying to update a relational database to reflect this diagram:
ER Diagram
where a single red line over a relationship represents ON DELETE CASCADE and a double red line represents ON DELETE…

Gravy
- 11
- 2
0
votes
0 answers
I want to delete the child struct when deleting the parent, trying OnDelete Constraint not working in Gorm
I have the following structs:
type Report struct {
ID uuid.UUID
CreatedAt time.Time
UpdatedAt time.Time
Date time.Time
Rows []Row `gorm:"constraint:OnDelete:CASCADE;"`
}
type Row struct {
ID uuid.UUID
CreatedAt time.Time
UpdatedAt…

Manuelarte
- 1,658
- 2
- 28
- 47
0
votes
2 answers
django on_delete = DO_NOTHING
I am developing an app where I need some of the data to be protected even when some models are deleted. I've been reading on the on_delete options, and seems to be a lot of warnings against using on_delete=DO_NOTHING. In my case, I need the results…

JulienEast
- 27
- 7
0
votes
0 answers
due to foreign key relations, oracle locks a table which will not be affected by the delete statement (on delete set null / on delete cascade)
We observed that while issuing a delete statement, oracle is locking tables which are not impacted due to the specific delete statement.
Consider 4 tables as below.
create table TABLE_A (id number(14,0) not null primary key, code…

GGC
- 1
- 2
0
votes
1 answer
PYTHON PEEWEE on_delete='CASCADE' doesn't work
I have a table and it have a ForeignKeyField referencing another table. ON DELETE functionality is supported by initializing ForeignKeyField with an on_delete argument. Though it's not very clear what values on_delete can take, the documentation…

Maximo Arceci
- 5
- 1
0
votes
1 answer
SwiftUI ForEach.onDelete properly animates but then resets
Trying to figure out why my ForEach loop isn’t updating. I have the model marked as ObservedObject and have done everything I could to make sure the updates were happening. I even saw that the model was being updated while printing.
class Model {
…

Kudit
- 4,212
- 2
- 26
- 32
0
votes
1 answer
How can we set a trigger for NO ACTION foreign key?
I was looking for a way to set a trigger for my table that acts like cascade.
CREATE TABLE Class(
Class_ID BIGINT,
c_InstrumentID BIGINT NOT NULL,
c_StudentID BIGINT,
c_InstructorID BIGINT NOT NULL,
c_InstituteId BIGINT NOT NULL,
c_TermSeason…

mirOOxi
- 25
- 5