From c57107f014baf767b7322b334ea312e54ddc62ee Mon Sep 17 00:00:00 2001 From: harshyadavDeveloper Date: Sat, 25 Apr 2026 15:33:59 +0530 Subject: [PATCH 1/6] docs: add example of SQLite table relationships --- src/content/cookbook/persistence/sqlite.md | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/content/cookbook/persistence/sqlite.md b/src/content/cookbook/persistence/sqlite.md index 70c6e62417f..015c2e4f4df 100644 --- a/src/content/cookbook/persistence/sqlite.md +++ b/src/content/cookbook/persistence/sqlite.md @@ -465,6 +465,32 @@ class Dog { } ``` +## Using relationships between tables + +> This is a more advanced use case and not required for basic usage. + +In real-world applications, you often need to model relationships between tables. + +For example, instead of storing all data in a single table, you can separate related data into multiple tables and connect them using foreign keys. + +```sql +CREATE TABLE breeds( + id INTEGER PRIMARY KEY, + name TEXT +); + +CREATE TABLE dogs( + id INTEGER PRIMARY KEY, + name TEXT, + age INTEGER, + breed_id INTEGER, + FOREIGN KEY (breed_id) REFERENCES breeds(id) +); +``` + +In this example, each dog is associated with a breed using the `breed_id` field. This allows you to organize data more efficiently and avoid duplication. + + [`delete()`]: {{site.pub-api}}/sqflite_common/latest/sqlite_api/DatabaseExecutor/delete.html [`insert()`]: {{site.pub-api}}/sqflite_common/latest/sqlite_api/DatabaseExecutor/insert.html From 7c4a03f8e05be1cacc6d08d4ba667142bddba011 Mon Sep 17 00:00:00 2001 From: harshyadavDeveloper Date: Sat, 25 Apr 2026 15:43:41 +0530 Subject: [PATCH 2/6] chore: trigger CLA check From 65dca21a08761256d01a76678f721cd041349365 Mon Sep 17 00:00:00 2001 From: harshyadavDeveloper Date: Sat, 25 Apr 2026 15:54:13 +0530 Subject: [PATCH 3/6] docs: fix formatting and improve SQLite relationships section --- src/content/cookbook/persistence/sqlite.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/cookbook/persistence/sqlite.md b/src/content/cookbook/persistence/sqlite.md index 015c2e4f4df..54f7ffab700 100644 --- a/src/content/cookbook/persistence/sqlite.md +++ b/src/content/cookbook/persistence/sqlite.md @@ -465,7 +465,7 @@ class Dog { } ``` -## Using relationships between tables +## Use relationships between tables > This is a more advanced use case and not required for basic usage. @@ -479,6 +479,8 @@ CREATE TABLE breeds( name TEXT ); +You can execute these statements using the `db.execute()` method from the `sqflite` package. + CREATE TABLE dogs( id INTEGER PRIMARY KEY, name TEXT, From 08dd7b8af33b1aedc9963fc65c18f43f8510df5e Mon Sep 17 00:00:00 2001 From: Shams Zakhour <44418985+sfshaza2@users.noreply.github.com> Date: Sun, 26 Apr 2026 21:17:32 -0700 Subject: [PATCH 4/6] Update src/content/cookbook/persistence/sqlite.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- src/content/cookbook/persistence/sqlite.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/cookbook/persistence/sqlite.md b/src/content/cookbook/persistence/sqlite.md index 54f7ffab700..e0c46c038f0 100644 --- a/src/content/cookbook/persistence/sqlite.md +++ b/src/content/cookbook/persistence/sqlite.md @@ -467,7 +467,9 @@ class Dog { ## Use relationships between tables -> This is a more advanced use case and not required for basic usage. +:::note +This is a more advanced use case and not required for basic usage. +::: In real-world applications, you often need to model relationships between tables. From 0c4ead4e5cb55cc39cf0cdf0db24dbf50e45ba73 Mon Sep 17 00:00:00 2001 From: Shams Zakhour <44418985+sfshaza2@users.noreply.github.com> Date: Sun, 26 Apr 2026 21:18:26 -0700 Subject: [PATCH 5/6] Update src/content/cookbook/persistence/sqlite.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- src/content/cookbook/persistence/sqlite.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/cookbook/persistence/sqlite.md b/src/content/cookbook/persistence/sqlite.md index e0c46c038f0..3136ba6d4b1 100644 --- a/src/content/cookbook/persistence/sqlite.md +++ b/src/content/cookbook/persistence/sqlite.md @@ -473,7 +473,8 @@ This is a more advanced use case and not required for basic usage. In real-world applications, you often need to model relationships between tables. -For example, instead of storing all data in a single table, you can separate related data into multiple tables and connect them using foreign keys. +For example, instead of storing all data in a single table, you can separate +related data into multiple tables and connect them using foreign keys. ```sql CREATE TABLE breeds( From 8040b0a22bc16e39be1ff5095667f071a4ff5e6f Mon Sep 17 00:00:00 2001 From: Shams Zakhour <44418985+sfshaza2@users.noreply.github.com> Date: Sun, 26 Apr 2026 21:18:53 -0700 Subject: [PATCH 6/6] Update src/content/cookbook/persistence/sqlite.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- src/content/cookbook/persistence/sqlite.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/cookbook/persistence/sqlite.md b/src/content/cookbook/persistence/sqlite.md index 3136ba6d4b1..1511c431fe9 100644 --- a/src/content/cookbook/persistence/sqlite.md +++ b/src/content/cookbook/persistence/sqlite.md @@ -493,7 +493,8 @@ CREATE TABLE dogs( ); ``` -In this example, each dog is associated with a breed using the `breed_id` field. This allows you to organize data more efficiently and avoid duplication. +In this example, each dog is associated with a breed using the `breed_id` field. +This allows you to organize data more efficiently and avoid duplication.