diff --git a/docs/pages/docs/Advanced Features/builder_options.md b/docs/pages/docs/Advanced Features/builder_options.md
index 03ccac317..5b2a2d922 100644
--- a/docs/pages/docs/Advanced Features/builder_options.md
+++ b/docs/pages/docs/Advanced Features/builder_options.md
@@ -77,7 +77,7 @@ At the moment, drift supports these options:
* `new_sql_code_generation`: Generates SQL statements from the parsed AST instead of replacing substrings. This will also remove
unnecessary whitespace and comments.
If enabling this option breaks your queries, please file an issue!
-* `scoped_dart_components`: Generates a function parameter for [Dart placeholders]({{ '../Using SQL/moor_files.md#dart-components-in-sql' | pageUrl }}) in SQL.
+* `scoped_dart_components`: Generates a function parameter for [Dart placeholders]({{ '../Using SQL/drift_files.md#dart-components-in-sql' | pageUrl }}) in SQL.
The function has a parameter for each table that is available in the query, making it easier to get aliases right when using
Dart placeholders.
* `null_aware_type_converters`: Consider the type of applied type converters to determine nullability of columns in Dart.
diff --git a/docs/pages/docs/Getting started/starting_with_sql.md b/docs/pages/docs/Getting started/starting_with_sql.md
index 6a7a63021..4858307f2 100644
--- a/docs/pages/docs/Getting started/starting_with_sql.md
+++ b/docs/pages/docs/Getting started/starting_with_sql.md
@@ -149,7 +149,7 @@ Let's take a look at what drift generated during the build:
- a `Selectable todosInCategory(int)` method, which runs the
`todosInCategory` query declared above. Drift has determined that the
type of the variable in that query is `int`, because that's the type
- of the `category` column we're comparing it to.
+ of the `category` column we're comparing it to.
The method returns a `Selectable` to indicate that it can both be
used as a regular query (`Selectable.get` returns a `Future>`)
or as an auto-updating stream (by using `.watch` instead of `.get()`).
@@ -169,7 +169,7 @@ further guides to help you learn more:
- [Schema migrations]({{ "../Advanced Features/migrations.md" | pageUrl }})
- Writing [queries]({{ "writing_queries.md" | pageUrl }}) and
[expressions]({{ "../Advanced Features/expressions.md" | pageUrl }}) in Dart
-- A more [in-depth guide]({{ "../Using SQL/moor_files.md" | pageUrl }})
+- A more [in-depth guide]({{ "../Using SQL/drift_files.md" | pageUrl }})
on `drift` files, which explains `import` statements and the Dart-SQL interop.
{% block "blocks/alert" title="Using the database" %}
diff --git a/docs/pages/docs/Using SQL/custom_queries.md b/docs/pages/docs/Using SQL/custom_queries.md
index 846fea046..5d6cbf55f 100644
--- a/docs/pages/docs/Using SQL/custom_queries.md
+++ b/docs/pages/docs/Using SQL/custom_queries.md
@@ -47,11 +47,11 @@ To use this feature, it's helpful to know how Dart tables are named in sql. For
override `tableName`, the name in sql will be the `snake_case` of the class name. So a Dart table
called `Categories` will be named `categories`, a table called `UserAddressInformation` would be
called `user_address_information`. The same rule applies to column getters without an explicit name.
-Tables and columns declared in [Drift files]({{ "moor_files.md" | pageUrl }}) will always have the
+Tables and columns declared in [Drift files]({{ "drift_files.md" | pageUrl }}) will always have the
name you specified.
{% endblock %}
-You can also use `UPDATE` or `DELETE` statements here. Of course, this feature is also available for
+You can also use `UPDATE` or `DELETE` statements here. Of course, this feature is also available for
[daos]({{ "../Advanced Features/daos.md" | pageUrl }}),
and it perfectly integrates with auto-updating streams by analyzing what tables you're reading from or
writing to.
@@ -60,7 +60,7 @@ writing to.
If you don't want to use the statements with an generated api, you can
still send custom queries by calling `customSelect` for a one-time query or
`customSelectStream` for a query stream that automatically emits a new set of items when
-the underlying data changes. Using the todo example introduced in the
+the underlying data changes. Using the todo example introduced in the
[getting started guide]({{ "../Getting started/index.md" | pageUrl }}), we can
write this query which will load the amount of todo entries in each category:
```dart
@@ -90,7 +90,7 @@ Stream> categoriesWithCount() {
```
For custom selects, you should use the `readsFrom` parameter to specify from which tables the query is
reading. When using a `Stream`, drift will be able to know after which updates the stream should emit
-items.
+items.
You can also bind SQL variables by using question-mark placeholders and the `variables` parameter:
@@ -104,7 +104,7 @@ Stream amountOfTodosInCategory(int id) {
}
```
-Of course, you can also use indexed variables (like `?12`) - for more information on them, see
+Of course, you can also use indexed variables (like `?12`) - for more information on them, see
[the sqlite3 documentation](https://sqlite.org/lang_expr.html#varparam).
## Custom update statements
diff --git a/docs/pages/docs/Using SQL/moor_files.md b/docs/pages/docs/Using SQL/drift_files.md
similarity index 98%
rename from docs/pages/docs/Using SQL/moor_files.md
rename to docs/pages/docs/Using SQL/drift_files.md
index c9f90ac22..7a6ed7bb6 100644
--- a/docs/pages/docs/Using SQL/moor_files.md
+++ b/docs/pages/docs/Using SQL/drift_files.md
@@ -6,6 +6,8 @@ data:
aliases:
- /docs/using-sql/custom_tables/ # Redirect from outdated "custom tables" page which has been deleted
+ - /docs/using-sql/moor_files/
+
template: layouts/docs/single
---
@@ -174,27 +176,27 @@ CREATE TABLE saved_routes (
id INTEGER NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
"from" INTEGER NOT NULL REFERENCES coordinates (id),
- to INTEGER NOT NULL REFERENCES coordinates (id)
+ "to" INTEGER NOT NULL REFERENCES coordinates (id)
);
routesWithPoints: SELECT r.id, r.name, f.*, t.* FROM routes r
INNER JOIN coordinates f ON f.id = r."from"
- INNER JOIN coordinates t ON t.id = r.to;
+ INNER JOIN coordinates t ON t.id = r."to";
```
-To match the returned column names while avoiding name clashes in Dart, drift
+To match the returned column names while avoiding name clashes in Dart, drift
will generate a class having an `id`, `name`, `id1`, `lat`, `long`, `lat1` and
a `long1` field.
-Of course, that's not helpful at all - was `lat1` coming from `from` or `to`
+Of course, that's not helpful at all - was `lat1` coming from `from` or `to`
again? Let's rewrite the query, this time using nested results:
```sql
routesWithNestedPoints: SELECT r.id, r.name, f.**, t.** FROM routes r
INNER JOIN coordinates f ON f.id = r."from"
- INNER JOIN coordinates t ON t.id = r.to;
+ INNER JOIN coordinates t ON t.id = r."to";
```
-As you can see, we can nest a result simply by using the drift-specific
+As you can see, we can nest a result simply by using the drift-specific
`table.**` syntax.
For this query, drift will generate the following class:
```dart
@@ -207,7 +209,7 @@ class RoutesWithNestedPointsResult {
}
```
-Great! This class matches our intent much better than the flat result class
+Great! This class matches our intent much better than the flat result class
from before.
At the moment, there are some limitations with this approach:
diff --git a/docs/pages/v2.html b/docs/pages/v2.html
index 22f04e286..7278c3fe4 100644
--- a/docs/pages/v2.html
+++ b/docs/pages/v2.html
@@ -25,7 +25,7 @@
The rewritten compiler is faster than ever, supports more SQL features and gives you
more flexibility when writing database code.
-[Check the updated documentation]({{ "docs/Using SQL/moor_files.md" | pageUrl }})
+[Check the updated documentation]({{ "docs/Using SQL/drift_files.md" | pageUrl }})
{% endblock %}
{% endblock %}
diff --git a/docs/tool/ci_check.dart b/docs/tool/ci_check.dart
index 00d81a5ce..5144ac503 100644
--- a/docs/tool/ci_check.dart
+++ b/docs/tool/ci_check.dart
@@ -21,7 +21,9 @@ Future main() async {
Uri.parse('http://localhost:8080/api/')
],
{'http://localhost:8080/**'},
- true,
+ // todo: Re-enable. Current problem is that we link new pages to their
+ // final url (under drift.simonbinder.eu) before they're deployed.
+ false,
UrlSkipper(
'', ['github.com', 'pub.dev', 'api.dart.dev', 'fonts.gstatic.com']),
false,
@@ -36,7 +38,8 @@ Future main() async {
var hasBrokenLinks = false;
for (final result in results.destinations) {
- if (result.isBroken) {
+ // todo: Remove !result.isExternal after external links work again
+ if (result.isBroken && !result.isExternal) {
print('Broken: $result (${result.toMap()})');
hasBrokenLinks = true;
}
diff --git a/drift/CHANGELOG.md b/drift/CHANGELOG.md
index 69d31df91..7e21c232d 100644
--- a/drift/CHANGELOG.md
+++ b/drift/CHANGELOG.md
@@ -1,3 +1,13 @@
+## 1.3.0
+
+- Add the `from(table)` method to generated databases. It can be used to write
+ common queries more concisely.
+- Make `groupConcat` nullable in the Dart API.
+- Throw an exception in a `NativeDatabase` when multiple statements are run in
+ a single call. In previous versions, parts of the SQL string would otherwise
+ be ignored.
+- Close the underlying database when a drift isolate is shut down.
+
## 1.2.0
- Properly support stream update queries on views.
diff --git a/drift/README.md b/drift/README.md
index 3804d1be0..c49bedf47 100644
--- a/drift/README.md
+++ b/drift/README.md
@@ -1,14 +1,14 @@
# Drift
-## Proudly Sponsored by [Stream 💙](https://getstream.io/chat/flutter/tutorial/?utm_source=https://github.com/simolus3/moor&utm_medium=github&utm_content=developer&utm_term=flutter)
+## Proudly Sponsored by [Stream 💙](https://getstream.io/chat/flutter/tutorial/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_FlutterChat&utm_term=moor)