mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v2] sqlite: config: enable foreign keys by default
@ 2020-07-16 17:29 Bruno Thomsen
  2020-08-04  7:23 ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Bruno Thomsen @ 2020-07-16 17:29 UTC (permalink / raw)
  To: ptxdist; +Cc: Bruno Thomsen, bth

Support for foreign_keys pragma is already enabled at compile
time. This allows turning on the feature by default on new
database connections.

Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
---
Changes since version 1:
- Make parameter a config option.

 rules/sqlite.in   | 8 ++++++++
 rules/sqlite.make | 1 +
 2 files changed, 9 insertions(+)

diff --git a/rules/sqlite.in b/rules/sqlite.in
index 7b60edf3e..e6e01ba97 100644
--- a/rules/sqlite.in
+++ b/rules/sqlite.in
@@ -30,6 +30,14 @@ config SQLITE_READLINE
 	help
 	  Enable readline support
 
+config SQLITE_FOREIGN_KEYS
+	bool
+	prompt "enable foreign keys by default"
+	help
+	  Enable foreign keys support by default on database
+	  connections. This ensures database schema constrains
+	  are enforced by default e.g. consistency between tables.
+
 comment "install options"
 
 config SQLITE_TOOL
diff --git a/rules/sqlite.make b/rules/sqlite.make
index b23c2d377..67a66a371 100644
--- a/rules/sqlite.make
+++ b/rules/sqlite.make
@@ -45,6 +45,7 @@ SQLITE_CONF_ENV := \
 	-DSQLITE_ENABLE_COLUMN_METADATA=1 \
 	-DSQLITE_ENABLE_FTS3_PARENTHESIS=1 \
 	-DSQLITE_ENABLE_UNLOCK_NOTIFY=1 \
+	-DSQLITE_DEFAULT_FOREIGN_KEYS=$(call ptx/ifdef, PTXCONF_SQLITE_FOREIGN_KEYS,1,0) \
 	-DSQLITE_SOUNDEX=1 \
 	"
 

base-commit: 9fe5462616de2ce93663f409f471ea83a6d5fbb5
-- 
2.26.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-04  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 17:29 [ptxdist] [PATCH v2] sqlite: config: enable foreign keys by default Bruno Thomsen
2020-08-04  7:23 ` [ptxdist] [APPLIED] " Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox