SQLite Forum

Foreign key that is never enforced?

Is it possible to have a foreign key that is never enforced when writing to the database?

I'd like the foreign key to exist as many GUI tools read the schema and allow jumping to the related rows.

I am representing a JSON graph as SQL tables/rows, and some relations are allowed to be violated.

As an example, there are two objects, customer, subscription. A customer can be deleted, but a subscription cannot be deleted.

A FK exists on subscription: `FOREIGN KEY(customer) REFERENCES Customer(id)`.

When the customer is deleted I do not want any error to be thrown.