Skip to content

Commit 440d027

Browse files
authored
chore(cloud_auth,cloud_hub): Include @create queries in Drift schemas (#401)
Now that `drift_dev` outputs `@create` queries as part of the versioned schemas, we can use this to pin a database schema version to its cloud auth schema version.
1 parent ca80738 commit 440d027

File tree

19 files changed

+1283
-793
lines changed

19 files changed

+1283
-793
lines changed

services/celest_cloud_auth/build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ targets:
1212
options: &options
1313
databases:
1414
auth_database: lib/src/database/auth_database.dart
15+
test_database: test/database/wrapper/wrapper_database.dart
1516
schema_dir: drift_schema/
1617
test_dir: test/database/
1718

services/celest_cloud_auth/drift_schema/auth_database/drift_schema_v3.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

services/celest_cloud_auth/drift_schema/auth_database/drift_schema_v4.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

services/celest_cloud_auth/drift_schema/auth_database/drift_schema_v5.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

services/celest_cloud_auth/drift_schema/test_database/drift_schema_v1.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

services/celest_cloud_auth/drift_schema/test_database/drift_schema_v2.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

services/celest_cloud_auth/lib/src/database/auth_database.steps.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,8 @@ final class Schema3 extends i0.VersionedSchema {
10161016
celestFunctionsTriggerCreate,
10171017
celestFunctionsTriggerDelete,
10181018
celestCloudAuthMeta,
1019+
i1.OnCreateQuery(
1020+
'INSERT INTO _celest_cloud_auth_meta (schema_version) VALUES (3) ON CONFLICT DO NOTHING'),
10191021
cedarRelationshipsFkEntityIdx,
10201022
cedarRelationshipsFkParentIdx,
10211023
cedarPolicies,
@@ -1471,6 +1473,8 @@ final class Schema4 extends i0.VersionedSchema {
14711473
cloudAuthFunctionsCreateTrg,
14721474
cloudAuthFunctionsDeleteTrg,
14731475
cloudAuthMeta,
1476+
i1.OnCreateQuery(
1477+
'INSERT INTO cloud_auth_meta (schema_version) VALUES (4) ON CONFLICT DO NOTHING'),
14741478
cloudAuthCryptoKeys,
14751479
cloudAuthCryptoKeysExternalCryptoKeyIdIdx,
14761480
cloudAuthSessions,
@@ -1925,6 +1929,8 @@ final class Schema5 extends i0.VersionedSchema {
19251929
cloudAuthFunctionsCreateTrg,
19261930
cloudAuthFunctionsDeleteTrg,
19271931
cloudAuthMeta,
1932+
i1.OnCreateQuery(
1933+
'INSERT INTO cloud_auth_meta (schema_version) VALUES (5) ON CONFLICT DO NOTHING'),
19281934
cloudAuthCryptoKeys,
19291935
cloudAuthCryptoKeysExternalCryptoKeyIdIdx,
19301936
cloudAuthSessions,
@@ -2414,6 +2420,8 @@ final class Schema6 extends i0.VersionedSchema {
24142420
cloudAuthFunctionsCreateTrg,
24152421
cloudAuthFunctionsDeleteTrg,
24162422
cloudAuthMeta,
2423+
i1.OnCreateQuery(
2424+
'INSERT INTO cloud_auth_meta (schema_version) VALUES (6) ON CONFLICT DO NOTHING'),
24172425
cloudAuthCryptoKeys,
24182426
cloudAuthCryptoKeysExternalCryptoKeyIdIdx,
24192427
cloudAuthSessions,

services/celest_cloud_auth/test/database/auth_database/generated/schema_v3.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5280,6 +5280,8 @@ class DatabaseAtV3 extends GeneratedDatabase {
52805280
celestFunctionsTriggerCreate,
52815281
celestFunctionsTriggerDelete,
52825282
celestCloudAuthMeta,
5283+
OnCreateQuery(
5284+
'INSERT INTO _celest_cloud_auth_meta (schema_version) VALUES (3) ON CONFLICT DO NOTHING'),
52835285
cedarRelationshipsFkEntityIdx,
52845286
cedarRelationshipsFkParentIdx,
52855287
cedarPolicies,

services/celest_cloud_auth/test/database/auth_database/generated/schema_v4.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5312,6 +5312,8 @@ class DatabaseAtV4 extends GeneratedDatabase {
53125312
cloudAuthFunctionsCreateTrg,
53135313
cloudAuthFunctionsDeleteTrg,
53145314
cloudAuthMeta,
5315+
OnCreateQuery(
5316+
'INSERT INTO cloud_auth_meta (schema_version) VALUES (4) ON CONFLICT DO NOTHING'),
53155317
cloudAuthCryptoKeys,
53165318
cloudAuthCryptoKeysExternalCryptoKeyIdIdx,
53175319
cloudAuthSessions,

services/celest_cloud_auth/test/database/auth_database/generated/schema_v5.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5288,6 +5288,8 @@ class DatabaseAtV5 extends GeneratedDatabase {
52885288
cloudAuthFunctionsCreateTrg,
52895289
cloudAuthFunctionsDeleteTrg,
52905290
cloudAuthMeta,
5291+
OnCreateQuery(
5292+
'INSERT INTO cloud_auth_meta (schema_version) VALUES (5) ON CONFLICT DO NOTHING'),
52915293
cloudAuthCryptoKeys,
52925294
cloudAuthCryptoKeysExternalCryptoKeyIdIdx,
52935295
cloudAuthSessions,

0 commit comments

Comments
 (0)