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

Foreign keys and SQLite #301

Closed
jkuchar opened this issue Jul 26, 2018 · 0 comments
Closed

Foreign keys and SQLite #301

jkuchar opened this issue Jul 26, 2018 · 0 comments

Comments

@jkuchar
Copy link
Contributor

jkuchar commented Jul 26, 2018

Version: master

Bug Description

I have been testing exception handling on PDO in #293 and I have found that SQLite does not check foreign keys by default.

Steps To Reproduce

Execute on test database (in tests/ directory)

INSERT INTO `orders` (`customer_id`, `product_id`, `amount`) VALUES (99999 /*non-existing*/, 1, 7)

Expected Behavior

Get ForeignKeyConstraintViolationException

Actual Behavior

It passes without exception

Possible Solution

Should be $connection->query('PRAGMA foreign_keys=true'); exucuted when SQLite connection is detected. Otherwise SQLite behave differently from other database backends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants