Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable SQLite foreign key on post-connect #2833

Closed
Ocramius opened this issue Sep 2, 2017 · 8 comments
Closed

Enable SQLite foreign key on post-connect #2833

Ocramius opened this issue Sep 2, 2017 · 8 comments

Comments

@Ocramius
Copy link
Member

Ocramius commented Sep 2, 2017

Apparently, SQLite has supported foreign keys for ages! All we need to do is (according to https://sqlite.org/foreignkeys.html) run a statement on post-connect:

PRAGMA foreign_keys = ON;

Not sure where to do it exactly, but this would be a very welcome addition.

@Federkun
Copy link
Contributor

Federkun commented Sep 2, 2017

Not sure where to do it exactly

I've an event subscriber to enable that: would you suggest to add an SqliteSessionInit.php?

@Ocramius
Copy link
Member Author

Ocramius commented Sep 2, 2017

@Federkun yup 👍

@drhsqlite
Copy link

SQLite has a compile-time option to enable foreign_key enforcement by default. https://www.sqlite.org/compile.html#default_foreign_keys

The default build of SQLite has foreign_key enforcement turned off by default due to backwards-compatibility concerns.

@Ocramius
Copy link
Member Author

Ocramius commented Sep 13, 2017 via email

@DontShootMe
Copy link

Hello,
Just a little up about this functionality.

Have you found any good approach, because foreign keys are missing for ages ?

Many thanks all, for all your work
You are all amazing

@alexander-schranz
Copy link

I did stumble over #5404 and asking myself if FK is now supported via dbal?

@derrabus
Copy link
Member

derrabus commented Nov 2, 2022

Yes. I think, we can close this issue.

@derrabus derrabus closed this as completed Nov 2, 2022
@github-actions
Copy link

github-actions bot commented Dec 3, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants