I’m looking to implement a type that has a Time To...
# orm-help
p
I’m looking to implement a type that has a Time To Live (TTL), in other words it expires after at a specified date and is automatically deleted. I have a relation between this object and another and the onDelete property is set to SET_NULL. Will this delete the connection (the id of the expired instance from the other instance) when the expired instance is deleted?
r
Hey @Philipp Rajah Moura Srivastava As you have an
onDelete
rule, it should set the value to null after that is deleted. The TTL implementation would have to be added in a trigger though.
t
Does this mean that Prisma2 isn't supporting automatic TTL removal?
r
No it doesn’t. You would need to add separate logic for that at the DB level if the database supports it.