Skip to content

Commit 43e8b90

Browse files
committed
Raise default SQLite version for drift files
Related to #3632
1 parent bd427f5 commit 43e8b90

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎drift_dev/CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
- Fix generating code for `typedef`s with different parameters than the type they point to.
44
- Support `analyzer` version 8.x
5+
- When no other option is set, assume SQLite version 3.38.0 when analyzing drift files
6+
(used to be 3.31.0).
57

68
## 2.28.1
79

‎drift_dev/lib/src/analysis/options.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ part '../generated/analysis/options.g.dart';
1313
/// generator.
1414
@JsonSerializable()
1515
class DriftOptions {
16-
static const _defaultSqliteVersion = SqliteVersion.v3(34);
16+
static const _defaultSqliteVersion = SqliteVersion.v3(38);
1717

1818
/// Whether moor should generate a `fromJsonString` factory for data classes.
1919
/// It basically wraps the regular `fromJson` constructor in a `json.decode`

‎drift_dev/test/analysis/resolver/drift/sqlite_version_test.dart‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ const _content = {
88
'a|lib/main.drift': '''
99
CREATE TABLE foo (
1010
id INTEGER NOT NULL PRIMARY KEY,
11-
content TEXT NOT NULL UNIQUE,
12-
content2 TEXT NOT NULL UNIQUE
11+
content TEXT NOT NULL UNIQUE
1312
);
1413
15-
query: INSERT INTO foo VALUES (?, ?, ?)
16-
ON CONFLICT (content) DO NOTHING
17-
ON CONFLICT (content2) DO UPDATE SET content2 = 'duplicate';
14+
query: SELECT group_concat(content ORDER BY id) FROM foo;
1815
''',
1916
};
2017

@@ -28,7 +25,7 @@ void main() {
2825
[
2926
isDriftError(
3027
allOf(
31-
contains('require sqlite version 3.35 or later'),
28+
contains('require sqlite 3.44 or later'),
3229
contains(
3330
'You can change the assumed sqlite version with build options.'),
3431
),
@@ -42,7 +39,7 @@ void main() {
4239
_content,
4340
options: const DriftOptions.defaults(
4441
sqliteAnalysisOptions: SqliteAnalysisOptions(
45-
version: SqliteVersion.v3_35,
42+
version: SqliteVersion.v3_50,
4643
),
4744
),
4845
);

0 commit comments

Comments
 (0)