Skip to content

Commit 00028bb

Browse files
committed
chore(repo): Update drift dependency
- Updates drift constraint to `>=2.26.0 <2.27.0` throughout repo - Regenerates code - Updates `build.yaml` configurations throughout for consistency
1 parent 4e659aa commit 00028bb

File tree

24 files changed

+2038
-2087
lines changed

24 files changed

+2038
-2087
lines changed

apps/cli/build.yaml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,37 @@ targets:
33
sources:
44
exclude:
55
- "fixtures/**"
6-
- "lib/database/**"
7-
auto_apply_builders: false
6+
- "lib/src/database/**"
87
builders:
8+
drift_dev:
9+
enabled: false
10+
911
json_serializable:
1012
enabled: true
1113
options:
1214
explicit_to_json: true
1315

14-
$default:
16+
drift:
1517
sources:
1618
include:
17-
- "lib/database/**"
19+
- "lib/src/database/**"
1820
dependencies:
19-
- ":json"
21+
- :json
2022
builders:
23+
json_serializable:
24+
enabled: false
25+
2126
drift_dev:
27+
# disable drift's default builder, we're using the modular setup
28+
# instead.
29+
enabled: false
30+
31+
# Instead, enable drift_dev:analyzer and drift_dev:modular manually:
32+
drift_dev:analyzer:
2233
enabled: true
23-
options:
24-
named_parameters: true
25-
store_date_time_values_as_text: false
34+
generate_for:
35+
- "lib/src/database/**"
36+
options: &options
2637
sql:
2738
dialect: sqlite
2839
options:
@@ -31,7 +42,23 @@ targets:
3142
- json1
3243
known_functions:
3344
typeid: text(text)
45+
46+
named_parameters: true
47+
store_date_time_values_as_text: false
3448

3549
# Reduces generated code
3650
skip_verification_code: true
3751
data_class_to_companions: false
52+
53+
drift_dev:modular:
54+
enabled: true
55+
generate_for:
56+
- "lib/src/database/**"
57+
# We use yaml anchors to give the two builders the same options
58+
options: *options
59+
60+
$default:
61+
auto_apply_builders: false
62+
dependencies:
63+
- :drift
64+
- :json

apps/cli/fixtures/standalone/data/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88
celest: ^1.0.0
99
celest_cloud_auth: 'any'
1010
celest_core: ^1.0.0
11-
drift: '>=2.25.0 <2.26.0'
11+
drift: '>=2.26.0 <2.27.0'
1212
drift_hrana: ^1.0.2
1313
meta: ^1.12.0
1414

@@ -28,6 +28,6 @@ dependency_overrides:
2828

2929
dev_dependencies:
3030
build_runner: ^2.4.13
31-
drift_dev: '>=2.25.0 <2.26.0'
31+
drift_dev: '>=2.26.0 <2.27.0'
3232
lints: ^5.0.0
3333
test: ^1.25.0

apps/cli/lib/src/analyzer/resolver/config_value_resolver.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:analyzer/dart/element/element.dart';
88
import 'package:celest_ast/celest_ast.dart' as ast;
99
import 'package:celest_cli/src/analyzer/resolver/project_resolver.dart';
1010
import 'package:celest_cli/src/context.dart';
11+
import 'package:celest_cli/src/database/project/project.drift.dart';
1112
import 'package:celest_cli/src/database/project/project_database.dart';
1213
import 'package:celest_cli/src/utils/analyzer.dart';
1314
import 'package:celest_cli/src/utils/run.dart';
@@ -258,13 +259,14 @@ extension WithEnvironment on ProjectDatabase {
258259
required String environmentId,
259260
}) {
260261
return transaction(() async {
261-
if (await lookupEnvironment(id: environmentId).get()
262+
if (await projectDrift.lookupEnvironment(id: environmentId).get()
262263
case [
263264
final environment,
264265
]) {
265266
return withEnv(environment);
266267
}
267-
final [environment] = await createEnvironment(id: environmentId);
268+
final [environment] =
269+
await projectDrift.createEnvironment(id: environmentId);
268270
return withEnv(environment);
269271
});
270272
}
@@ -278,15 +280,15 @@ extension ResolveConfigurationVariable on ast.ConfigurationVariable {
278280
) async {
279281
switch (this) {
280282
case ast.Variable(:final name):
281-
final value = await db
283+
final value = await db.projectDrift
282284
.getEnvironmentVariable(
283285
environmentId: environment.id,
284286
name: name,
285287
)
286288
.get();
287289
return value.singleOrNull;
288290
case ast.Secret(:final name):
289-
final value = await db
291+
final value = await db.projectDrift
290292
.getSecret(environmentId: environment.id, name: name)
291293
.get();
292294
final ref = value.singleOrNull;
@@ -316,7 +318,7 @@ extension ResolveConfigurationVariables<T extends ast.ConfigurationVariable>
316318
final values = <String, String>{};
317319
switch (first) {
318320
case ast.Variable():
319-
final dbValues = await db
321+
final dbValues = await db.projectDrift
320322
.getEnvironmentVariables(
321323
environmentId: environment.id,
322324
names: variableNames,
@@ -326,7 +328,7 @@ extension ResolveConfigurationVariables<T extends ast.ConfigurationVariable>
326328
values[value.name] = value.value;
327329
}
328330
case ast.Secret():
329-
final dbValues = await db
331+
final dbValues = await db.projectDrift
330332
.getSecrets(
331333
environmentId: environment.id,
332334
names: variableNames,

0 commit comments

Comments
 (0)