summaryrefslogtreecommitdiff
path: root/ironic/db
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2021-12-09 15:14:26 +0100
committerDmitry Tantsur <dtantsur@protonmail.com>2021-12-15 14:58:53 +0100
commit4b93ecd5dbf0b1d8ce09f1c44053af3d62929012 (patch)
tree4d31434fa956d993db48b7f659608f46db8aff80 /ironic/db
parentab6ee8b656e98c375a84ba08a6c3022779ced8f4 (diff)
downloadironic-4b93ecd5dbf0b1d8ce09f1c44053af3d62929012.tar.gz
Enable foreign keys in SQLite
For backward compatibility reasons, they're off by default. Fix all unit tests that rely on dangling foreign keys. Change-Id: I54a45fab1aefc03b2252c655e14b375dea3d9f12
Diffstat (limited to 'ironic/db')
-rw-r--r--ironic/db/sqlalchemy/__init__.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ironic/db/sqlalchemy/__init__.py b/ironic/db/sqlalchemy/__init__.py
index e69de29bb..0f792361a 100644
--- a/ironic/db/sqlalchemy/__init__.py
+++ b/ironic/db/sqlalchemy/__init__.py
@@ -0,0 +1,16 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo_db.sqlalchemy import enginefacade
+
+# NOTE(dtantsur): we want sqlite as close to a real database as possible.
+enginefacade.configure(sqlite_fk=True)