diff --git a/lib/core/bridge/callbacks.dart b/lib/core/bridge/callbacks.dart index 07db35a4..b0948ced 100644 --- a/lib/core/bridge/callbacks.dart +++ b/lib/core/bridge/callbacks.dart @@ -21,7 +21,7 @@ Future initFlutterCallbacks({ required FutureOr Function(PlatformInt64) userDiscoveryGetShareForContact, required FutureOr Function(PlatformInt64, PlatformInt64, Uint8List) - userDiscoveryPushOwnPromotion, + userDiscoveryPushOwnPromotionAndClearOldVersion, required FutureOr?> Function(PlatformInt64) userDiscoveryGetOwnPromotionsAfterVersion, required FutureOr Function(OtherPromotion) @@ -43,7 +43,8 @@ Future initFlutterCallbacks({ userDiscoveryVerifyStoredPubkey: userDiscoveryVerifyStoredPubkey, userDiscoverySetShares: userDiscoverySetShares, userDiscoveryGetShareForContact: userDiscoveryGetShareForContact, - userDiscoveryPushOwnPromotion: userDiscoveryPushOwnPromotion, + userDiscoveryPushOwnPromotionAndClearOldVersion: + userDiscoveryPushOwnPromotionAndClearOldVersion, userDiscoveryGetOwnPromotionsAfterVersion: userDiscoveryGetOwnPromotionsAfterVersion, userDiscoveryStoreOtherPromotion: userDiscoveryStoreOtherPromotion, diff --git a/lib/core/frb_generated.dart b/lib/core/frb_generated.dart index 5aba56c1..deec8bfb 100644 --- a/lib/core/frb_generated.dart +++ b/lib/core/frb_generated.dart @@ -121,7 +121,7 @@ abstract class RustLibApi extends BaseApi { required FutureOr Function(PlatformInt64) userDiscoveryGetShareForContact, required FutureOr Function(PlatformInt64, PlatformInt64, Uint8List) - userDiscoveryPushOwnPromotion, + userDiscoveryPushOwnPromotionAndClearOldVersion, required FutureOr?> Function(PlatformInt64) userDiscoveryGetOwnPromotionsAfterVersion, required FutureOr Function(OtherPromotion) @@ -354,7 +354,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { required FutureOr Function(PlatformInt64) userDiscoveryGetShareForContact, required FutureOr Function(PlatformInt64, PlatformInt64, Uint8List) - userDiscoveryPushOwnPromotion, + userDiscoveryPushOwnPromotionAndClearOldVersion, required FutureOr?> Function(PlatformInt64) userDiscoveryGetOwnPromotionsAfterVersion, required FutureOr Function(OtherPromotion) @@ -403,7 +403,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer, ); sse_encode_DartFn_Inputs_i_64_i_64_list_prim_u_8_strict_Output_bool_AnyhowException( - userDiscoveryPushOwnPromotion, + userDiscoveryPushOwnPromotionAndClearOldVersion, serializer, ); sse_encode_DartFn_Inputs_i_64_Output_opt_list_list_prim_u_8_strict_AnyhowException( @@ -453,7 +453,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { userDiscoveryVerifyStoredPubkey, userDiscoverySetShares, userDiscoveryGetShareForContact, - userDiscoveryPushOwnPromotion, + userDiscoveryPushOwnPromotionAndClearOldVersion, userDiscoveryGetOwnPromotionsAfterVersion, userDiscoveryStoreOtherPromotion, userDiscoveryGetOtherPromotionsByPublicId, @@ -477,7 +477,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { "userDiscoveryVerifyStoredPubkey", "userDiscoverySetShares", "userDiscoveryGetShareForContact", - "userDiscoveryPushOwnPromotion", + "userDiscoveryPushOwnPromotionAndClearOldVersion", "userDiscoveryGetOwnPromotionsAfterVersion", "userDiscoveryStoreOtherPromotion", "userDiscoveryGetOtherPromotionsByPublicId", diff --git a/lib/src/callbacks/callbacks.dart b/lib/src/callbacks/callbacks.dart index ae062921..9e62fcd0 100644 --- a/lib/src/callbacks/callbacks.dart +++ b/lib/src/callbacks/callbacks.dart @@ -8,7 +8,8 @@ Future initFlutterCallbacksForRust() async { userDiscoverySetShares: UserDiscoveryCallbacks.setShares, userDiscoveryGetShareForContact: UserDiscoveryCallbacks.userDiscoveryGetShareForContact, - userDiscoveryPushOwnPromotion: UserDiscoveryCallbacks.pushOwnPromotion, + userDiscoveryPushOwnPromotionAndClearOldVersion: + UserDiscoveryCallbacks.userDiscoveryPushOwnPromotionAndClearOldVersion, userDiscoveryPushNewUserRelation: UserDiscoveryCallbacks.pushNewUserRelation, userDiscoveryGetOwnPromotionsAfterVersion: diff --git a/lib/src/callbacks/user_discovery.callbacks.dart b/lib/src/callbacks/user_discovery.callbacks.dart index 0f827100..fe435104 100644 --- a/lib/src/callbacks/user_discovery.callbacks.dart +++ b/lib/src/callbacks/user_discovery.callbacks.dart @@ -110,12 +110,18 @@ class UserDiscoveryCallbacks { }); } - static Future pushOwnPromotion( + static Future userDiscoveryPushOwnPromotionAndClearOldVersion( int contactId, - int version, // Maps to versionId or logic control + int version, Uint8List promotion, ) async { try { + // Old promotions from this users should be removed... + await (twonlyDB.update( + twonlyDB.userDiscoveryOwnPromotions, + )..where((t) => t.contactId.equals(contactId))).write( + UserDiscoveryOwnPromotionsCompanion(promotion: Value(Uint8List(0))), + ); await twonlyDB .into(twonlyDB.userDiscoveryOwnPromotions) .insert( diff --git a/lib/src/database/schemas/twonly_db/drift_schema_v12.json b/lib/src/database/schemas/twonly_db/drift_schema_v12.json index 8a5c1609..4aaa9cf4 100644 --- a/lib/src/database/schemas/twonly_db/drift_schema_v12.json +++ b/lib/src/database/schemas/twonly_db/drift_schema_v12.json @@ -178,6 +178,40 @@ "default_dart": null, "default_client_dart": null, "dsl_features": [] + }, + { + "name": "user_discovery_excluded", + "getter_name": "userDiscoveryExcluded", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"user_discovery_excluded\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"user_discovery_excluded\" IN (0, 1))" + }, + "default_dart": "const CustomExpression('0')", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "media_send_counter", + "getter_name": "mediaSendCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const CustomExpression('0')", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "media_received_counter", + "getter_name": "mediaReceivedCounter", + "moor_type": "int", + "nullable": false, + "customConstraints": null, + "default_dart": "const CustomExpression('0')", + "default_client_dart": null, + "dsl_features": [] } ], "is_virtual": false, @@ -2126,6 +2160,44 @@ "dsl_features": [ "unique" ] + }, + { + "name": "username", + "getter_name": "username", + "moor_type": "string", + "nullable": true, + "customConstraints": null, + "default_dart": null, + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "was_shown_to_the_user", + "getter_name": "wasShownToTheUser", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"was_shown_to_the_user\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"was_shown_to_the_user\" IN (0, 1))" + }, + "default_dart": "const CustomExpression('0')", + "default_client_dart": null, + "dsl_features": [] + }, + { + "name": "is_hidden", + "getter_name": "isHidden", + "moor_type": "bool", + "nullable": false, + "customConstraints": null, + "defaultConstraints": "CHECK (\"is_hidden\" IN (0, 1))", + "dialectAwareDefaultConstraints": { + "sqlite": "CHECK (\"is_hidden\" IN (0, 1))" + }, + "default_dart": "const CustomExpression('0')", + "default_client_dart": null, + "dsl_features": [] } ], "is_virtual": false, @@ -2311,7 +2383,7 @@ "constraints": [], "explicit_pk": [ "from_contact_id", - "promotion_id" + "public_id" ] } }, @@ -2458,7 +2530,7 @@ "sql": [ { "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"contacts\" (\"user_id\" INTEGER NOT NULL, \"username\" TEXT NOT NULL, \"display_name\" TEXT NULL, \"nick_name\" TEXT NULL, \"avatar_svg_compressed\" BLOB NULL, \"sender_profile_counter\" INTEGER NOT NULL DEFAULT 0, \"accepted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"accepted\" IN (0, 1)), \"deleted_by_user\" INTEGER NOT NULL DEFAULT 0 CHECK (\"deleted_by_user\" IN (0, 1)), \"requested\" INTEGER NOT NULL DEFAULT 0 CHECK (\"requested\" IN (0, 1)), \"blocked\" INTEGER NOT NULL DEFAULT 0 CHECK (\"blocked\" IN (0, 1)), \"verified\" INTEGER NOT NULL DEFAULT 0 CHECK (\"verified\" IN (0, 1)), \"account_deleted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"account_deleted\" IN (0, 1)), \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"user_discovery_version\" BLOB NULL, PRIMARY KEY (\"user_id\"));" + "sql": "CREATE TABLE IF NOT EXISTS \"contacts\" (\"user_id\" INTEGER NOT NULL, \"username\" TEXT NOT NULL, \"display_name\" TEXT NULL, \"nick_name\" TEXT NULL, \"avatar_svg_compressed\" BLOB NULL, \"sender_profile_counter\" INTEGER NOT NULL DEFAULT 0, \"accepted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"accepted\" IN (0, 1)), \"deleted_by_user\" INTEGER NOT NULL DEFAULT 0 CHECK (\"deleted_by_user\" IN (0, 1)), \"requested\" INTEGER NOT NULL DEFAULT 0 CHECK (\"requested\" IN (0, 1)), \"blocked\" INTEGER NOT NULL DEFAULT 0 CHECK (\"blocked\" IN (0, 1)), \"verified\" INTEGER NOT NULL DEFAULT 0 CHECK (\"verified\" IN (0, 1)), \"account_deleted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"account_deleted\" IN (0, 1)), \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"user_discovery_version\" BLOB NULL, \"user_discovery_excluded\" INTEGER NOT NULL DEFAULT 0 CHECK (\"user_discovery_excluded\" IN (0, 1)), \"media_send_counter\" INTEGER NOT NULL DEFAULT 0, \"media_received_counter\" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (\"user_id\"));" } ] }, @@ -2611,7 +2683,7 @@ "sql": [ { "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_announced_users\" (\"announced_user_id\" INTEGER NOT NULL, \"announced_public_key\" BLOB NOT NULL, \"public_id\" INTEGER NOT NULL UNIQUE, PRIMARY KEY (\"announced_user_id\"));" + "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_announced_users\" (\"announced_user_id\" INTEGER NOT NULL, \"announced_public_key\" BLOB NOT NULL, \"public_id\" INTEGER NOT NULL UNIQUE, \"username\" TEXT NULL, \"was_shown_to_the_user\" INTEGER NOT NULL DEFAULT 0 CHECK (\"was_shown_to_the_user\" IN (0, 1)), \"is_hidden\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_hidden\" IN (0, 1)), PRIMARY KEY (\"announced_user_id\"));" } ] }, @@ -2629,7 +2701,7 @@ "sql": [ { "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_other_promotions\" (\"from_contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"promotion_id\" INTEGER NOT NULL, \"public_id\" INTEGER NOT NULL, \"threshold\" INTEGER NOT NULL, \"announcement_share\" BLOB NOT NULL, \"public_key_verified_timestamp\" INTEGER NULL, PRIMARY KEY (\"from_contact_id\", \"promotion_id\"));" + "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_other_promotions\" (\"from_contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"promotion_id\" INTEGER NOT NULL, \"public_id\" INTEGER NOT NULL, \"threshold\" INTEGER NOT NULL, \"announcement_share\" BLOB NOT NULL, \"public_key_verified_timestamp\" INTEGER NULL, PRIMARY KEY (\"from_contact_id\", \"public_id\"));" } ] }, diff --git a/lib/src/database/schemas/twonly_db/drift_schema_v13.json b/lib/src/database/schemas/twonly_db/drift_schema_v13.json deleted file mode 100644 index b9e1f48b..00000000 --- a/lib/src/database/schemas/twonly_db/drift_schema_v13.json +++ /dev/null @@ -1,2675 +0,0 @@ -{ - "_meta": { - "description": "This file contains a serialized version of schema entities for drift.", - "version": "1.3.0" - }, - "options": { - "store_date_time_values_as_text": false - }, - "entities": [ - { - "id": 0, - "references": [], - "type": "table", - "data": { - "name": "contacts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "user_id", - "getter_name": "userId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "username", - "getter_name": "username", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "display_name", - "getter_name": "displayName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "nick_name", - "getter_name": "nickName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "avatar_svg_compressed", - "getter_name": "avatarSvgCompressed", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_profile_counter", - "getter_name": "senderProfileCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "accepted", - "getter_name": "accepted", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"accepted\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"accepted\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "deleted_by_user", - "getter_name": "deletedByUser", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"deleted_by_user\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"deleted_by_user\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "requested", - "getter_name": "requested", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"requested\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"requested\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "blocked", - "getter_name": "blocked", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"blocked\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"blocked\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "verified", - "getter_name": "verified", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"verified\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"verified\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "account_deleted", - "getter_name": "accountDeleted", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"account_deleted\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"account_deleted\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "user_discovery_version", - "getter_name": "userDiscoveryVersion", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_send_counter", - "getter_name": "mediaSendCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_received_counter", - "getter_name": "mediaReceivedCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "user_id" - ] - } - }, - { - "id": 1, - "references": [], - "type": "table", - "data": { - "name": "groups", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_group_admin", - "getter_name": "isGroupAdmin", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_group_admin\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_group_admin\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_direct_chat", - "getter_name": "isDirectChat", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_direct_chat\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_direct_chat\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pinned", - "getter_name": "pinned", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"pinned\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"pinned\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "archived", - "getter_name": "archived", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"archived\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"archived\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "joined_group", - "getter_name": "joinedGroup", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"joined_group\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"joined_group\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "left_group", - "getter_name": "leftGroup", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"left_group\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"left_group\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "deleted_content", - "getter_name": "deletedContent", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"deleted_content\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"deleted_content\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "state_version_id", - "getter_name": "stateVersionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "state_encryption_key", - "getter_name": "stateEncryptionKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "my_group_private_key", - "getter_name": "myGroupPrivateKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "group_name", - "getter_name": "groupName", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "draft_message", - "getter_name": "draftMessage", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "total_media_counter", - "getter_name": "totalMediaCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "also_best_friend", - "getter_name": "alsoBestFriend", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"also_best_friend\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"also_best_friend\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "delete_messages_after_milliseconds", - "getter_name": "deleteMessagesAfterMilliseconds", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('86400000')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_send", - "getter_name": "lastMessageSend", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_received", - "getter_name": "lastMessageReceived", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_flame_counter_change", - "getter_name": "lastFlameCounterChange", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_flame_sync", - "getter_name": "lastFlameSync", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "flame_counter", - "getter_name": "flameCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "max_flame_counter", - "getter_name": "maxFlameCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "max_flame_counter_from", - "getter_name": "maxFlameCounterFrom", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_exchange", - "getter_name": "lastMessageExchange", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_id" - ] - } - }, - { - "id": 2, - "references": [], - "type": "table", - "data": { - "name": "media_files", - "was_declared_in_moor": false, - "columns": [ - { - "name": "media_id", - "getter_name": "mediaId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MediaType.values)", - "dart_type_name": "MediaType" - } - }, - { - "name": "upload_state", - "getter_name": "uploadState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(UploadState.values)", - "dart_type_name": "UploadState" - } - }, - { - "name": "download_state", - "getter_name": "downloadState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(DownloadState.values)", - "dart_type_name": "DownloadState" - } - }, - { - "name": "requires_authentication", - "getter_name": "requiresAuthentication", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"requires_authentication\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"requires_authentication\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "stored", - "getter_name": "stored", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"stored\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"stored\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_draft_media", - "getter_name": "isDraftMedia", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_draft_media\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_draft_media\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pre_progressing_process", - "getter_name": "preProgressingProcess", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "reupload_requested_by", - "getter_name": "reuploadRequestedBy", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "IntListTypeConverter()", - "dart_type_name": "List" - } - }, - { - "name": "display_limit_in_milliseconds", - "getter_name": "displayLimitInMilliseconds", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "remove_audio", - "getter_name": "removeAudio", - "moor_type": "bool", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "CHECK (\"remove_audio\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"remove_audio\" IN (0, 1))" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "download_token", - "getter_name": "downloadToken", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_key", - "getter_name": "encryptionKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_mac", - "getter_name": "encryptionMac", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_nonce", - "getter_name": "encryptionNonce", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "stored_file_hash", - "getter_name": "storedFileHash", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "media_id" - ] - } - }, - { - "id": 3, - "references": [ - 1, - 0, - 2 - ], - "type": "table", - "data": { - "name": "messages", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_id", - "getter_name": "senderId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "content", - "getter_name": "content", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_id", - "getter_name": "mediaId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES media_files (media_id) ON DELETE SET NULL", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES media_files (media_id) ON DELETE SET NULL" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "media_files", - "column": "media_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "setNull" - } - } - ] - }, - { - "name": "additional_message_data", - "getter_name": "additionalMessageData", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_stored", - "getter_name": "mediaStored", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"media_stored\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"media_stored\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_reopened", - "getter_name": "mediaReopened", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"media_reopened\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"media_reopened\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "download_token", - "getter_name": "downloadToken", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "quotes_message_id", - "getter_name": "quotesMessageId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_deleted_from_sender", - "getter_name": "isDeletedFromSender", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_deleted_from_sender\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_deleted_from_sender\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "opened_at", - "getter_name": "openedAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "opened_by_all", - "getter_name": "openedByAll", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "modified_at", - "getter_name": "modifiedAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_user", - "getter_name": "ackByUser", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_server", - "getter_name": "ackByServer", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id" - ] - } - }, - { - "id": 4, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "message_histories", - "was_declared_in_moor": false, - "columns": [ - { - "name": "id", - "getter_name": "id", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "content", - "getter_name": "content", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 5, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "reactions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "emoji", - "getter_name": "emoji", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_id", - "getter_name": "senderId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id", - "sender_id", - "emoji" - ] - } - }, - { - "id": 6, - "references": [ - 1, - 0 - ], - "type": "table", - "data": { - "name": "group_members", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "member_state", - "getter_name": "memberState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MemberState.values)", - "dart_type_name": "MemberState" - } - }, - { - "name": "group_public_key", - "getter_name": "groupPublicKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_chat_opened", - "getter_name": "lastChatOpened", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_type_indicator", - "getter_name": "lastTypeIndicator", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message", - "getter_name": "lastMessage", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_id", - "contact_id" - ] - } - }, - { - "id": 7, - "references": [ - 0, - 3 - ], - "type": "table", - "data": { - "name": "receipts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "receipt_id", - "getter_name": "receiptId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message", - "getter_name": "message", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_will_sends_receipt", - "getter_name": "contactWillSendsReceipt", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"contact_will_sends_receipt\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"contact_will_sends_receipt\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('1')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "will_be_retried_by_media_upload", - "getter_name": "willBeRetriedByMediaUpload", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"will_be_retried_by_media_upload\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"will_be_retried_by_media_upload\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "mark_for_retry", - "getter_name": "markForRetry", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "mark_for_retry_after_accepted", - "getter_name": "markForRetryAfterAccepted", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_server_at", - "getter_name": "ackByServerAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "retry_count", - "getter_name": "retryCount", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_retry", - "getter_name": "lastRetry", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "receipt_id" - ] - } - }, - { - "id": 8, - "references": [], - "type": "table", - "data": { - "name": "received_receipts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "receipt_id", - "getter_name": "receiptId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "receipt_id" - ] - } - }, - { - "id": 9, - "references": [], - "type": "table", - "data": { - "name": "signal_identity_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "device_id", - "getter_name": "deviceId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "name", - "getter_name": "name", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "identity_key", - "getter_name": "identityKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "device_id", - "name" - ] - } - }, - { - "id": 10, - "references": [], - "type": "table", - "data": { - "name": "signal_pre_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "pre_key_id", - "getter_name": "preKeyId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pre_key", - "getter_name": "preKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "pre_key_id" - ] - } - }, - { - "id": 11, - "references": [], - "type": "table", - "data": { - "name": "signal_sender_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "sender_key_name", - "getter_name": "senderKeyName", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_key", - "getter_name": "senderKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "sender_key_name" - ] - } - }, - { - "id": 12, - "references": [], - "type": "table", - "data": { - "name": "signal_session_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "device_id", - "getter_name": "deviceId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "name", - "getter_name": "name", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "session_record", - "getter_name": "sessionRecord", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "device_id", - "name" - ] - } - }, - { - "id": 13, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "message_actions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MessageActionType.values)", - "dart_type_name": "MessageActionType" - } - }, - { - "name": "action_at", - "getter_name": "actionAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id", - "contact_id", - "type" - ] - } - }, - { - "id": 14, - "references": [ - 1, - 0 - ], - "type": "table", - "data": { - "name": "group_histories", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_history_id", - "getter_name": "groupHistoryId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "affected_contact_id", - "getter_name": "affectedContactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "old_group_name", - "getter_name": "oldGroupName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "new_group_name", - "getter_name": "newGroupName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "new_delete_messages_after_milliseconds", - "getter_name": "newDeleteMessagesAfterMilliseconds", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(GroupActionType.values)", - "dart_type_name": "GroupActionType" - } - }, - { - "name": "action_at", - "getter_name": "actionAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_history_id" - ] - } - }, - { - "id": 15, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "key_verifications", - "was_declared_in_moor": false, - "columns": [ - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(VerificationType.values)", - "dart_type_name": "VerificationType" - } - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "contact_id" - ] - } - }, - { - "id": 16, - "references": [], - "type": "table", - "data": { - "name": "verification_tokens", - "was_declared_in_moor": false, - "columns": [ - { - "name": "token_id", - "getter_name": "tokenId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "token", - "getter_name": "token", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 17, - "references": [], - "type": "table", - "data": { - "name": "user_discovery_announced_users", - "was_declared_in_moor": false, - "columns": [ - { - "name": "announced_user_id", - "getter_name": "announcedUserId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "announced_public_key", - "getter_name": "announcedPublicKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_id", - "getter_name": "publicId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "UNIQUE", - "dialectAwareDefaultConstraints": { - "sqlite": "UNIQUE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "unique" - ] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "announced_user_id" - ] - } - }, - { - "id": 18, - "references": [ - 17, - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_user_relations", - "was_declared_in_moor": false, - "columns": [ - { - "name": "announced_user_id", - "getter_name": "announcedUserId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "user_discovery_announced_users", - "column": "announced_user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "from_contact_id", - "getter_name": "fromContactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "public_key_verified_timestamp", - "getter_name": "publicKeyVerifiedTimestamp", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "announced_user_id", - "from_contact_id" - ] - } - }, - { - "id": 19, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_other_promotions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "from_contact_id", - "getter_name": "fromContactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "promotion_id", - "getter_name": "promotionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_id", - "getter_name": "publicId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "threshold", - "getter_name": "threshold", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "announcement_share", - "getter_name": "announcementShare", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_key_verified_timestamp", - "getter_name": "publicKeyVerifiedTimestamp", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "from_contact_id", - "promotion_id" - ] - } - }, - { - "id": 20, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_own_promotions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "version_id", - "getter_name": "versionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "promotion", - "getter_name": "promotion", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 21, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_shares", - "was_declared_in_moor": false, - "columns": [ - { - "name": "share_id", - "getter_name": "shareId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "share", - "getter_name": "share", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - } - ], - "fixed_sql": [ - { - "name": "contacts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"contacts\" (\"user_id\" INTEGER NOT NULL, \"username\" TEXT NOT NULL, \"display_name\" TEXT NULL, \"nick_name\" TEXT NULL, \"avatar_svg_compressed\" BLOB NULL, \"sender_profile_counter\" INTEGER NOT NULL DEFAULT 0, \"accepted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"accepted\" IN (0, 1)), \"deleted_by_user\" INTEGER NOT NULL DEFAULT 0 CHECK (\"deleted_by_user\" IN (0, 1)), \"requested\" INTEGER NOT NULL DEFAULT 0 CHECK (\"requested\" IN (0, 1)), \"blocked\" INTEGER NOT NULL DEFAULT 0 CHECK (\"blocked\" IN (0, 1)), \"verified\" INTEGER NOT NULL DEFAULT 0 CHECK (\"verified\" IN (0, 1)), \"account_deleted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"account_deleted\" IN (0, 1)), \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"user_discovery_version\" BLOB NULL, \"media_send_counter\" INTEGER NOT NULL DEFAULT 0, \"media_received_counter\" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (\"user_id\"));" - } - ] - }, - { - "name": "groups", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"groups\" (\"group_id\" TEXT NOT NULL, \"is_group_admin\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_group_admin\" IN (0, 1)), \"is_direct_chat\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_direct_chat\" IN (0, 1)), \"pinned\" INTEGER NOT NULL DEFAULT 0 CHECK (\"pinned\" IN (0, 1)), \"archived\" INTEGER NOT NULL DEFAULT 0 CHECK (\"archived\" IN (0, 1)), \"joined_group\" INTEGER NOT NULL DEFAULT 0 CHECK (\"joined_group\" IN (0, 1)), \"left_group\" INTEGER NOT NULL DEFAULT 0 CHECK (\"left_group\" IN (0, 1)), \"deleted_content\" INTEGER NOT NULL DEFAULT 0 CHECK (\"deleted_content\" IN (0, 1)), \"state_version_id\" INTEGER NOT NULL DEFAULT 0, \"state_encryption_key\" BLOB NULL, \"my_group_private_key\" BLOB NULL, \"group_name\" TEXT NOT NULL, \"draft_message\" TEXT NULL, \"total_media_counter\" INTEGER NOT NULL DEFAULT 0, \"also_best_friend\" INTEGER NOT NULL DEFAULT 0 CHECK (\"also_best_friend\" IN (0, 1)), \"delete_messages_after_milliseconds\" INTEGER NOT NULL DEFAULT 86400000, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"last_message_send\" INTEGER NULL, \"last_message_received\" INTEGER NULL, \"last_flame_counter_change\" INTEGER NULL, \"last_flame_sync\" INTEGER NULL, \"flame_counter\" INTEGER NOT NULL DEFAULT 0, \"max_flame_counter\" INTEGER NOT NULL DEFAULT 0, \"max_flame_counter_from\" INTEGER NULL, \"last_message_exchange\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_id\"));" - } - ] - }, - { - "name": "media_files", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"media_files\" (\"media_id\" TEXT NOT NULL, \"type\" TEXT NOT NULL, \"upload_state\" TEXT NULL, \"download_state\" TEXT NULL, \"requires_authentication\" INTEGER NOT NULL DEFAULT 0 CHECK (\"requires_authentication\" IN (0, 1)), \"stored\" INTEGER NOT NULL DEFAULT 0 CHECK (\"stored\" IN (0, 1)), \"is_draft_media\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_draft_media\" IN (0, 1)), \"pre_progressing_process\" INTEGER NULL, \"reupload_requested_by\" TEXT NULL, \"display_limit_in_milliseconds\" INTEGER NULL, \"remove_audio\" INTEGER NULL CHECK (\"remove_audio\" IN (0, 1)), \"download_token\" BLOB NULL, \"encryption_key\" BLOB NULL, \"encryption_mac\" BLOB NULL, \"encryption_nonce\" BLOB NULL, \"stored_file_hash\" BLOB NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"media_id\"));" - } - ] - }, - { - "name": "messages", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"messages\" (\"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"message_id\" TEXT NOT NULL, \"sender_id\" INTEGER NULL REFERENCES contacts (user_id), \"type\" TEXT NOT NULL, \"content\" TEXT NULL, \"media_id\" TEXT NULL REFERENCES media_files (media_id) ON DELETE SET NULL, \"additional_message_data\" BLOB NULL, \"media_stored\" INTEGER NOT NULL DEFAULT 0 CHECK (\"media_stored\" IN (0, 1)), \"media_reopened\" INTEGER NOT NULL DEFAULT 0 CHECK (\"media_reopened\" IN (0, 1)), \"download_token\" BLOB NULL, \"quotes_message_id\" TEXT NULL, \"is_deleted_from_sender\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_deleted_from_sender\" IN (0, 1)), \"opened_at\" INTEGER NULL, \"opened_by_all\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"modified_at\" INTEGER NULL, \"ack_by_user\" INTEGER NULL, \"ack_by_server\" INTEGER NULL, PRIMARY KEY (\"message_id\"));" - } - ] - }, - { - "name": "message_histories", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"message_histories\" (\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"content\" TEXT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)));" - } - ] - }, - { - "name": "reactions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"reactions\" (\"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"emoji\" TEXT NOT NULL, \"sender_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"message_id\", \"sender_id\", \"emoji\"));" - } - ] - }, - { - "name": "group_members", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"group_members\" (\"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id), \"member_state\" TEXT NULL, \"group_public_key\" BLOB NULL, \"last_chat_opened\" INTEGER NULL, \"last_type_indicator\" INTEGER NULL, \"last_message\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_id\", \"contact_id\"));" - } - ] - }, - { - "name": "receipts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"receipts\" (\"receipt_id\" TEXT NOT NULL, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"message_id\" TEXT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"message\" BLOB NOT NULL, \"contact_will_sends_receipt\" INTEGER NOT NULL DEFAULT 1 CHECK (\"contact_will_sends_receipt\" IN (0, 1)), \"will_be_retried_by_media_upload\" INTEGER NOT NULL DEFAULT 0 CHECK (\"will_be_retried_by_media_upload\" IN (0, 1)), \"mark_for_retry\" INTEGER NULL, \"mark_for_retry_after_accepted\" INTEGER NULL, \"ack_by_server_at\" INTEGER NULL, \"retry_count\" INTEGER NOT NULL DEFAULT 0, \"last_retry\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"receipt_id\"));" - } - ] - }, - { - "name": "received_receipts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"received_receipts\" (\"receipt_id\" TEXT NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"receipt_id\"));" - } - ] - }, - { - "name": "signal_identity_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_identity_key_stores\" (\"device_id\" INTEGER NOT NULL, \"name\" TEXT NOT NULL, \"identity_key\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"device_id\", \"name\"));" - } - ] - }, - { - "name": "signal_pre_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_pre_key_stores\" (\"pre_key_id\" INTEGER NOT NULL, \"pre_key\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"pre_key_id\"));" - } - ] - }, - { - "name": "signal_sender_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_sender_key_stores\" (\"sender_key_name\" TEXT NOT NULL, \"sender_key\" BLOB NOT NULL, PRIMARY KEY (\"sender_key_name\"));" - } - ] - }, - { - "name": "signal_session_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_session_stores\" (\"device_id\" INTEGER NOT NULL, \"name\" TEXT NOT NULL, \"session_record\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"device_id\", \"name\"));" - } - ] - }, - { - "name": "message_actions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"message_actions\" (\"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"type\" TEXT NOT NULL, \"action_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"message_id\", \"contact_id\", \"type\"));" - } - ] - }, - { - "name": "group_histories", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"group_histories\" (\"group_history_id\" TEXT NOT NULL, \"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id), \"affected_contact_id\" INTEGER NULL, \"old_group_name\" TEXT NULL, \"new_group_name\" TEXT NULL, \"new_delete_messages_after_milliseconds\" INTEGER NULL, \"type\" TEXT NOT NULL, \"action_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_history_id\"));" - } - ] - }, - { - "name": "key_verifications", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"key_verifications\" (\"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"type\" TEXT NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"contact_id\"));" - } - ] - }, - { - "name": "verification_tokens", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"verification_tokens\" (\"token_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"token\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)));" - } - ] - }, - { - "name": "user_discovery_announced_users", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_announced_users\" (\"announced_user_id\" INTEGER NOT NULL, \"announced_public_key\" BLOB NOT NULL, \"public_id\" INTEGER NOT NULL UNIQUE, PRIMARY KEY (\"announced_user_id\"));" - } - ] - }, - { - "name": "user_discovery_user_relations", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_user_relations\" (\"announced_user_id\" INTEGER NOT NULL REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE, \"from_contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"public_key_verified_timestamp\" INTEGER NULL, PRIMARY KEY (\"announced_user_id\", \"from_contact_id\"));" - } - ] - }, - { - "name": "user_discovery_other_promotions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_other_promotions\" (\"from_contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"promotion_id\" INTEGER NOT NULL, \"public_id\" INTEGER NOT NULL, \"threshold\" INTEGER NOT NULL, \"announcement_share\" BLOB NOT NULL, \"public_key_verified_timestamp\" INTEGER NULL, PRIMARY KEY (\"from_contact_id\", \"promotion_id\"));" - } - ] - }, - { - "name": "user_discovery_own_promotions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_own_promotions\" (\"version_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"promotion\" BLOB NOT NULL);" - } - ] - }, - { - "name": "user_discovery_shares", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_shares\" (\"share_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"share\" BLOB NOT NULL, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE);" - } - ] - } - ] -} \ No newline at end of file diff --git a/lib/src/database/schemas/twonly_db/drift_schema_v14.json b/lib/src/database/schemas/twonly_db/drift_schema_v14.json deleted file mode 100644 index 53bef4a6..00000000 --- a/lib/src/database/schemas/twonly_db/drift_schema_v14.json +++ /dev/null @@ -1,2713 +0,0 @@ -{ - "_meta": { - "description": "This file contains a serialized version of schema entities for drift.", - "version": "1.3.0" - }, - "options": { - "store_date_time_values_as_text": false - }, - "entities": [ - { - "id": 0, - "references": [], - "type": "table", - "data": { - "name": "contacts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "user_id", - "getter_name": "userId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "username", - "getter_name": "username", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "display_name", - "getter_name": "displayName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "nick_name", - "getter_name": "nickName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "avatar_svg_compressed", - "getter_name": "avatarSvgCompressed", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_profile_counter", - "getter_name": "senderProfileCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "accepted", - "getter_name": "accepted", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"accepted\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"accepted\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "deleted_by_user", - "getter_name": "deletedByUser", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"deleted_by_user\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"deleted_by_user\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "requested", - "getter_name": "requested", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"requested\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"requested\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "blocked", - "getter_name": "blocked", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"blocked\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"blocked\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "verified", - "getter_name": "verified", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"verified\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"verified\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "account_deleted", - "getter_name": "accountDeleted", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"account_deleted\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"account_deleted\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "user_discovery_version", - "getter_name": "userDiscoveryVersion", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_send_counter", - "getter_name": "mediaSendCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_received_counter", - "getter_name": "mediaReceivedCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "user_id" - ] - } - }, - { - "id": 1, - "references": [], - "type": "table", - "data": { - "name": "groups", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_group_admin", - "getter_name": "isGroupAdmin", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_group_admin\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_group_admin\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_direct_chat", - "getter_name": "isDirectChat", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_direct_chat\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_direct_chat\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pinned", - "getter_name": "pinned", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"pinned\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"pinned\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "archived", - "getter_name": "archived", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"archived\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"archived\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "joined_group", - "getter_name": "joinedGroup", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"joined_group\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"joined_group\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "left_group", - "getter_name": "leftGroup", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"left_group\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"left_group\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "deleted_content", - "getter_name": "deletedContent", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"deleted_content\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"deleted_content\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "state_version_id", - "getter_name": "stateVersionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "state_encryption_key", - "getter_name": "stateEncryptionKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "my_group_private_key", - "getter_name": "myGroupPrivateKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "group_name", - "getter_name": "groupName", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "draft_message", - "getter_name": "draftMessage", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "total_media_counter", - "getter_name": "totalMediaCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "also_best_friend", - "getter_name": "alsoBestFriend", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"also_best_friend\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"also_best_friend\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "delete_messages_after_milliseconds", - "getter_name": "deleteMessagesAfterMilliseconds", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('86400000')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_send", - "getter_name": "lastMessageSend", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_received", - "getter_name": "lastMessageReceived", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_flame_counter_change", - "getter_name": "lastFlameCounterChange", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_flame_sync", - "getter_name": "lastFlameSync", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "flame_counter", - "getter_name": "flameCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "max_flame_counter", - "getter_name": "maxFlameCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "max_flame_counter_from", - "getter_name": "maxFlameCounterFrom", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_exchange", - "getter_name": "lastMessageExchange", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_id" - ] - } - }, - { - "id": 2, - "references": [], - "type": "table", - "data": { - "name": "media_files", - "was_declared_in_moor": false, - "columns": [ - { - "name": "media_id", - "getter_name": "mediaId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MediaType.values)", - "dart_type_name": "MediaType" - } - }, - { - "name": "upload_state", - "getter_name": "uploadState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(UploadState.values)", - "dart_type_name": "UploadState" - } - }, - { - "name": "download_state", - "getter_name": "downloadState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(DownloadState.values)", - "dart_type_name": "DownloadState" - } - }, - { - "name": "requires_authentication", - "getter_name": "requiresAuthentication", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"requires_authentication\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"requires_authentication\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "stored", - "getter_name": "stored", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"stored\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"stored\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_draft_media", - "getter_name": "isDraftMedia", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_draft_media\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_draft_media\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pre_progressing_process", - "getter_name": "preProgressingProcess", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "reupload_requested_by", - "getter_name": "reuploadRequestedBy", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "IntListTypeConverter()", - "dart_type_name": "List" - } - }, - { - "name": "display_limit_in_milliseconds", - "getter_name": "displayLimitInMilliseconds", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "remove_audio", - "getter_name": "removeAudio", - "moor_type": "bool", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "CHECK (\"remove_audio\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"remove_audio\" IN (0, 1))" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "download_token", - "getter_name": "downloadToken", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_key", - "getter_name": "encryptionKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_mac", - "getter_name": "encryptionMac", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_nonce", - "getter_name": "encryptionNonce", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "stored_file_hash", - "getter_name": "storedFileHash", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "media_id" - ] - } - }, - { - "id": 3, - "references": [ - 1, - 0, - 2 - ], - "type": "table", - "data": { - "name": "messages", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_id", - "getter_name": "senderId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "content", - "getter_name": "content", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_id", - "getter_name": "mediaId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES media_files (media_id) ON DELETE SET NULL", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES media_files (media_id) ON DELETE SET NULL" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "media_files", - "column": "media_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "setNull" - } - } - ] - }, - { - "name": "additional_message_data", - "getter_name": "additionalMessageData", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_stored", - "getter_name": "mediaStored", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"media_stored\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"media_stored\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_reopened", - "getter_name": "mediaReopened", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"media_reopened\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"media_reopened\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "download_token", - "getter_name": "downloadToken", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "quotes_message_id", - "getter_name": "quotesMessageId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_deleted_from_sender", - "getter_name": "isDeletedFromSender", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_deleted_from_sender\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_deleted_from_sender\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "opened_at", - "getter_name": "openedAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "opened_by_all", - "getter_name": "openedByAll", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "modified_at", - "getter_name": "modifiedAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_user", - "getter_name": "ackByUser", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_server", - "getter_name": "ackByServer", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id" - ] - } - }, - { - "id": 4, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "message_histories", - "was_declared_in_moor": false, - "columns": [ - { - "name": "id", - "getter_name": "id", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "content", - "getter_name": "content", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 5, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "reactions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "emoji", - "getter_name": "emoji", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_id", - "getter_name": "senderId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id", - "sender_id", - "emoji" - ] - } - }, - { - "id": 6, - "references": [ - 1, - 0 - ], - "type": "table", - "data": { - "name": "group_members", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "member_state", - "getter_name": "memberState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MemberState.values)", - "dart_type_name": "MemberState" - } - }, - { - "name": "group_public_key", - "getter_name": "groupPublicKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_chat_opened", - "getter_name": "lastChatOpened", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_type_indicator", - "getter_name": "lastTypeIndicator", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message", - "getter_name": "lastMessage", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_id", - "contact_id" - ] - } - }, - { - "id": 7, - "references": [ - 0, - 3 - ], - "type": "table", - "data": { - "name": "receipts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "receipt_id", - "getter_name": "receiptId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message", - "getter_name": "message", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_will_sends_receipt", - "getter_name": "contactWillSendsReceipt", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"contact_will_sends_receipt\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"contact_will_sends_receipt\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('1')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "will_be_retried_by_media_upload", - "getter_name": "willBeRetriedByMediaUpload", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"will_be_retried_by_media_upload\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"will_be_retried_by_media_upload\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "mark_for_retry", - "getter_name": "markForRetry", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "mark_for_retry_after_accepted", - "getter_name": "markForRetryAfterAccepted", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_server_at", - "getter_name": "ackByServerAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "retry_count", - "getter_name": "retryCount", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_retry", - "getter_name": "lastRetry", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "receipt_id" - ] - } - }, - { - "id": 8, - "references": [], - "type": "table", - "data": { - "name": "received_receipts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "receipt_id", - "getter_name": "receiptId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "receipt_id" - ] - } - }, - { - "id": 9, - "references": [], - "type": "table", - "data": { - "name": "signal_identity_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "device_id", - "getter_name": "deviceId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "name", - "getter_name": "name", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "identity_key", - "getter_name": "identityKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "device_id", - "name" - ] - } - }, - { - "id": 10, - "references": [], - "type": "table", - "data": { - "name": "signal_pre_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "pre_key_id", - "getter_name": "preKeyId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pre_key", - "getter_name": "preKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "pre_key_id" - ] - } - }, - { - "id": 11, - "references": [], - "type": "table", - "data": { - "name": "signal_sender_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "sender_key_name", - "getter_name": "senderKeyName", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_key", - "getter_name": "senderKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "sender_key_name" - ] - } - }, - { - "id": 12, - "references": [], - "type": "table", - "data": { - "name": "signal_session_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "device_id", - "getter_name": "deviceId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "name", - "getter_name": "name", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "session_record", - "getter_name": "sessionRecord", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "device_id", - "name" - ] - } - }, - { - "id": 13, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "message_actions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MessageActionType.values)", - "dart_type_name": "MessageActionType" - } - }, - { - "name": "action_at", - "getter_name": "actionAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id", - "contact_id", - "type" - ] - } - }, - { - "id": 14, - "references": [ - 1, - 0 - ], - "type": "table", - "data": { - "name": "group_histories", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_history_id", - "getter_name": "groupHistoryId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "affected_contact_id", - "getter_name": "affectedContactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "old_group_name", - "getter_name": "oldGroupName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "new_group_name", - "getter_name": "newGroupName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "new_delete_messages_after_milliseconds", - "getter_name": "newDeleteMessagesAfterMilliseconds", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(GroupActionType.values)", - "dart_type_name": "GroupActionType" - } - }, - { - "name": "action_at", - "getter_name": "actionAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_history_id" - ] - } - }, - { - "id": 15, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "key_verifications", - "was_declared_in_moor": false, - "columns": [ - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(VerificationType.values)", - "dart_type_name": "VerificationType" - } - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "contact_id" - ] - } - }, - { - "id": 16, - "references": [], - "type": "table", - "data": { - "name": "verification_tokens", - "was_declared_in_moor": false, - "columns": [ - { - "name": "token_id", - "getter_name": "tokenId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "token", - "getter_name": "token", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 17, - "references": [], - "type": "table", - "data": { - "name": "user_discovery_announced_users", - "was_declared_in_moor": false, - "columns": [ - { - "name": "announced_user_id", - "getter_name": "announcedUserId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "announced_public_key", - "getter_name": "announcedPublicKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_id", - "getter_name": "publicId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "UNIQUE", - "dialectAwareDefaultConstraints": { - "sqlite": "UNIQUE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "unique" - ] - }, - { - "name": "username", - "getter_name": "username", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "was_shown_to_the_user", - "getter_name": "wasShownToTheUser", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"was_shown_to_the_user\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"was_shown_to_the_user\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_hidden", - "getter_name": "isHidden", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_hidden\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_hidden\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "announced_user_id" - ] - } - }, - { - "id": 18, - "references": [ - 17, - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_user_relations", - "was_declared_in_moor": false, - "columns": [ - { - "name": "announced_user_id", - "getter_name": "announcedUserId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "user_discovery_announced_users", - "column": "announced_user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "from_contact_id", - "getter_name": "fromContactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "public_key_verified_timestamp", - "getter_name": "publicKeyVerifiedTimestamp", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "announced_user_id", - "from_contact_id" - ] - } - }, - { - "id": 19, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_other_promotions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "from_contact_id", - "getter_name": "fromContactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "promotion_id", - "getter_name": "promotionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_id", - "getter_name": "publicId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "threshold", - "getter_name": "threshold", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "announcement_share", - "getter_name": "announcementShare", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_key_verified_timestamp", - "getter_name": "publicKeyVerifiedTimestamp", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "from_contact_id", - "promotion_id" - ] - } - }, - { - "id": 20, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_own_promotions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "version_id", - "getter_name": "versionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "promotion", - "getter_name": "promotion", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 21, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_shares", - "was_declared_in_moor": false, - "columns": [ - { - "name": "share_id", - "getter_name": "shareId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "share", - "getter_name": "share", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - } - ], - "fixed_sql": [ - { - "name": "contacts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"contacts\" (\"user_id\" INTEGER NOT NULL, \"username\" TEXT NOT NULL, \"display_name\" TEXT NULL, \"nick_name\" TEXT NULL, \"avatar_svg_compressed\" BLOB NULL, \"sender_profile_counter\" INTEGER NOT NULL DEFAULT 0, \"accepted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"accepted\" IN (0, 1)), \"deleted_by_user\" INTEGER NOT NULL DEFAULT 0 CHECK (\"deleted_by_user\" IN (0, 1)), \"requested\" INTEGER NOT NULL DEFAULT 0 CHECK (\"requested\" IN (0, 1)), \"blocked\" INTEGER NOT NULL DEFAULT 0 CHECK (\"blocked\" IN (0, 1)), \"verified\" INTEGER NOT NULL DEFAULT 0 CHECK (\"verified\" IN (0, 1)), \"account_deleted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"account_deleted\" IN (0, 1)), \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"user_discovery_version\" BLOB NULL, \"media_send_counter\" INTEGER NOT NULL DEFAULT 0, \"media_received_counter\" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (\"user_id\"));" - } - ] - }, - { - "name": "groups", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"groups\" (\"group_id\" TEXT NOT NULL, \"is_group_admin\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_group_admin\" IN (0, 1)), \"is_direct_chat\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_direct_chat\" IN (0, 1)), \"pinned\" INTEGER NOT NULL DEFAULT 0 CHECK (\"pinned\" IN (0, 1)), \"archived\" INTEGER NOT NULL DEFAULT 0 CHECK (\"archived\" IN (0, 1)), \"joined_group\" INTEGER NOT NULL DEFAULT 0 CHECK (\"joined_group\" IN (0, 1)), \"left_group\" INTEGER NOT NULL DEFAULT 0 CHECK (\"left_group\" IN (0, 1)), \"deleted_content\" INTEGER NOT NULL DEFAULT 0 CHECK (\"deleted_content\" IN (0, 1)), \"state_version_id\" INTEGER NOT NULL DEFAULT 0, \"state_encryption_key\" BLOB NULL, \"my_group_private_key\" BLOB NULL, \"group_name\" TEXT NOT NULL, \"draft_message\" TEXT NULL, \"total_media_counter\" INTEGER NOT NULL DEFAULT 0, \"also_best_friend\" INTEGER NOT NULL DEFAULT 0 CHECK (\"also_best_friend\" IN (0, 1)), \"delete_messages_after_milliseconds\" INTEGER NOT NULL DEFAULT 86400000, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"last_message_send\" INTEGER NULL, \"last_message_received\" INTEGER NULL, \"last_flame_counter_change\" INTEGER NULL, \"last_flame_sync\" INTEGER NULL, \"flame_counter\" INTEGER NOT NULL DEFAULT 0, \"max_flame_counter\" INTEGER NOT NULL DEFAULT 0, \"max_flame_counter_from\" INTEGER NULL, \"last_message_exchange\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_id\"));" - } - ] - }, - { - "name": "media_files", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"media_files\" (\"media_id\" TEXT NOT NULL, \"type\" TEXT NOT NULL, \"upload_state\" TEXT NULL, \"download_state\" TEXT NULL, \"requires_authentication\" INTEGER NOT NULL DEFAULT 0 CHECK (\"requires_authentication\" IN (0, 1)), \"stored\" INTEGER NOT NULL DEFAULT 0 CHECK (\"stored\" IN (0, 1)), \"is_draft_media\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_draft_media\" IN (0, 1)), \"pre_progressing_process\" INTEGER NULL, \"reupload_requested_by\" TEXT NULL, \"display_limit_in_milliseconds\" INTEGER NULL, \"remove_audio\" INTEGER NULL CHECK (\"remove_audio\" IN (0, 1)), \"download_token\" BLOB NULL, \"encryption_key\" BLOB NULL, \"encryption_mac\" BLOB NULL, \"encryption_nonce\" BLOB NULL, \"stored_file_hash\" BLOB NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"media_id\"));" - } - ] - }, - { - "name": "messages", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"messages\" (\"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"message_id\" TEXT NOT NULL, \"sender_id\" INTEGER NULL REFERENCES contacts (user_id), \"type\" TEXT NOT NULL, \"content\" TEXT NULL, \"media_id\" TEXT NULL REFERENCES media_files (media_id) ON DELETE SET NULL, \"additional_message_data\" BLOB NULL, \"media_stored\" INTEGER NOT NULL DEFAULT 0 CHECK (\"media_stored\" IN (0, 1)), \"media_reopened\" INTEGER NOT NULL DEFAULT 0 CHECK (\"media_reopened\" IN (0, 1)), \"download_token\" BLOB NULL, \"quotes_message_id\" TEXT NULL, \"is_deleted_from_sender\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_deleted_from_sender\" IN (0, 1)), \"opened_at\" INTEGER NULL, \"opened_by_all\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"modified_at\" INTEGER NULL, \"ack_by_user\" INTEGER NULL, \"ack_by_server\" INTEGER NULL, PRIMARY KEY (\"message_id\"));" - } - ] - }, - { - "name": "message_histories", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"message_histories\" (\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"content\" TEXT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)));" - } - ] - }, - { - "name": "reactions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"reactions\" (\"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"emoji\" TEXT NOT NULL, \"sender_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"message_id\", \"sender_id\", \"emoji\"));" - } - ] - }, - { - "name": "group_members", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"group_members\" (\"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id), \"member_state\" TEXT NULL, \"group_public_key\" BLOB NULL, \"last_chat_opened\" INTEGER NULL, \"last_type_indicator\" INTEGER NULL, \"last_message\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_id\", \"contact_id\"));" - } - ] - }, - { - "name": "receipts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"receipts\" (\"receipt_id\" TEXT NOT NULL, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"message_id\" TEXT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"message\" BLOB NOT NULL, \"contact_will_sends_receipt\" INTEGER NOT NULL DEFAULT 1 CHECK (\"contact_will_sends_receipt\" IN (0, 1)), \"will_be_retried_by_media_upload\" INTEGER NOT NULL DEFAULT 0 CHECK (\"will_be_retried_by_media_upload\" IN (0, 1)), \"mark_for_retry\" INTEGER NULL, \"mark_for_retry_after_accepted\" INTEGER NULL, \"ack_by_server_at\" INTEGER NULL, \"retry_count\" INTEGER NOT NULL DEFAULT 0, \"last_retry\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"receipt_id\"));" - } - ] - }, - { - "name": "received_receipts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"received_receipts\" (\"receipt_id\" TEXT NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"receipt_id\"));" - } - ] - }, - { - "name": "signal_identity_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_identity_key_stores\" (\"device_id\" INTEGER NOT NULL, \"name\" TEXT NOT NULL, \"identity_key\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"device_id\", \"name\"));" - } - ] - }, - { - "name": "signal_pre_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_pre_key_stores\" (\"pre_key_id\" INTEGER NOT NULL, \"pre_key\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"pre_key_id\"));" - } - ] - }, - { - "name": "signal_sender_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_sender_key_stores\" (\"sender_key_name\" TEXT NOT NULL, \"sender_key\" BLOB NOT NULL, PRIMARY KEY (\"sender_key_name\"));" - } - ] - }, - { - "name": "signal_session_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_session_stores\" (\"device_id\" INTEGER NOT NULL, \"name\" TEXT NOT NULL, \"session_record\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"device_id\", \"name\"));" - } - ] - }, - { - "name": "message_actions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"message_actions\" (\"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"type\" TEXT NOT NULL, \"action_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"message_id\", \"contact_id\", \"type\"));" - } - ] - }, - { - "name": "group_histories", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"group_histories\" (\"group_history_id\" TEXT NOT NULL, \"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id), \"affected_contact_id\" INTEGER NULL, \"old_group_name\" TEXT NULL, \"new_group_name\" TEXT NULL, \"new_delete_messages_after_milliseconds\" INTEGER NULL, \"type\" TEXT NOT NULL, \"action_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_history_id\"));" - } - ] - }, - { - "name": "key_verifications", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"key_verifications\" (\"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"type\" TEXT NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"contact_id\"));" - } - ] - }, - { - "name": "verification_tokens", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"verification_tokens\" (\"token_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"token\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)));" - } - ] - }, - { - "name": "user_discovery_announced_users", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_announced_users\" (\"announced_user_id\" INTEGER NOT NULL, \"announced_public_key\" BLOB NOT NULL, \"public_id\" INTEGER NOT NULL UNIQUE, \"username\" TEXT NULL, \"was_shown_to_the_user\" INTEGER NOT NULL DEFAULT 0 CHECK (\"was_shown_to_the_user\" IN (0, 1)), \"is_hidden\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_hidden\" IN (0, 1)), PRIMARY KEY (\"announced_user_id\"));" - } - ] - }, - { - "name": "user_discovery_user_relations", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_user_relations\" (\"announced_user_id\" INTEGER NOT NULL REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE, \"from_contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"public_key_verified_timestamp\" INTEGER NULL, PRIMARY KEY (\"announced_user_id\", \"from_contact_id\"));" - } - ] - }, - { - "name": "user_discovery_other_promotions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_other_promotions\" (\"from_contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"promotion_id\" INTEGER NOT NULL, \"public_id\" INTEGER NOT NULL, \"threshold\" INTEGER NOT NULL, \"announcement_share\" BLOB NOT NULL, \"public_key_verified_timestamp\" INTEGER NULL, PRIMARY KEY (\"from_contact_id\", \"promotion_id\"));" - } - ] - }, - { - "name": "user_discovery_own_promotions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_own_promotions\" (\"version_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"promotion\" BLOB NOT NULL);" - } - ] - }, - { - "name": "user_discovery_shares", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_shares\" (\"share_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"share\" BLOB NOT NULL, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE);" - } - ] - } - ] -} \ No newline at end of file diff --git a/lib/src/database/schemas/twonly_db/drift_schema_v15.json b/lib/src/database/schemas/twonly_db/drift_schema_v15.json deleted file mode 100644 index d83a2a44..00000000 --- a/lib/src/database/schemas/twonly_db/drift_schema_v15.json +++ /dev/null @@ -1,2727 +0,0 @@ -{ - "_meta": { - "description": "This file contains a serialized version of schema entities for drift.", - "version": "1.3.0" - }, - "options": { - "store_date_time_values_as_text": false - }, - "entities": [ - { - "id": 0, - "references": [], - "type": "table", - "data": { - "name": "contacts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "user_id", - "getter_name": "userId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "username", - "getter_name": "username", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "display_name", - "getter_name": "displayName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "nick_name", - "getter_name": "nickName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "avatar_svg_compressed", - "getter_name": "avatarSvgCompressed", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_profile_counter", - "getter_name": "senderProfileCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "accepted", - "getter_name": "accepted", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"accepted\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"accepted\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "deleted_by_user", - "getter_name": "deletedByUser", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"deleted_by_user\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"deleted_by_user\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "requested", - "getter_name": "requested", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"requested\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"requested\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "blocked", - "getter_name": "blocked", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"blocked\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"blocked\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "verified", - "getter_name": "verified", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"verified\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"verified\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "account_deleted", - "getter_name": "accountDeleted", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"account_deleted\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"account_deleted\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "user_discovery_version", - "getter_name": "userDiscoveryVersion", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "user_discovery_excluded", - "getter_name": "userDiscoveryExcluded", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"user_discovery_excluded\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"user_discovery_excluded\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_send_counter", - "getter_name": "mediaSendCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_received_counter", - "getter_name": "mediaReceivedCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "user_id" - ] - } - }, - { - "id": 1, - "references": [], - "type": "table", - "data": { - "name": "groups", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_group_admin", - "getter_name": "isGroupAdmin", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_group_admin\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_group_admin\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_direct_chat", - "getter_name": "isDirectChat", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_direct_chat\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_direct_chat\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pinned", - "getter_name": "pinned", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"pinned\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"pinned\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "archived", - "getter_name": "archived", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"archived\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"archived\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "joined_group", - "getter_name": "joinedGroup", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"joined_group\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"joined_group\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "left_group", - "getter_name": "leftGroup", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"left_group\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"left_group\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "deleted_content", - "getter_name": "deletedContent", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"deleted_content\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"deleted_content\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "state_version_id", - "getter_name": "stateVersionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "state_encryption_key", - "getter_name": "stateEncryptionKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "my_group_private_key", - "getter_name": "myGroupPrivateKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "group_name", - "getter_name": "groupName", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "draft_message", - "getter_name": "draftMessage", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "total_media_counter", - "getter_name": "totalMediaCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "also_best_friend", - "getter_name": "alsoBestFriend", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"also_best_friend\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"also_best_friend\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "delete_messages_after_milliseconds", - "getter_name": "deleteMessagesAfterMilliseconds", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('86400000')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_send", - "getter_name": "lastMessageSend", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_received", - "getter_name": "lastMessageReceived", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_flame_counter_change", - "getter_name": "lastFlameCounterChange", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_flame_sync", - "getter_name": "lastFlameSync", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "flame_counter", - "getter_name": "flameCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "max_flame_counter", - "getter_name": "maxFlameCounter", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "max_flame_counter_from", - "getter_name": "maxFlameCounterFrom", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message_exchange", - "getter_name": "lastMessageExchange", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_id" - ] - } - }, - { - "id": 2, - "references": [], - "type": "table", - "data": { - "name": "media_files", - "was_declared_in_moor": false, - "columns": [ - { - "name": "media_id", - "getter_name": "mediaId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MediaType.values)", - "dart_type_name": "MediaType" - } - }, - { - "name": "upload_state", - "getter_name": "uploadState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(UploadState.values)", - "dart_type_name": "UploadState" - } - }, - { - "name": "download_state", - "getter_name": "downloadState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(DownloadState.values)", - "dart_type_name": "DownloadState" - } - }, - { - "name": "requires_authentication", - "getter_name": "requiresAuthentication", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"requires_authentication\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"requires_authentication\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "stored", - "getter_name": "stored", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"stored\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"stored\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_draft_media", - "getter_name": "isDraftMedia", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_draft_media\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_draft_media\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pre_progressing_process", - "getter_name": "preProgressingProcess", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "reupload_requested_by", - "getter_name": "reuploadRequestedBy", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "IntListTypeConverter()", - "dart_type_name": "List" - } - }, - { - "name": "display_limit_in_milliseconds", - "getter_name": "displayLimitInMilliseconds", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "remove_audio", - "getter_name": "removeAudio", - "moor_type": "bool", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "CHECK (\"remove_audio\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"remove_audio\" IN (0, 1))" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "download_token", - "getter_name": "downloadToken", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_key", - "getter_name": "encryptionKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_mac", - "getter_name": "encryptionMac", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "encryption_nonce", - "getter_name": "encryptionNonce", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "stored_file_hash", - "getter_name": "storedFileHash", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "media_id" - ] - } - }, - { - "id": 3, - "references": [ - 1, - 0, - 2 - ], - "type": "table", - "data": { - "name": "messages", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_id", - "getter_name": "senderId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "content", - "getter_name": "content", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_id", - "getter_name": "mediaId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES media_files (media_id) ON DELETE SET NULL", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES media_files (media_id) ON DELETE SET NULL" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "media_files", - "column": "media_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "setNull" - } - } - ] - }, - { - "name": "additional_message_data", - "getter_name": "additionalMessageData", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_stored", - "getter_name": "mediaStored", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"media_stored\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"media_stored\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "media_reopened", - "getter_name": "mediaReopened", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"media_reopened\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"media_reopened\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "download_token", - "getter_name": "downloadToken", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "quotes_message_id", - "getter_name": "quotesMessageId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_deleted_from_sender", - "getter_name": "isDeletedFromSender", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_deleted_from_sender\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_deleted_from_sender\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "opened_at", - "getter_name": "openedAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "opened_by_all", - "getter_name": "openedByAll", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "modified_at", - "getter_name": "modifiedAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_user", - "getter_name": "ackByUser", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_server", - "getter_name": "ackByServer", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id" - ] - } - }, - { - "id": 4, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "message_histories", - "was_declared_in_moor": false, - "columns": [ - { - "name": "id", - "getter_name": "id", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "content", - "getter_name": "content", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 5, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "reactions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "emoji", - "getter_name": "emoji", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_id", - "getter_name": "senderId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id", - "sender_id", - "emoji" - ] - } - }, - { - "id": 6, - "references": [ - 1, - 0 - ], - "type": "table", - "data": { - "name": "group_members", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "member_state", - "getter_name": "memberState", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MemberState.values)", - "dart_type_name": "MemberState" - } - }, - { - "name": "group_public_key", - "getter_name": "groupPublicKey", - "moor_type": "blob", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_chat_opened", - "getter_name": "lastChatOpened", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_type_indicator", - "getter_name": "lastTypeIndicator", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_message", - "getter_name": "lastMessage", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_id", - "contact_id" - ] - } - }, - { - "id": 7, - "references": [ - 0, - 3 - ], - "type": "table", - "data": { - "name": "receipts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "receipt_id", - "getter_name": "receiptId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "message", - "getter_name": "message", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_will_sends_receipt", - "getter_name": "contactWillSendsReceipt", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"contact_will_sends_receipt\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"contact_will_sends_receipt\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('1')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "will_be_retried_by_media_upload", - "getter_name": "willBeRetriedByMediaUpload", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"will_be_retried_by_media_upload\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"will_be_retried_by_media_upload\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "mark_for_retry", - "getter_name": "markForRetry", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "mark_for_retry_after_accepted", - "getter_name": "markForRetryAfterAccepted", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "ack_by_server_at", - "getter_name": "ackByServerAt", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "retry_count", - "getter_name": "retryCount", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "last_retry", - "getter_name": "lastRetry", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "receipt_id" - ] - } - }, - { - "id": 8, - "references": [], - "type": "table", - "data": { - "name": "received_receipts", - "was_declared_in_moor": false, - "columns": [ - { - "name": "receipt_id", - "getter_name": "receiptId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "receipt_id" - ] - } - }, - { - "id": 9, - "references": [], - "type": "table", - "data": { - "name": "signal_identity_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "device_id", - "getter_name": "deviceId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "name", - "getter_name": "name", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "identity_key", - "getter_name": "identityKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "device_id", - "name" - ] - } - }, - { - "id": 10, - "references": [], - "type": "table", - "data": { - "name": "signal_pre_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "pre_key_id", - "getter_name": "preKeyId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "pre_key", - "getter_name": "preKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "pre_key_id" - ] - } - }, - { - "id": 11, - "references": [], - "type": "table", - "data": { - "name": "signal_sender_key_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "sender_key_name", - "getter_name": "senderKeyName", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "sender_key", - "getter_name": "senderKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "sender_key_name" - ] - } - }, - { - "id": 12, - "references": [], - "type": "table", - "data": { - "name": "signal_session_stores", - "was_declared_in_moor": false, - "columns": [ - { - "name": "device_id", - "getter_name": "deviceId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "name", - "getter_name": "name", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "session_record", - "getter_name": "sessionRecord", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "device_id", - "name" - ] - } - }, - { - "id": 13, - "references": [ - 3, - 0 - ], - "type": "table", - "data": { - "name": "message_actions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "message_id", - "getter_name": "messageId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES messages (message_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES messages (message_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "messages", - "column": "message_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(MessageActionType.values)", - "dart_type_name": "MessageActionType" - } - }, - { - "name": "action_at", - "getter_name": "actionAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "message_id", - "contact_id", - "type" - ] - } - }, - { - "id": 14, - "references": [ - 1, - 0 - ], - "type": "table", - "data": { - "name": "group_histories", - "was_declared_in_moor": false, - "columns": [ - { - "name": "group_history_id", - "getter_name": "groupHistoryId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "group_id", - "getter_name": "groupId", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES \"groups\" (group_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "groups", - "column": "group_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id)", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id)" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": null - } - } - ] - }, - { - "name": "affected_contact_id", - "getter_name": "affectedContactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "old_group_name", - "getter_name": "oldGroupName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "new_group_name", - "getter_name": "newGroupName", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "new_delete_messages_after_milliseconds", - "getter_name": "newDeleteMessagesAfterMilliseconds", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(GroupActionType.values)", - "dart_type_name": "GroupActionType" - } - }, - { - "name": "action_at", - "getter_name": "actionAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "group_history_id" - ] - } - }, - { - "id": 15, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "key_verifications", - "was_declared_in_moor": false, - "columns": [ - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "type", - "getter_name": "type", - "moor_type": "string", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [], - "type_converter": { - "dart_expr": "const EnumNameConverter(VerificationType.values)", - "dart_type_name": "VerificationType" - } - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "contact_id" - ] - } - }, - { - "id": 16, - "references": [], - "type": "table", - "data": { - "name": "verification_tokens", - "was_declared_in_moor": false, - "columns": [ - { - "name": "token_id", - "getter_name": "tokenId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "token", - "getter_name": "token", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "created_at", - "getter_name": "createdAt", - "moor_type": "dateTime", - "nullable": false, - "customConstraints": null, - "default_dart": "const CustomExpression('CAST(strftime(\\'%s\\', CURRENT_TIMESTAMP) AS INTEGER)')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 17, - "references": [], - "type": "table", - "data": { - "name": "user_discovery_announced_users", - "was_declared_in_moor": false, - "columns": [ - { - "name": "announced_user_id", - "getter_name": "announcedUserId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "announced_public_key", - "getter_name": "announcedPublicKey", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_id", - "getter_name": "publicId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "UNIQUE", - "dialectAwareDefaultConstraints": { - "sqlite": "UNIQUE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "unique" - ] - }, - { - "name": "username", - "getter_name": "username", - "moor_type": "string", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "was_shown_to_the_user", - "getter_name": "wasShownToTheUser", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"was_shown_to_the_user\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"was_shown_to_the_user\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "is_hidden", - "getter_name": "isHidden", - "moor_type": "bool", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "CHECK (\"is_hidden\" IN (0, 1))", - "dialectAwareDefaultConstraints": { - "sqlite": "CHECK (\"is_hidden\" IN (0, 1))" - }, - "default_dart": "const CustomExpression('0')", - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "announced_user_id" - ] - } - }, - { - "id": 18, - "references": [ - 17, - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_user_relations", - "was_declared_in_moor": false, - "columns": [ - { - "name": "announced_user_id", - "getter_name": "announcedUserId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "user_discovery_announced_users", - "column": "announced_user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "from_contact_id", - "getter_name": "fromContactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "public_key_verified_timestamp", - "getter_name": "publicKeyVerifiedTimestamp", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "announced_user_id", - "from_contact_id" - ] - } - }, - { - "id": 19, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_other_promotions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "from_contact_id", - "getter_name": "fromContactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "promotion_id", - "getter_name": "promotionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_id", - "getter_name": "publicId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "threshold", - "getter_name": "threshold", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "announcement_share", - "getter_name": "announcementShare", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "public_key_verified_timestamp", - "getter_name": "publicKeyVerifiedTimestamp", - "moor_type": "dateTime", - "nullable": true, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [], - "explicit_pk": [ - "from_contact_id", - "promotion_id" - ] - } - }, - { - "id": 20, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_own_promotions", - "was_declared_in_moor": false, - "columns": [ - { - "name": "version_id", - "getter_name": "versionId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - }, - { - "name": "promotion", - "getter_name": "promotion", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - }, - { - "id": 21, - "references": [ - 0 - ], - "type": "table", - "data": { - "name": "user_discovery_shares", - "was_declared_in_moor": false, - "columns": [ - { - "name": "share_id", - "getter_name": "shareId", - "moor_type": "int", - "nullable": false, - "customConstraints": null, - "defaultConstraints": "PRIMARY KEY AUTOINCREMENT", - "dialectAwareDefaultConstraints": { - "sqlite": "PRIMARY KEY AUTOINCREMENT" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - "auto-increment" - ] - }, - { - "name": "share", - "getter_name": "share", - "moor_type": "blob", - "nullable": false, - "customConstraints": null, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [] - }, - { - "name": "contact_id", - "getter_name": "contactId", - "moor_type": "int", - "nullable": true, - "customConstraints": null, - "defaultConstraints": "REFERENCES contacts (user_id) ON DELETE CASCADE", - "dialectAwareDefaultConstraints": { - "sqlite": "REFERENCES contacts (user_id) ON DELETE CASCADE" - }, - "default_dart": null, - "default_client_dart": null, - "dsl_features": [ - { - "foreign_key": { - "to": { - "table": "contacts", - "column": "user_id" - }, - "initially_deferred": false, - "on_update": null, - "on_delete": "cascade" - } - } - ] - } - ], - "is_virtual": false, - "without_rowid": false, - "constraints": [] - } - } - ], - "fixed_sql": [ - { - "name": "contacts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"contacts\" (\"user_id\" INTEGER NOT NULL, \"username\" TEXT NOT NULL, \"display_name\" TEXT NULL, \"nick_name\" TEXT NULL, \"avatar_svg_compressed\" BLOB NULL, \"sender_profile_counter\" INTEGER NOT NULL DEFAULT 0, \"accepted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"accepted\" IN (0, 1)), \"deleted_by_user\" INTEGER NOT NULL DEFAULT 0 CHECK (\"deleted_by_user\" IN (0, 1)), \"requested\" INTEGER NOT NULL DEFAULT 0 CHECK (\"requested\" IN (0, 1)), \"blocked\" INTEGER NOT NULL DEFAULT 0 CHECK (\"blocked\" IN (0, 1)), \"verified\" INTEGER NOT NULL DEFAULT 0 CHECK (\"verified\" IN (0, 1)), \"account_deleted\" INTEGER NOT NULL DEFAULT 0 CHECK (\"account_deleted\" IN (0, 1)), \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"user_discovery_version\" BLOB NULL, \"user_discovery_excluded\" INTEGER NOT NULL DEFAULT 0 CHECK (\"user_discovery_excluded\" IN (0, 1)), \"media_send_counter\" INTEGER NOT NULL DEFAULT 0, \"media_received_counter\" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (\"user_id\"));" - } - ] - }, - { - "name": "groups", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"groups\" (\"group_id\" TEXT NOT NULL, \"is_group_admin\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_group_admin\" IN (0, 1)), \"is_direct_chat\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_direct_chat\" IN (0, 1)), \"pinned\" INTEGER NOT NULL DEFAULT 0 CHECK (\"pinned\" IN (0, 1)), \"archived\" INTEGER NOT NULL DEFAULT 0 CHECK (\"archived\" IN (0, 1)), \"joined_group\" INTEGER NOT NULL DEFAULT 0 CHECK (\"joined_group\" IN (0, 1)), \"left_group\" INTEGER NOT NULL DEFAULT 0 CHECK (\"left_group\" IN (0, 1)), \"deleted_content\" INTEGER NOT NULL DEFAULT 0 CHECK (\"deleted_content\" IN (0, 1)), \"state_version_id\" INTEGER NOT NULL DEFAULT 0, \"state_encryption_key\" BLOB NULL, \"my_group_private_key\" BLOB NULL, \"group_name\" TEXT NOT NULL, \"draft_message\" TEXT NULL, \"total_media_counter\" INTEGER NOT NULL DEFAULT 0, \"also_best_friend\" INTEGER NOT NULL DEFAULT 0 CHECK (\"also_best_friend\" IN (0, 1)), \"delete_messages_after_milliseconds\" INTEGER NOT NULL DEFAULT 86400000, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"last_message_send\" INTEGER NULL, \"last_message_received\" INTEGER NULL, \"last_flame_counter_change\" INTEGER NULL, \"last_flame_sync\" INTEGER NULL, \"flame_counter\" INTEGER NOT NULL DEFAULT 0, \"max_flame_counter\" INTEGER NOT NULL DEFAULT 0, \"max_flame_counter_from\" INTEGER NULL, \"last_message_exchange\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_id\"));" - } - ] - }, - { - "name": "media_files", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"media_files\" (\"media_id\" TEXT NOT NULL, \"type\" TEXT NOT NULL, \"upload_state\" TEXT NULL, \"download_state\" TEXT NULL, \"requires_authentication\" INTEGER NOT NULL DEFAULT 0 CHECK (\"requires_authentication\" IN (0, 1)), \"stored\" INTEGER NOT NULL DEFAULT 0 CHECK (\"stored\" IN (0, 1)), \"is_draft_media\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_draft_media\" IN (0, 1)), \"pre_progressing_process\" INTEGER NULL, \"reupload_requested_by\" TEXT NULL, \"display_limit_in_milliseconds\" INTEGER NULL, \"remove_audio\" INTEGER NULL CHECK (\"remove_audio\" IN (0, 1)), \"download_token\" BLOB NULL, \"encryption_key\" BLOB NULL, \"encryption_mac\" BLOB NULL, \"encryption_nonce\" BLOB NULL, \"stored_file_hash\" BLOB NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"media_id\"));" - } - ] - }, - { - "name": "messages", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"messages\" (\"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"message_id\" TEXT NOT NULL, \"sender_id\" INTEGER NULL REFERENCES contacts (user_id), \"type\" TEXT NOT NULL, \"content\" TEXT NULL, \"media_id\" TEXT NULL REFERENCES media_files (media_id) ON DELETE SET NULL, \"additional_message_data\" BLOB NULL, \"media_stored\" INTEGER NOT NULL DEFAULT 0 CHECK (\"media_stored\" IN (0, 1)), \"media_reopened\" INTEGER NOT NULL DEFAULT 0 CHECK (\"media_reopened\" IN (0, 1)), \"download_token\" BLOB NULL, \"quotes_message_id\" TEXT NULL, \"is_deleted_from_sender\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_deleted_from_sender\" IN (0, 1)), \"opened_at\" INTEGER NULL, \"opened_by_all\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), \"modified_at\" INTEGER NULL, \"ack_by_user\" INTEGER NULL, \"ack_by_server\" INTEGER NULL, PRIMARY KEY (\"message_id\"));" - } - ] - }, - { - "name": "message_histories", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"message_histories\" (\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"content\" TEXT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)));" - } - ] - }, - { - "name": "reactions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"reactions\" (\"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"emoji\" TEXT NOT NULL, \"sender_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"message_id\", \"sender_id\", \"emoji\"));" - } - ] - }, - { - "name": "group_members", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"group_members\" (\"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id), \"member_state\" TEXT NULL, \"group_public_key\" BLOB NULL, \"last_chat_opened\" INTEGER NULL, \"last_type_indicator\" INTEGER NULL, \"last_message\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_id\", \"contact_id\"));" - } - ] - }, - { - "name": "receipts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"receipts\" (\"receipt_id\" TEXT NOT NULL, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"message_id\" TEXT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"message\" BLOB NOT NULL, \"contact_will_sends_receipt\" INTEGER NOT NULL DEFAULT 1 CHECK (\"contact_will_sends_receipt\" IN (0, 1)), \"will_be_retried_by_media_upload\" INTEGER NOT NULL DEFAULT 0 CHECK (\"will_be_retried_by_media_upload\" IN (0, 1)), \"mark_for_retry\" INTEGER NULL, \"mark_for_retry_after_accepted\" INTEGER NULL, \"ack_by_server_at\" INTEGER NULL, \"retry_count\" INTEGER NOT NULL DEFAULT 0, \"last_retry\" INTEGER NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"receipt_id\"));" - } - ] - }, - { - "name": "received_receipts", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"received_receipts\" (\"receipt_id\" TEXT NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"receipt_id\"));" - } - ] - }, - { - "name": "signal_identity_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_identity_key_stores\" (\"device_id\" INTEGER NOT NULL, \"name\" TEXT NOT NULL, \"identity_key\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"device_id\", \"name\"));" - } - ] - }, - { - "name": "signal_pre_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_pre_key_stores\" (\"pre_key_id\" INTEGER NOT NULL, \"pre_key\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"pre_key_id\"));" - } - ] - }, - { - "name": "signal_sender_key_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_sender_key_stores\" (\"sender_key_name\" TEXT NOT NULL, \"sender_key\" BLOB NOT NULL, PRIMARY KEY (\"sender_key_name\"));" - } - ] - }, - { - "name": "signal_session_stores", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"signal_session_stores\" (\"device_id\" INTEGER NOT NULL, \"name\" TEXT NOT NULL, \"session_record\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"device_id\", \"name\"));" - } - ] - }, - { - "name": "message_actions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"message_actions\" (\"message_id\" TEXT NOT NULL REFERENCES messages (message_id) ON DELETE CASCADE, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"type\" TEXT NOT NULL, \"action_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"message_id\", \"contact_id\", \"type\"));" - } - ] - }, - { - "name": "group_histories", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"group_histories\" (\"group_history_id\" TEXT NOT NULL, \"group_id\" TEXT NOT NULL REFERENCES \"groups\" (group_id) ON DELETE CASCADE, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id), \"affected_contact_id\" INTEGER NULL, \"old_group_name\" TEXT NULL, \"new_group_name\" TEXT NULL, \"new_delete_messages_after_milliseconds\" INTEGER NULL, \"type\" TEXT NOT NULL, \"action_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"group_history_id\"));" - } - ] - }, - { - "name": "key_verifications", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"key_verifications\" (\"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"type\" TEXT NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)), PRIMARY KEY (\"contact_id\"));" - } - ] - }, - { - "name": "verification_tokens", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"verification_tokens\" (\"token_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"token\" BLOB NOT NULL, \"created_at\" INTEGER NOT NULL DEFAULT (CAST(strftime('%s', CURRENT_TIMESTAMP) AS INTEGER)));" - } - ] - }, - { - "name": "user_discovery_announced_users", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_announced_users\" (\"announced_user_id\" INTEGER NOT NULL, \"announced_public_key\" BLOB NOT NULL, \"public_id\" INTEGER NOT NULL UNIQUE, \"username\" TEXT NULL, \"was_shown_to_the_user\" INTEGER NOT NULL DEFAULT 0 CHECK (\"was_shown_to_the_user\" IN (0, 1)), \"is_hidden\" INTEGER NOT NULL DEFAULT 0 CHECK (\"is_hidden\" IN (0, 1)), PRIMARY KEY (\"announced_user_id\"));" - } - ] - }, - { - "name": "user_discovery_user_relations", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_user_relations\" (\"announced_user_id\" INTEGER NOT NULL REFERENCES user_discovery_announced_users (announced_user_id) ON DELETE CASCADE, \"from_contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"public_key_verified_timestamp\" INTEGER NULL, PRIMARY KEY (\"announced_user_id\", \"from_contact_id\"));" - } - ] - }, - { - "name": "user_discovery_other_promotions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_other_promotions\" (\"from_contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"promotion_id\" INTEGER NOT NULL, \"public_id\" INTEGER NOT NULL, \"threshold\" INTEGER NOT NULL, \"announcement_share\" BLOB NOT NULL, \"public_key_verified_timestamp\" INTEGER NULL, PRIMARY KEY (\"from_contact_id\", \"promotion_id\"));" - } - ] - }, - { - "name": "user_discovery_own_promotions", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_own_promotions\" (\"version_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"contact_id\" INTEGER NOT NULL REFERENCES contacts (user_id) ON DELETE CASCADE, \"promotion\" BLOB NOT NULL);" - } - ] - }, - { - "name": "user_discovery_shares", - "sql": [ - { - "dialect": "sqlite", - "sql": "CREATE TABLE IF NOT EXISTS \"user_discovery_shares\" (\"share_id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"share\" BLOB NOT NULL, \"contact_id\" INTEGER NULL REFERENCES contacts (user_id) ON DELETE CASCADE);" - } - ] - } - ] -} \ No newline at end of file diff --git a/lib/src/database/tables/user_discovery.table.dart b/lib/src/database/tables/user_discovery.table.dart index 2e609ed0..d4cdb6ac 100644 --- a/lib/src/database/tables/user_discovery.table.dart +++ b/lib/src/database/tables/user_discovery.table.dart @@ -70,7 +70,7 @@ class UserDiscoveryOtherPromotions extends Table { DateTimeColumn get publicKeyVerifiedTimestamp => dateTime().nullable()(); @override - Set get primaryKey => {fromContactId, promotionId}; + Set get primaryKey => {fromContactId, publicId}; } // unused_shares: Vec>, diff --git a/lib/src/database/twonly.db.dart b/lib/src/database/twonly.db.dart index 0637da65..0605d560 100644 --- a/lib/src/database/twonly.db.dart +++ b/lib/src/database/twonly.db.dart @@ -72,7 +72,7 @@ class TwonlyDB extends _$TwonlyDB { TwonlyDB.forTesting(DatabaseConnection super.connection); @override - int get schemaVersion => 15; + int get schemaVersion => 12; static QueryExecutor _openConnection() { return driftDatabase( @@ -177,8 +177,6 @@ class TwonlyDB extends _$TwonlyDB { schema.contacts, schema.contacts.userDiscoveryVersion, ); - }, - from12To13: (m, schema) async { await m.addColumn( schema.contacts, schema.contacts.mediaReceivedCounter, @@ -187,22 +185,6 @@ class TwonlyDB extends _$TwonlyDB { schema.contacts, schema.contacts.mediaSendCounter, ); - }, - from13To14: (m, schema) async { - await m.addColumn( - schema.userDiscoveryAnnouncedUsers, - schema.userDiscoveryAnnouncedUsers.wasShownToTheUser, - ); - await m.addColumn( - schema.userDiscoveryAnnouncedUsers, - schema.userDiscoveryAnnouncedUsers.isHidden, - ); - await m.addColumn( - schema.userDiscoveryAnnouncedUsers, - schema.userDiscoveryAnnouncedUsers.username, - ); - }, - from14To15: (m, schema) async { await m.addColumn( schema.contacts, schema.contacts.userDiscoveryExcluded, diff --git a/lib/src/database/twonly.db.g.dart b/lib/src/database/twonly.db.g.dart index b96d34b3..b9a7bddf 100644 --- a/lib/src/database/twonly.db.g.dart +++ b/lib/src/database/twonly.db.g.dart @@ -10478,7 +10478,7 @@ class $UserDiscoveryOtherPromotionsTable extends UserDiscoveryOtherPromotions } @override - Set get $primaryKey => {fromContactId, promotionId}; + Set get $primaryKey => {fromContactId, publicId}; @override UserDiscoveryOtherPromotion map( Map data, { diff --git a/lib/src/database/twonly.db.steps.dart b/lib/src/database/twonly.db.steps.dart index 2e3cd646..b7b06c99 100644 --- a/lib/src/database/twonly.db.steps.dart +++ b/lib/src/database/twonly.db.steps.dart @@ -5872,6 +5872,9 @@ final class Schema12 extends i0.VersionedSchema { _column_117, _column_118, _column_211, + _column_212, + _column_213, + _column_214, ], attachedDatabase: database, ), @@ -6149,7 +6152,7 @@ final class Schema12 extends i0.VersionedSchema { withoutRowId: false, isStrict: false, tableConstraints: [], - columns: [_column_212, _column_213, _column_118], + columns: [_column_215, _column_216, _column_118], attachedDatabase: database, ), alias: null, @@ -6160,7 +6163,14 @@ final class Schema12 extends i0.VersionedSchema { withoutRowId: false, isStrict: false, tableConstraints: ['PRIMARY KEY(announced_user_id)'], - columns: [_column_214, _column_215, _column_216], + columns: [ + _column_217, + _column_218, + _column_219, + _column_220, + _column_221, + _column_222, + ], attachedDatabase: database, ), alias: null, @@ -6171,7 +6181,7 @@ final class Schema12 extends i0.VersionedSchema { withoutRowId: false, isStrict: false, tableConstraints: ['PRIMARY KEY(announced_user_id, from_contact_id)'], - columns: [_column_217, _column_218, _column_219], + columns: [_column_223, _column_224, _column_225], attachedDatabase: database, ), alias: null, @@ -6181,14 +6191,14 @@ final class Schema12 extends i0.VersionedSchema { entityName: 'user_discovery_other_promotions', withoutRowId: false, isStrict: false, - tableConstraints: ['PRIMARY KEY(from_contact_id, promotion_id)'], + tableConstraints: ['PRIMARY KEY(from_contact_id, public_id)'], columns: [ - _column_218, - _column_220, - _column_221, - _column_222, - _column_223, - _column_219, + _column_224, + _column_226, + _column_227, + _column_228, + _column_229, + _column_225, ], attachedDatabase: database, ), @@ -6200,7 +6210,7 @@ final class Schema12 extends i0.VersionedSchema { withoutRowId: false, isStrict: false, tableConstraints: [], - columns: [_column_224, _column_183, _column_225], + columns: [_column_230, _column_183, _column_231], attachedDatabase: database, ), alias: null, @@ -6211,7 +6221,7 @@ final class Schema12 extends i0.VersionedSchema { withoutRowId: false, isStrict: false, tableConstraints: [], - columns: [_column_226, _column_227, _column_175], + columns: [_column_232, _column_233, _column_175], attachedDatabase: database, ), alias: null, @@ -6250,6 +6260,12 @@ class Shape39 extends i0.VersionedTable { i1.GeneratedColumn get userDiscoveryVersion => columnsByName['user_discovery_version']! as i1.GeneratedColumn; + i1.GeneratedColumn get userDiscoveryExcluded => + columnsByName['user_discovery_excluded']! as i1.GeneratedColumn; + i1.GeneratedColumn get mediaSendCounter => + columnsByName['media_send_counter']! as i1.GeneratedColumn; + i1.GeneratedColumn get mediaReceivedCounter => + columnsByName['media_received_counter']! as i1.GeneratedColumn; } i1.GeneratedColumn _column_211(String aliasedName) => @@ -6260,6 +6276,34 @@ i1.GeneratedColumn _column_211(String aliasedName) => type: i1.DriftSqlType.blob, $customConstraints: 'NULL', ); +i1.GeneratedColumn _column_212(String aliasedName) => + i1.GeneratedColumn( + 'user_discovery_excluded', + aliasedName, + false, + type: i1.DriftSqlType.int, + $customConstraints: + 'NOT NULL DEFAULT 0 CHECK (user_discovery_excluded IN (0, 1))', + defaultValue: const i1.CustomExpression('0'), + ); +i1.GeneratedColumn _column_213(String aliasedName) => + i1.GeneratedColumn( + 'media_send_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + $customConstraints: 'NOT NULL DEFAULT 0', + defaultValue: const i1.CustomExpression('0'), + ); +i1.GeneratedColumn _column_214(String aliasedName) => + i1.GeneratedColumn( + 'media_received_counter', + aliasedName, + false, + type: i1.DriftSqlType.int, + $customConstraints: 'NOT NULL DEFAULT 0', + defaultValue: const i1.CustomExpression('0'), + ); class Shape40 extends i0.VersionedTable { Shape40({required super.source, required super.alias}) : super.aliased(); @@ -6281,7 +6325,7 @@ class Shape41 extends i0.VersionedTable { columnsByName['created_at']! as i1.GeneratedColumn; } -i1.GeneratedColumn _column_212(String aliasedName) => +i1.GeneratedColumn _column_215(String aliasedName) => i1.GeneratedColumn( 'token_id', aliasedName, @@ -6290,7 +6334,7 @@ i1.GeneratedColumn _column_212(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT', ); -i1.GeneratedColumn _column_213(String aliasedName) => +i1.GeneratedColumn _column_216(String aliasedName) => i1.GeneratedColumn( 'token', aliasedName, @@ -6308,9 +6352,15 @@ class Shape42 extends i0.VersionedTable { as i1.GeneratedColumn; i1.GeneratedColumn get publicId => columnsByName['public_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get username => + columnsByName['username']! as i1.GeneratedColumn; + i1.GeneratedColumn get wasShownToTheUser => + columnsByName['was_shown_to_the_user']! as i1.GeneratedColumn; + i1.GeneratedColumn get isHidden => + columnsByName['is_hidden']! as i1.GeneratedColumn; } -i1.GeneratedColumn _column_214(String aliasedName) => +i1.GeneratedColumn _column_217(String aliasedName) => i1.GeneratedColumn( 'announced_user_id', aliasedName, @@ -6318,7 +6368,7 @@ i1.GeneratedColumn _column_214(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL', ); -i1.GeneratedColumn _column_215(String aliasedName) => +i1.GeneratedColumn _column_218(String aliasedName) => i1.GeneratedColumn( 'announced_public_key', aliasedName, @@ -6326,7 +6376,7 @@ i1.GeneratedColumn _column_215(String aliasedName) => type: i1.DriftSqlType.blob, $customConstraints: 'NOT NULL', ); -i1.GeneratedColumn _column_216(String aliasedName) => +i1.GeneratedColumn _column_219(String aliasedName) => i1.GeneratedColumn( 'public_id', aliasedName, @@ -6334,6 +6384,33 @@ i1.GeneratedColumn _column_216(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL UNIQUE', ); +i1.GeneratedColumn _column_220(String aliasedName) => + i1.GeneratedColumn( + 'username', + aliasedName, + true, + type: i1.DriftSqlType.string, + $customConstraints: 'NULL', + ); +i1.GeneratedColumn _column_221(String aliasedName) => + i1.GeneratedColumn( + 'was_shown_to_the_user', + aliasedName, + false, + type: i1.DriftSqlType.int, + $customConstraints: + 'NOT NULL DEFAULT 0 CHECK (was_shown_to_the_user IN (0, 1))', + defaultValue: const i1.CustomExpression('0'), + ); +i1.GeneratedColumn _column_222(String aliasedName) => + i1.GeneratedColumn( + 'is_hidden', + aliasedName, + false, + type: i1.DriftSqlType.int, + $customConstraints: 'NOT NULL DEFAULT 0 CHECK (is_hidden IN (0, 1))', + defaultValue: const i1.CustomExpression('0'), + ); class Shape43 extends i0.VersionedTable { Shape43({required super.source, required super.alias}) : super.aliased(); @@ -6346,7 +6423,7 @@ class Shape43 extends i0.VersionedTable { as i1.GeneratedColumn; } -i1.GeneratedColumn _column_217( +i1.GeneratedColumn _column_223( String aliasedName, ) => i1.GeneratedColumn( 'announced_user_id', @@ -6356,7 +6433,7 @@ i1.GeneratedColumn _column_217( $customConstraints: 'NOT NULL REFERENCES user_discovery_announced_users(announced_user_id)ON DELETE CASCADE', ); -i1.GeneratedColumn _column_218(String aliasedName) => +i1.GeneratedColumn _column_224(String aliasedName) => i1.GeneratedColumn( 'from_contact_id', aliasedName, @@ -6365,7 +6442,7 @@ i1.GeneratedColumn _column_218(String aliasedName) => $customConstraints: 'NOT NULL REFERENCES contacts(user_id)ON DELETE CASCADE', ); -i1.GeneratedColumn _column_219(String aliasedName) => +i1.GeneratedColumn _column_225(String aliasedName) => i1.GeneratedColumn( 'public_key_verified_timestamp', aliasedName, @@ -6391,7 +6468,7 @@ class Shape44 extends i0.VersionedTable { as i1.GeneratedColumn; } -i1.GeneratedColumn _column_220(String aliasedName) => +i1.GeneratedColumn _column_226(String aliasedName) => i1.GeneratedColumn( 'promotion_id', aliasedName, @@ -6399,7 +6476,7 @@ i1.GeneratedColumn _column_220(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL', ); -i1.GeneratedColumn _column_221(String aliasedName) => +i1.GeneratedColumn _column_227(String aliasedName) => i1.GeneratedColumn( 'public_id', aliasedName, @@ -6407,7 +6484,7 @@ i1.GeneratedColumn _column_221(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL', ); -i1.GeneratedColumn _column_222(String aliasedName) => +i1.GeneratedColumn _column_228(String aliasedName) => i1.GeneratedColumn( 'threshold', aliasedName, @@ -6415,7 +6492,7 @@ i1.GeneratedColumn _column_222(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL', ); -i1.GeneratedColumn _column_223(String aliasedName) => +i1.GeneratedColumn _column_229(String aliasedName) => i1.GeneratedColumn( 'announcement_share', aliasedName, @@ -6434,7 +6511,7 @@ class Shape45 extends i0.VersionedTable { columnsByName['promotion']! as i1.GeneratedColumn; } -i1.GeneratedColumn _column_224(String aliasedName) => +i1.GeneratedColumn _column_230(String aliasedName) => i1.GeneratedColumn( 'version_id', aliasedName, @@ -6443,7 +6520,7 @@ i1.GeneratedColumn _column_224(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT', ); -i1.GeneratedColumn _column_225(String aliasedName) => +i1.GeneratedColumn _column_231(String aliasedName) => i1.GeneratedColumn( 'promotion', aliasedName, @@ -6462,7 +6539,7 @@ class Shape46 extends i0.VersionedTable { columnsByName['contact_id']! as i1.GeneratedColumn; } -i1.GeneratedColumn _column_226(String aliasedName) => +i1.GeneratedColumn _column_232(String aliasedName) => i1.GeneratedColumn( 'share_id', aliasedName, @@ -6471,7 +6548,7 @@ i1.GeneratedColumn _column_226(String aliasedName) => type: i1.DriftSqlType.int, $customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT', ); -i1.GeneratedColumn _column_227(String aliasedName) => +i1.GeneratedColumn _column_233(String aliasedName) => i1.GeneratedColumn( 'share', aliasedName, @@ -6479,1362 +6556,6 @@ i1.GeneratedColumn _column_227(String aliasedName) => type: i1.DriftSqlType.blob, $customConstraints: 'NOT NULL', ); - -final class Schema13 extends i0.VersionedSchema { - Schema13({required super.database}) : super(version: 13); - @override - late final List entities = [ - contacts, - groups, - mediaFiles, - messages, - messageHistories, - reactions, - groupMembers, - receipts, - receivedReceipts, - signalIdentityKeyStores, - signalPreKeyStores, - signalSenderKeyStores, - signalSessionStores, - messageActions, - groupHistories, - keyVerifications, - verificationTokens, - userDiscoveryAnnouncedUsers, - userDiscoveryUserRelations, - userDiscoveryOtherPromotions, - userDiscoveryOwnPromotions, - userDiscoveryShares, - ]; - late final Shape47 contacts = Shape47( - source: i0.VersionedTable( - entityName: 'contacts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(user_id)'], - columns: [ - _column_106, - _column_107, - _column_108, - _column_109, - _column_110, - _column_111, - _column_112, - _column_113, - _column_114, - _column_115, - _column_116, - _column_117, - _column_118, - _column_211, - _column_228, - _column_229, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape23 groups = Shape23( - source: i0.VersionedTable( - entityName: 'groups', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_id)'], - columns: [ - _column_119, - _column_120, - _column_121, - _column_122, - _column_123, - _column_124, - _column_125, - _column_126, - _column_127, - _column_128, - _column_129, - _column_130, - _column_131, - _column_132, - _column_133, - _column_134, - _column_118, - _column_135, - _column_136, - _column_137, - _column_138, - _column_139, - _column_140, - _column_141, - _column_142, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape36 mediaFiles = Shape36( - source: i0.VersionedTable( - entityName: 'media_files', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(media_id)'], - columns: [ - _column_143, - _column_144, - _column_145, - _column_146, - _column_147, - _column_148, - _column_149, - _column_207, - _column_150, - _column_151, - _column_152, - _column_153, - _column_154, - _column_155, - _column_156, - _column_157, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape25 messages = Shape25( - source: i0.VersionedTable( - entityName: 'messages', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id)'], - columns: [ - _column_158, - _column_159, - _column_160, - _column_144, - _column_161, - _column_162, - _column_163, - _column_164, - _column_165, - _column_153, - _column_166, - _column_167, - _column_168, - _column_169, - _column_118, - _column_170, - _column_171, - _column_172, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape26 messageHistories = Shape26( - source: i0.VersionedTable( - entityName: 'message_histories', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [ - _column_173, - _column_174, - _column_175, - _column_161, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape27 reactions = Shape27( - source: i0.VersionedTable( - entityName: 'reactions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id, sender_id, emoji)'], - columns: [_column_174, _column_176, _column_177, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape38 groupMembers = Shape38( - source: i0.VersionedTable( - entityName: 'group_members', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_id, contact_id)'], - columns: [ - _column_158, - _column_178, - _column_179, - _column_180, - _column_209, - _column_210, - _column_181, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape37 receipts = Shape37( - source: i0.VersionedTable( - entityName: 'receipts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(receipt_id)'], - columns: [ - _column_182, - _column_183, - _column_184, - _column_185, - _column_186, - _column_208, - _column_187, - _column_188, - _column_189, - _column_190, - _column_191, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape30 receivedReceipts = Shape30( - source: i0.VersionedTable( - entityName: 'received_receipts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(receipt_id)'], - columns: [_column_182, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape31 signalIdentityKeyStores = Shape31( - source: i0.VersionedTable( - entityName: 'signal_identity_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(device_id, name)'], - columns: [_column_192, _column_193, _column_194, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape32 signalPreKeyStores = Shape32( - source: i0.VersionedTable( - entityName: 'signal_pre_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(pre_key_id)'], - columns: [_column_195, _column_196, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape11 signalSenderKeyStores = Shape11( - source: i0.VersionedTable( - entityName: 'signal_sender_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(sender_key_name)'], - columns: [_column_197, _column_198], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape33 signalSessionStores = Shape33( - source: i0.VersionedTable( - entityName: 'signal_session_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(device_id, name)'], - columns: [_column_192, _column_193, _column_199, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape34 messageActions = Shape34( - source: i0.VersionedTable( - entityName: 'message_actions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id, contact_id, type)'], - columns: [_column_174, _column_183, _column_144, _column_200], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape35 groupHistories = Shape35( - source: i0.VersionedTable( - entityName: 'group_histories', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_history_id)'], - columns: [ - _column_201, - _column_158, - _column_202, - _column_203, - _column_204, - _column_205, - _column_206, - _column_144, - _column_200, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape40 keyVerifications = Shape40( - source: i0.VersionedTable( - entityName: 'key_verifications', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(contact_id)'], - columns: [_column_183, _column_144, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape41 verificationTokens = Shape41( - source: i0.VersionedTable( - entityName: 'verification_tokens', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_212, _column_213, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape42 userDiscoveryAnnouncedUsers = Shape42( - source: i0.VersionedTable( - entityName: 'user_discovery_announced_users', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(announced_user_id)'], - columns: [_column_214, _column_215, _column_216], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape43 userDiscoveryUserRelations = Shape43( - source: i0.VersionedTable( - entityName: 'user_discovery_user_relations', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(announced_user_id, from_contact_id)'], - columns: [_column_217, _column_218, _column_219], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape44 userDiscoveryOtherPromotions = Shape44( - source: i0.VersionedTable( - entityName: 'user_discovery_other_promotions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(from_contact_id, promotion_id)'], - columns: [ - _column_218, - _column_220, - _column_221, - _column_222, - _column_223, - _column_219, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape45 userDiscoveryOwnPromotions = Shape45( - source: i0.VersionedTable( - entityName: 'user_discovery_own_promotions', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_224, _column_183, _column_225], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape46 userDiscoveryShares = Shape46( - source: i0.VersionedTable( - entityName: 'user_discovery_shares', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_226, _column_227, _column_175], - attachedDatabase: database, - ), - alias: null, - ); -} - -class Shape47 extends i0.VersionedTable { - Shape47({required super.source, required super.alias}) : super.aliased(); - i1.GeneratedColumn get userId => - columnsByName['user_id']! as i1.GeneratedColumn; - i1.GeneratedColumn get username => - columnsByName['username']! as i1.GeneratedColumn; - i1.GeneratedColumn get displayName => - columnsByName['display_name']! as i1.GeneratedColumn; - i1.GeneratedColumn get nickName => - columnsByName['nick_name']! as i1.GeneratedColumn; - i1.GeneratedColumn get avatarSvgCompressed => - columnsByName['avatar_svg_compressed']! - as i1.GeneratedColumn; - i1.GeneratedColumn get senderProfileCounter => - columnsByName['sender_profile_counter']! as i1.GeneratedColumn; - i1.GeneratedColumn get accepted => - columnsByName['accepted']! as i1.GeneratedColumn; - i1.GeneratedColumn get deletedByUser => - columnsByName['deleted_by_user']! as i1.GeneratedColumn; - i1.GeneratedColumn get requested => - columnsByName['requested']! as i1.GeneratedColumn; - i1.GeneratedColumn get blocked => - columnsByName['blocked']! as i1.GeneratedColumn; - i1.GeneratedColumn get verified => - columnsByName['verified']! as i1.GeneratedColumn; - i1.GeneratedColumn get accountDeleted => - columnsByName['account_deleted']! as i1.GeneratedColumn; - i1.GeneratedColumn get createdAt => - columnsByName['created_at']! as i1.GeneratedColumn; - i1.GeneratedColumn get userDiscoveryVersion => - columnsByName['user_discovery_version']! - as i1.GeneratedColumn; - i1.GeneratedColumn get mediaSendCounter => - columnsByName['media_send_counter']! as i1.GeneratedColumn; - i1.GeneratedColumn get mediaReceivedCounter => - columnsByName['media_received_counter']! as i1.GeneratedColumn; -} - -i1.GeneratedColumn _column_228(String aliasedName) => - i1.GeneratedColumn( - 'media_send_counter', - aliasedName, - false, - type: i1.DriftSqlType.int, - $customConstraints: 'NOT NULL DEFAULT 0', - defaultValue: const i1.CustomExpression('0'), - ); -i1.GeneratedColumn _column_229(String aliasedName) => - i1.GeneratedColumn( - 'media_received_counter', - aliasedName, - false, - type: i1.DriftSqlType.int, - $customConstraints: 'NOT NULL DEFAULT 0', - defaultValue: const i1.CustomExpression('0'), - ); - -final class Schema14 extends i0.VersionedSchema { - Schema14({required super.database}) : super(version: 14); - @override - late final List entities = [ - contacts, - groups, - mediaFiles, - messages, - messageHistories, - reactions, - groupMembers, - receipts, - receivedReceipts, - signalIdentityKeyStores, - signalPreKeyStores, - signalSenderKeyStores, - signalSessionStores, - messageActions, - groupHistories, - keyVerifications, - verificationTokens, - userDiscoveryAnnouncedUsers, - userDiscoveryUserRelations, - userDiscoveryOtherPromotions, - userDiscoveryOwnPromotions, - userDiscoveryShares, - ]; - late final Shape47 contacts = Shape47( - source: i0.VersionedTable( - entityName: 'contacts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(user_id)'], - columns: [ - _column_106, - _column_107, - _column_108, - _column_109, - _column_110, - _column_111, - _column_112, - _column_113, - _column_114, - _column_115, - _column_116, - _column_117, - _column_118, - _column_211, - _column_228, - _column_229, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape23 groups = Shape23( - source: i0.VersionedTable( - entityName: 'groups', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_id)'], - columns: [ - _column_119, - _column_120, - _column_121, - _column_122, - _column_123, - _column_124, - _column_125, - _column_126, - _column_127, - _column_128, - _column_129, - _column_130, - _column_131, - _column_132, - _column_133, - _column_134, - _column_118, - _column_135, - _column_136, - _column_137, - _column_138, - _column_139, - _column_140, - _column_141, - _column_142, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape36 mediaFiles = Shape36( - source: i0.VersionedTable( - entityName: 'media_files', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(media_id)'], - columns: [ - _column_143, - _column_144, - _column_145, - _column_146, - _column_147, - _column_148, - _column_149, - _column_207, - _column_150, - _column_151, - _column_152, - _column_153, - _column_154, - _column_155, - _column_156, - _column_157, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape25 messages = Shape25( - source: i0.VersionedTable( - entityName: 'messages', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id)'], - columns: [ - _column_158, - _column_159, - _column_160, - _column_144, - _column_161, - _column_162, - _column_163, - _column_164, - _column_165, - _column_153, - _column_166, - _column_167, - _column_168, - _column_169, - _column_118, - _column_170, - _column_171, - _column_172, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape26 messageHistories = Shape26( - source: i0.VersionedTable( - entityName: 'message_histories', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [ - _column_173, - _column_174, - _column_175, - _column_161, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape27 reactions = Shape27( - source: i0.VersionedTable( - entityName: 'reactions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id, sender_id, emoji)'], - columns: [_column_174, _column_176, _column_177, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape38 groupMembers = Shape38( - source: i0.VersionedTable( - entityName: 'group_members', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_id, contact_id)'], - columns: [ - _column_158, - _column_178, - _column_179, - _column_180, - _column_209, - _column_210, - _column_181, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape37 receipts = Shape37( - source: i0.VersionedTable( - entityName: 'receipts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(receipt_id)'], - columns: [ - _column_182, - _column_183, - _column_184, - _column_185, - _column_186, - _column_208, - _column_187, - _column_188, - _column_189, - _column_190, - _column_191, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape30 receivedReceipts = Shape30( - source: i0.VersionedTable( - entityName: 'received_receipts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(receipt_id)'], - columns: [_column_182, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape31 signalIdentityKeyStores = Shape31( - source: i0.VersionedTable( - entityName: 'signal_identity_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(device_id, name)'], - columns: [_column_192, _column_193, _column_194, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape32 signalPreKeyStores = Shape32( - source: i0.VersionedTable( - entityName: 'signal_pre_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(pre_key_id)'], - columns: [_column_195, _column_196, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape11 signalSenderKeyStores = Shape11( - source: i0.VersionedTable( - entityName: 'signal_sender_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(sender_key_name)'], - columns: [_column_197, _column_198], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape33 signalSessionStores = Shape33( - source: i0.VersionedTable( - entityName: 'signal_session_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(device_id, name)'], - columns: [_column_192, _column_193, _column_199, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape34 messageActions = Shape34( - source: i0.VersionedTable( - entityName: 'message_actions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id, contact_id, type)'], - columns: [_column_174, _column_183, _column_144, _column_200], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape35 groupHistories = Shape35( - source: i0.VersionedTable( - entityName: 'group_histories', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_history_id)'], - columns: [ - _column_201, - _column_158, - _column_202, - _column_203, - _column_204, - _column_205, - _column_206, - _column_144, - _column_200, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape40 keyVerifications = Shape40( - source: i0.VersionedTable( - entityName: 'key_verifications', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(contact_id)'], - columns: [_column_183, _column_144, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape41 verificationTokens = Shape41( - source: i0.VersionedTable( - entityName: 'verification_tokens', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_212, _column_213, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape48 userDiscoveryAnnouncedUsers = Shape48( - source: i0.VersionedTable( - entityName: 'user_discovery_announced_users', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(announced_user_id)'], - columns: [ - _column_214, - _column_215, - _column_216, - _column_230, - _column_231, - _column_232, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape43 userDiscoveryUserRelations = Shape43( - source: i0.VersionedTable( - entityName: 'user_discovery_user_relations', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(announced_user_id, from_contact_id)'], - columns: [_column_217, _column_218, _column_219], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape44 userDiscoveryOtherPromotions = Shape44( - source: i0.VersionedTable( - entityName: 'user_discovery_other_promotions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(from_contact_id, promotion_id)'], - columns: [ - _column_218, - _column_220, - _column_221, - _column_222, - _column_223, - _column_219, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape45 userDiscoveryOwnPromotions = Shape45( - source: i0.VersionedTable( - entityName: 'user_discovery_own_promotions', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_224, _column_183, _column_225], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape46 userDiscoveryShares = Shape46( - source: i0.VersionedTable( - entityName: 'user_discovery_shares', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_226, _column_227, _column_175], - attachedDatabase: database, - ), - alias: null, - ); -} - -class Shape48 extends i0.VersionedTable { - Shape48({required super.source, required super.alias}) : super.aliased(); - i1.GeneratedColumn get announcedUserId => - columnsByName['announced_user_id']! as i1.GeneratedColumn; - i1.GeneratedColumn get announcedPublicKey => - columnsByName['announced_public_key']! - as i1.GeneratedColumn; - i1.GeneratedColumn get publicId => - columnsByName['public_id']! as i1.GeneratedColumn; - i1.GeneratedColumn get username => - columnsByName['username']! as i1.GeneratedColumn; - i1.GeneratedColumn get wasShownToTheUser => - columnsByName['was_shown_to_the_user']! as i1.GeneratedColumn; - i1.GeneratedColumn get isHidden => - columnsByName['is_hidden']! as i1.GeneratedColumn; -} - -i1.GeneratedColumn _column_230(String aliasedName) => - i1.GeneratedColumn( - 'username', - aliasedName, - true, - type: i1.DriftSqlType.string, - $customConstraints: 'NULL', - ); -i1.GeneratedColumn _column_231(String aliasedName) => - i1.GeneratedColumn( - 'was_shown_to_the_user', - aliasedName, - false, - type: i1.DriftSqlType.int, - $customConstraints: - 'NOT NULL DEFAULT 0 CHECK (was_shown_to_the_user IN (0, 1))', - defaultValue: const i1.CustomExpression('0'), - ); -i1.GeneratedColumn _column_232(String aliasedName) => - i1.GeneratedColumn( - 'is_hidden', - aliasedName, - false, - type: i1.DriftSqlType.int, - $customConstraints: 'NOT NULL DEFAULT 0 CHECK (is_hidden IN (0, 1))', - defaultValue: const i1.CustomExpression('0'), - ); - -final class Schema15 extends i0.VersionedSchema { - Schema15({required super.database}) : super(version: 15); - @override - late final List entities = [ - contacts, - groups, - mediaFiles, - messages, - messageHistories, - reactions, - groupMembers, - receipts, - receivedReceipts, - signalIdentityKeyStores, - signalPreKeyStores, - signalSenderKeyStores, - signalSessionStores, - messageActions, - groupHistories, - keyVerifications, - verificationTokens, - userDiscoveryAnnouncedUsers, - userDiscoveryUserRelations, - userDiscoveryOtherPromotions, - userDiscoveryOwnPromotions, - userDiscoveryShares, - ]; - late final Shape49 contacts = Shape49( - source: i0.VersionedTable( - entityName: 'contacts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(user_id)'], - columns: [ - _column_106, - _column_107, - _column_108, - _column_109, - _column_110, - _column_111, - _column_112, - _column_113, - _column_114, - _column_115, - _column_116, - _column_117, - _column_118, - _column_211, - _column_233, - _column_228, - _column_229, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape23 groups = Shape23( - source: i0.VersionedTable( - entityName: 'groups', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_id)'], - columns: [ - _column_119, - _column_120, - _column_121, - _column_122, - _column_123, - _column_124, - _column_125, - _column_126, - _column_127, - _column_128, - _column_129, - _column_130, - _column_131, - _column_132, - _column_133, - _column_134, - _column_118, - _column_135, - _column_136, - _column_137, - _column_138, - _column_139, - _column_140, - _column_141, - _column_142, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape36 mediaFiles = Shape36( - source: i0.VersionedTable( - entityName: 'media_files', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(media_id)'], - columns: [ - _column_143, - _column_144, - _column_145, - _column_146, - _column_147, - _column_148, - _column_149, - _column_207, - _column_150, - _column_151, - _column_152, - _column_153, - _column_154, - _column_155, - _column_156, - _column_157, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape25 messages = Shape25( - source: i0.VersionedTable( - entityName: 'messages', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id)'], - columns: [ - _column_158, - _column_159, - _column_160, - _column_144, - _column_161, - _column_162, - _column_163, - _column_164, - _column_165, - _column_153, - _column_166, - _column_167, - _column_168, - _column_169, - _column_118, - _column_170, - _column_171, - _column_172, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape26 messageHistories = Shape26( - source: i0.VersionedTable( - entityName: 'message_histories', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [ - _column_173, - _column_174, - _column_175, - _column_161, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape27 reactions = Shape27( - source: i0.VersionedTable( - entityName: 'reactions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id, sender_id, emoji)'], - columns: [_column_174, _column_176, _column_177, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape38 groupMembers = Shape38( - source: i0.VersionedTable( - entityName: 'group_members', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_id, contact_id)'], - columns: [ - _column_158, - _column_178, - _column_179, - _column_180, - _column_209, - _column_210, - _column_181, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape37 receipts = Shape37( - source: i0.VersionedTable( - entityName: 'receipts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(receipt_id)'], - columns: [ - _column_182, - _column_183, - _column_184, - _column_185, - _column_186, - _column_208, - _column_187, - _column_188, - _column_189, - _column_190, - _column_191, - _column_118, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape30 receivedReceipts = Shape30( - source: i0.VersionedTable( - entityName: 'received_receipts', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(receipt_id)'], - columns: [_column_182, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape31 signalIdentityKeyStores = Shape31( - source: i0.VersionedTable( - entityName: 'signal_identity_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(device_id, name)'], - columns: [_column_192, _column_193, _column_194, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape32 signalPreKeyStores = Shape32( - source: i0.VersionedTable( - entityName: 'signal_pre_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(pre_key_id)'], - columns: [_column_195, _column_196, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape11 signalSenderKeyStores = Shape11( - source: i0.VersionedTable( - entityName: 'signal_sender_key_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(sender_key_name)'], - columns: [_column_197, _column_198], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape33 signalSessionStores = Shape33( - source: i0.VersionedTable( - entityName: 'signal_session_stores', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(device_id, name)'], - columns: [_column_192, _column_193, _column_199, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape34 messageActions = Shape34( - source: i0.VersionedTable( - entityName: 'message_actions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(message_id, contact_id, type)'], - columns: [_column_174, _column_183, _column_144, _column_200], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape35 groupHistories = Shape35( - source: i0.VersionedTable( - entityName: 'group_histories', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(group_history_id)'], - columns: [ - _column_201, - _column_158, - _column_202, - _column_203, - _column_204, - _column_205, - _column_206, - _column_144, - _column_200, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape40 keyVerifications = Shape40( - source: i0.VersionedTable( - entityName: 'key_verifications', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(contact_id)'], - columns: [_column_183, _column_144, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape41 verificationTokens = Shape41( - source: i0.VersionedTable( - entityName: 'verification_tokens', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_212, _column_213, _column_118], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape48 userDiscoveryAnnouncedUsers = Shape48( - source: i0.VersionedTable( - entityName: 'user_discovery_announced_users', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(announced_user_id)'], - columns: [ - _column_214, - _column_215, - _column_216, - _column_230, - _column_231, - _column_232, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape43 userDiscoveryUserRelations = Shape43( - source: i0.VersionedTable( - entityName: 'user_discovery_user_relations', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(announced_user_id, from_contact_id)'], - columns: [_column_217, _column_218, _column_219], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape44 userDiscoveryOtherPromotions = Shape44( - source: i0.VersionedTable( - entityName: 'user_discovery_other_promotions', - withoutRowId: false, - isStrict: false, - tableConstraints: ['PRIMARY KEY(from_contact_id, promotion_id)'], - columns: [ - _column_218, - _column_220, - _column_221, - _column_222, - _column_223, - _column_219, - ], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape45 userDiscoveryOwnPromotions = Shape45( - source: i0.VersionedTable( - entityName: 'user_discovery_own_promotions', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_224, _column_183, _column_225], - attachedDatabase: database, - ), - alias: null, - ); - late final Shape46 userDiscoveryShares = Shape46( - source: i0.VersionedTable( - entityName: 'user_discovery_shares', - withoutRowId: false, - isStrict: false, - tableConstraints: [], - columns: [_column_226, _column_227, _column_175], - attachedDatabase: database, - ), - alias: null, - ); -} - -class Shape49 extends i0.VersionedTable { - Shape49({required super.source, required super.alias}) : super.aliased(); - i1.GeneratedColumn get userId => - columnsByName['user_id']! as i1.GeneratedColumn; - i1.GeneratedColumn get username => - columnsByName['username']! as i1.GeneratedColumn; - i1.GeneratedColumn get displayName => - columnsByName['display_name']! as i1.GeneratedColumn; - i1.GeneratedColumn get nickName => - columnsByName['nick_name']! as i1.GeneratedColumn; - i1.GeneratedColumn get avatarSvgCompressed => - columnsByName['avatar_svg_compressed']! - as i1.GeneratedColumn; - i1.GeneratedColumn get senderProfileCounter => - columnsByName['sender_profile_counter']! as i1.GeneratedColumn; - i1.GeneratedColumn get accepted => - columnsByName['accepted']! as i1.GeneratedColumn; - i1.GeneratedColumn get deletedByUser => - columnsByName['deleted_by_user']! as i1.GeneratedColumn; - i1.GeneratedColumn get requested => - columnsByName['requested']! as i1.GeneratedColumn; - i1.GeneratedColumn get blocked => - columnsByName['blocked']! as i1.GeneratedColumn; - i1.GeneratedColumn get verified => - columnsByName['verified']! as i1.GeneratedColumn; - i1.GeneratedColumn get accountDeleted => - columnsByName['account_deleted']! as i1.GeneratedColumn; - i1.GeneratedColumn get createdAt => - columnsByName['created_at']! as i1.GeneratedColumn; - i1.GeneratedColumn get userDiscoveryVersion => - columnsByName['user_discovery_version']! - as i1.GeneratedColumn; - i1.GeneratedColumn get userDiscoveryExcluded => - columnsByName['user_discovery_excluded']! as i1.GeneratedColumn; - i1.GeneratedColumn get mediaSendCounter => - columnsByName['media_send_counter']! as i1.GeneratedColumn; - i1.GeneratedColumn get mediaReceivedCounter => - columnsByName['media_received_counter']! as i1.GeneratedColumn; -} - -i1.GeneratedColumn _column_233(String aliasedName) => - i1.GeneratedColumn( - 'user_discovery_excluded', - aliasedName, - false, - type: i1.DriftSqlType.int, - $customConstraints: - 'NOT NULL DEFAULT 0 CHECK (user_discovery_excluded IN (0, 1))', - defaultValue: const i1.CustomExpression('0'), - ); i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema2 schema) from1To2, required Future Function(i1.Migrator m, Schema3 schema) from2To3, @@ -7847,9 +6568,6 @@ i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema10 schema) from9To10, required Future Function(i1.Migrator m, Schema11 schema) from10To11, required Future Function(i1.Migrator m, Schema12 schema) from11To12, - required Future Function(i1.Migrator m, Schema13 schema) from12To13, - required Future Function(i1.Migrator m, Schema14 schema) from13To14, - required Future Function(i1.Migrator m, Schema15 schema) from14To15, }) { return (currentVersion, database) async { switch (currentVersion) { @@ -7908,21 +6626,6 @@ i0.MigrationStepWithVersion migrationSteps({ final migrator = i1.Migrator(database, schema); await from11To12(migrator, schema); return 12; - case 12: - final schema = Schema13(database: database); - final migrator = i1.Migrator(database, schema); - await from12To13(migrator, schema); - return 13; - case 13: - final schema = Schema14(database: database); - final migrator = i1.Migrator(database, schema); - await from13To14(migrator, schema); - return 14; - case 14: - final schema = Schema15(database: database); - final migrator = i1.Migrator(database, schema); - await from14To15(migrator, schema); - return 15; default: throw ArgumentError.value('Unknown migration from $currentVersion'); } @@ -7941,9 +6644,6 @@ i1.OnUpgrade stepByStep({ required Future Function(i1.Migrator m, Schema10 schema) from9To10, required Future Function(i1.Migrator m, Schema11 schema) from10To11, required Future Function(i1.Migrator m, Schema12 schema) from11To12, - required Future Function(i1.Migrator m, Schema13 schema) from12To13, - required Future Function(i1.Migrator m, Schema14 schema) from13To14, - required Future Function(i1.Migrator m, Schema15 schema) from14To15, }) => i0.VersionedSchema.stepByStepHelper( step: migrationSteps( from1To2: from1To2, @@ -7957,8 +6657,5 @@ i1.OnUpgrade stepByStep({ from9To10: from9To10, from10To11: from10To11, from11To12: from11To12, - from12To13: from12To13, - from13To14: from13To14, - from14To15: from14To15, ), ); diff --git a/rust/src/bridge/callbacks.rs b/rust/src/bridge/callbacks.rs index 297ccb90..bdfa9aab 100644 --- a/rust/src/bridge/callbacks.rs +++ b/rust/src/bridge/callbacks.rs @@ -28,7 +28,7 @@ callback_generator! { // UserDiscoveryStore set_shares: (Vec>) => bool, get_share_for_contact: (i64) => Option>, - push_own_promotion: (i64, i64, Vec) => bool, + push_own_promotion_and_clear_old_version: (i64, i64, Vec) => bool, get_own_promotions_after_version: (i64) => Option>>, store_other_promotion: (OtherPromotion) => bool, get_other_promotions_by_public_id: (i64) => Option>, diff --git a/rust/src/bridge/callbacks/user_discovery.rs b/rust/src/bridge/callbacks/user_discovery.rs index b10fb247..dfa7cc0d 100644 --- a/rust/src/bridge/callbacks/user_discovery.rs +++ b/rust/src/bridge/callbacks/user_discovery.rs @@ -79,13 +79,13 @@ impl UserDiscoveryStore for UserDiscoveryStoreFlutter { } } - async fn push_own_promotion( + async fn push_own_promotion_and_clear_old_version( &self, contact_id: i64, version: u32, promotion: Vec, ) -> Result<()> { - (get_callbacks()?.user_discovery.push_own_promotion)(contact_id, version as i64, promotion) + (get_callbacks()?.user_discovery.push_own_promotion_and_clear_old_version)(contact_id, version as i64, promotion) .await .then_some(()) .ok_or(TwonlyError::DartError.into()) diff --git a/rust/src/frb_generated.rs b/rust/src/frb_generated.rs index f45a72af..96963de4 100644 --- a/rust/src/frb_generated.rs +++ b/rust/src/frb_generated.rs @@ -141,7 +141,7 @@ let api_user_discovery_verify_signature = decode_DartFn_Inputs_list_prim_u_8_str let api_user_discovery_verify_stored_pubkey = decode_DartFn_Inputs_i_64_list_prim_u_8_strict_Output_bool_AnyhowException(::sse_decode(&mut deserializer)); let api_user_discovery_set_shares = decode_DartFn_Inputs_list_list_prim_u_8_strict_Output_bool_AnyhowException(::sse_decode(&mut deserializer)); let api_user_discovery_get_share_for_contact = decode_DartFn_Inputs_i_64_Output_opt_list_prim_u_8_strict_AnyhowException(::sse_decode(&mut deserializer)); -let api_user_discovery_push_own_promotion = decode_DartFn_Inputs_i_64_i_64_list_prim_u_8_strict_Output_bool_AnyhowException(::sse_decode(&mut deserializer)); +let api_user_discovery_push_own_promotion_and_clear_old_version = decode_DartFn_Inputs_i_64_i_64_list_prim_u_8_strict_Output_bool_AnyhowException(::sse_decode(&mut deserializer)); let api_user_discovery_get_own_promotions_after_version = decode_DartFn_Inputs_i_64_Output_opt_list_list_prim_u_8_strict_AnyhowException(::sse_decode(&mut deserializer)); let api_user_discovery_store_other_promotion = decode_DartFn_Inputs_other_promotion_Output_bool_AnyhowException(::sse_decode(&mut deserializer)); let api_user_discovery_get_other_promotions_by_public_id = decode_DartFn_Inputs_i_64_Output_opt_list_other_promotion_AnyhowException(::sse_decode(&mut deserializer)); @@ -150,7 +150,7 @@ let api_user_discovery_get_contact_version = decode_DartFn_Inputs_i_64_Output_op let api_user_discovery_set_contact_version = decode_DartFn_Inputs_i_64_list_prim_u_8_strict_Output_bool_AnyhowException(::sse_decode(&mut deserializer)); let api_user_discovery_push_new_user_relation = decode_DartFn_Inputs_i_64_announced_user_opt_box_autoadd_i_64_Output_bool_AnyhowException(::sse_decode(&mut deserializer));deserializer.end(); move |context| { transform_result_sse::<_, ()>((move || { - let output_ok = Result::<_,()>::Ok({ crate::bridge::callbacks::init_flutter_callbacks(api_logging_get_stream_sink, api_user_discovery_sign_data, api_user_discovery_verify_signature, api_user_discovery_verify_stored_pubkey, api_user_discovery_set_shares, api_user_discovery_get_share_for_contact, api_user_discovery_push_own_promotion, api_user_discovery_get_own_promotions_after_version, api_user_discovery_store_other_promotion, api_user_discovery_get_other_promotions_by_public_id, api_user_discovery_get_announced_user_by_public_id, api_user_discovery_get_contact_version, api_user_discovery_set_contact_version, api_user_discovery_push_new_user_relation); })?; Ok(output_ok) + let output_ok = Result::<_,()>::Ok({ crate::bridge::callbacks::init_flutter_callbacks(api_logging_get_stream_sink, api_user_discovery_sign_data, api_user_discovery_verify_signature, api_user_discovery_verify_stored_pubkey, api_user_discovery_set_shares, api_user_discovery_get_share_for_contact, api_user_discovery_push_own_promotion_and_clear_old_version, api_user_discovery_get_own_promotions_after_version, api_user_discovery_store_other_promotion, api_user_discovery_get_other_promotions_by_public_id, api_user_discovery_get_announced_user_by_public_id, api_user_discovery_get_contact_version, api_user_discovery_set_contact_version, api_user_discovery_push_new_user_relation); })?; Ok(output_ok) })()) } }) } diff --git a/rust_dependencies/protocols/src/user_discovery.rs b/rust_dependencies/protocols/src/user_discovery.rs index 09f970f1..9ae3d2fe 100644 --- a/rust_dependencies/protocols/src/user_discovery.rs +++ b/rust_dependencies/protocols/src/user_discovery.rs @@ -4,7 +4,7 @@ pub mod stores; pub mod tests; pub mod traits; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::u8; use blahaj::{Share, Sharks}; use prost::Message; @@ -447,7 +447,7 @@ impl UserDiscovery UserDiscovery UserDiscovery = promotions + let shares: Vec<_> = unique_promotions .iter() .map(|x| x.announcement_share.to_owned()) .filter_map(|x| Share::try_from(x.as_slice()).ok()) @@ -577,7 +588,7 @@ impl UserDiscovery, ) -> Result<()> { let mut storage = self.storage(); - // println!("{} != {}", version, storage.promotions.len()); + if version as usize != storage.own_promotions.len() + 1 { return Err(UserDiscoveryError::PushedInvalidVersion); } + + for (old_contact_id, promotion) in storage.own_promotions.iter_mut() { + if *old_contact_id == contact_id { + promotion.clear(); + } + } + storage.own_promotions.push((contact_id, promotion)); Ok(()) } diff --git a/rust_dependencies/protocols/src/user_discovery/tests.rs b/rust_dependencies/protocols/src/user_discovery/tests.rs index 208e1c2e..6cd80b26 100644 --- a/rust_dependencies/protocols/src/user_discovery/tests.rs +++ b/rust_dependencies/protocols/src/user_discovery/tests.rs @@ -112,7 +112,7 @@ async fn get_with_five_users() -> TestN } #[tokio::test] -async fn test_user_discovery_dynamic_threshold_in_memory_store() { +async fn test_user_discovery_decreased_threshold_in_memory_store() { let _ = pretty_env_logger::try_init(); let mut network = TestNetwork::::new(); @@ -196,6 +196,84 @@ async fn test_user_discovery_dynamic_threshold_in_memory_store() { ); } +#[tokio::test] +async fn test_user_discovery_increased_threshold_in_memory_store() { + let _ = pretty_env_logger::try_init(); + + let mut network = TestNetwork::::new(); + + // Start ALICE with a more strict threshold of 3. + // David only has 2 paths to Alice (via Bob and Charlie). Since 2 < 3, David cannot discover Alice. + network.add_user("ALICE", 2).await; + network.add_user("BOB", 2).await; + network.add_user("CHARLIE", 2).await; + network.add_user("DAVID", 2).await; + network.add_user("FRANK", 2).await; + + // Same topology as the initial 5 users + network.set_friends("ALICE", &["BOB", "CHARLIE"]); + network.set_friends("BOB", &["ALICE", "CHARLIE", "DAVID"]); + // CHARLIE IS NOT YET A FRIEND OF DAVID -> DAVID SHOULD NOT BE ABLE TO BE DECODE ALICE + network.set_friends("CHARLIE", &["ALICE", "BOB", "FRANK"]); + network.set_friends("DAVID", &["BOB", "CHARLIE"]); + network.set_friends("FRANK", &["CHARLIE"]); + + let david_idx = network.ids_by_name["DAVID"]; + let alice_idx = network.ids_by_name["ALICE"]; + + // Phase 1: Exchange with ALICE threshold = 2 + step0_exchange_random::(&network).await; + step1_verify_no_new_messages::(&network).await; + + // DAVID should NOT know ALICE yet because ALICE's threshold is 2, and David has only 1 shares. + { + let david_knows = network.uds[david_idx] + .get_all_announced_users() + .await + .unwrap(); + + let knows_alice = david_knows + .iter() + .any(|(u, _)| u.user_id == alice_idx as UserID); + + assert!(!knows_alice, "David should not know Alice yet because Alice's threshold is 3 and David only receives 2 shares"); + } + + // Phase 2: Update ALICE's threshold to 3 + network.uds[alice_idx] + .initialize_or_update(3, alice_idx as UserID, vec![alice_idx as u8; 32]) + .await + .unwrap(); + + // ALICE's new announcement with threshold 3 should propagate further. + // This SHOULD REPLACE THE OLD VERSION... + step0_exchange_random::(&network).await; + step1_verify_no_new_messages::(&network).await; + + // Now Charlie is a friend of David, so he should exchange ALICE with him + + network.set_friends("CHARLIE", &["ALICE", "BOB", "DAVID", "FRANK"]); + + // ALICE's new announcement with threshold 3 should propagate further. + // This SHOULD REPLACE THE OLD VERSION... + step0_exchange_random::(&network).await; + step1_verify_no_new_messages::(&network).await; + + // DAVID should still NOT know ALICE yet because ALICE's new threshold is 3, and David has only 2 shares. + { + let david_knows = network.uds[david_idx] + .get_all_announced_users() + .await + .unwrap(); + + let knows_alice = david_knows + .iter() + .any(|(u, _)| u.user_id == alice_idx as UserID); + + assert!(!knows_alice, "David should not know Alice yet because Alice's threshold is 3 and David only receives 2 shares"); + } +} + #[tokio::test] async fn test_user_discovery_in_memory_store() { let _ = pretty_env_logger::try_init(); diff --git a/rust_dependencies/protocols/src/user_discovery/traits.rs b/rust_dependencies/protocols/src/user_discovery/traits.rs index cf77b2f5..736df8fb 100644 --- a/rust_dependencies/protocols/src/user_discovery/traits.rs +++ b/rust_dependencies/protocols/src/user_discovery/traits.rs @@ -31,7 +31,7 @@ pub trait UserDiscoveryStore { contact_id: UserID, ) -> impl Future>> + Send; - fn push_own_promotion( + fn push_own_promotion_and_clear_old_version( &self, contact_id: UserID, version: u32, diff --git a/test/drift/twonly_db/generated/schema.dart b/test/drift/twonly_db/generated/schema.dart index ad724535..49f49d7b 100644 --- a/test/drift/twonly_db/generated/schema.dart +++ b/test/drift/twonly_db/generated/schema.dart @@ -16,9 +16,6 @@ import 'schema_v9.dart' as v9; import 'schema_v10.dart' as v10; import 'schema_v11.dart' as v11; import 'schema_v12.dart' as v12; -import 'schema_v13.dart' as v13; -import 'schema_v14.dart' as v14; -import 'schema_v15.dart' as v15; class GeneratedHelper implements SchemaInstantiationHelper { @override @@ -48,32 +45,10 @@ class GeneratedHelper implements SchemaInstantiationHelper { return v11.DatabaseAtV11(db); case 12: return v12.DatabaseAtV12(db); - case 13: - return v13.DatabaseAtV13(db); - case 14: - return v14.DatabaseAtV14(db); - case 15: - return v15.DatabaseAtV15(db); default: throw MissingSchemaException(version, versions); } } - static const versions = const [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - ]; + static const versions = const [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; } diff --git a/test/drift/twonly_db/generated/schema_v12.dart b/test/drift/twonly_db/generated/schema_v12.dart index 9d5c1ee4..901d0c22 100644 --- a/test/drift/twonly_db/generated/schema_v12.dart +++ b/test/drift/twonly_db/generated/schema_v12.dart @@ -135,6 +135,34 @@ class Contacts extends Table with TableInfo { requiredDuringInsert: false, $customConstraints: 'NULL', ); + late final GeneratedColumn userDiscoveryExcluded = GeneratedColumn( + 'user_discovery_excluded', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + $customConstraints: + 'NOT NULL DEFAULT 0 CHECK (user_discovery_excluded IN (0, 1))', + defaultValue: const CustomExpression('0'), + ); + late final GeneratedColumn mediaSendCounter = GeneratedColumn( + 'media_send_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + $customConstraints: 'NOT NULL DEFAULT 0', + defaultValue: const CustomExpression('0'), + ); + late final GeneratedColumn mediaReceivedCounter = GeneratedColumn( + 'media_received_counter', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + $customConstraints: 'NOT NULL DEFAULT 0', + defaultValue: const CustomExpression('0'), + ); @override List get $columns => [ userId, @@ -151,6 +179,9 @@ class Contacts extends Table with TableInfo { accountDeleted, createdAt, userDiscoveryVersion, + userDiscoveryExcluded, + mediaSendCounter, + mediaReceivedCounter, ]; @override String get aliasedName => _alias ?? actualTableName; @@ -219,6 +250,18 @@ class Contacts extends Table with TableInfo { DriftSqlType.blob, data['${effectivePrefix}user_discovery_version'], ), + userDiscoveryExcluded: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}user_discovery_excluded'], + )!, + mediaSendCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}media_send_counter'], + )!, + mediaReceivedCounter: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}media_received_counter'], + )!, ); } @@ -248,6 +291,9 @@ class ContactsData extends DataClass implements Insertable { final int accountDeleted; final int createdAt; final i2.Uint8List? userDiscoveryVersion; + final int userDiscoveryExcluded; + final int mediaSendCounter; + final int mediaReceivedCounter; const ContactsData({ required this.userId, required this.username, @@ -263,6 +309,9 @@ class ContactsData extends DataClass implements Insertable { required this.accountDeleted, required this.createdAt, this.userDiscoveryVersion, + required this.userDiscoveryExcluded, + required this.mediaSendCounter, + required this.mediaReceivedCounter, }); @override Map toColumns(bool nullToAbsent) { @@ -293,6 +342,9 @@ class ContactsData extends DataClass implements Insertable { userDiscoveryVersion, ); } + map['user_discovery_excluded'] = Variable(userDiscoveryExcluded); + map['media_send_counter'] = Variable(mediaSendCounter); + map['media_received_counter'] = Variable(mediaReceivedCounter); return map; } @@ -320,6 +372,9 @@ class ContactsData extends DataClass implements Insertable { userDiscoveryVersion: userDiscoveryVersion == null && nullToAbsent ? const Value.absent() : Value(userDiscoveryVersion), + userDiscoveryExcluded: Value(userDiscoveryExcluded), + mediaSendCounter: Value(mediaSendCounter), + mediaReceivedCounter: Value(mediaReceivedCounter), ); } @@ -349,6 +404,13 @@ class ContactsData extends DataClass implements Insertable { userDiscoveryVersion: serializer.fromJson( json['userDiscoveryVersion'], ), + userDiscoveryExcluded: serializer.fromJson( + json['userDiscoveryExcluded'], + ), + mediaSendCounter: serializer.fromJson(json['mediaSendCounter']), + mediaReceivedCounter: serializer.fromJson( + json['mediaReceivedCounter'], + ), ); } @override @@ -373,6 +435,9 @@ class ContactsData extends DataClass implements Insertable { 'userDiscoveryVersion': serializer.toJson( userDiscoveryVersion, ), + 'userDiscoveryExcluded': serializer.toJson(userDiscoveryExcluded), + 'mediaSendCounter': serializer.toJson(mediaSendCounter), + 'mediaReceivedCounter': serializer.toJson(mediaReceivedCounter), }; } @@ -391,6 +456,9 @@ class ContactsData extends DataClass implements Insertable { int? accountDeleted, int? createdAt, Value userDiscoveryVersion = const Value.absent(), + int? userDiscoveryExcluded, + int? mediaSendCounter, + int? mediaReceivedCounter, }) => ContactsData( userId: userId ?? this.userId, username: username ?? this.username, @@ -410,6 +478,9 @@ class ContactsData extends DataClass implements Insertable { userDiscoveryVersion: userDiscoveryVersion.present ? userDiscoveryVersion.value : this.userDiscoveryVersion, + userDiscoveryExcluded: userDiscoveryExcluded ?? this.userDiscoveryExcluded, + mediaSendCounter: mediaSendCounter ?? this.mediaSendCounter, + mediaReceivedCounter: mediaReceivedCounter ?? this.mediaReceivedCounter, ); ContactsData copyWithCompanion(ContactsCompanion data) { return ContactsData( @@ -439,6 +510,15 @@ class ContactsData extends DataClass implements Insertable { userDiscoveryVersion: data.userDiscoveryVersion.present ? data.userDiscoveryVersion.value : this.userDiscoveryVersion, + userDiscoveryExcluded: data.userDiscoveryExcluded.present + ? data.userDiscoveryExcluded.value + : this.userDiscoveryExcluded, + mediaSendCounter: data.mediaSendCounter.present + ? data.mediaSendCounter.value + : this.mediaSendCounter, + mediaReceivedCounter: data.mediaReceivedCounter.present + ? data.mediaReceivedCounter.value + : this.mediaReceivedCounter, ); } @@ -458,7 +538,10 @@ class ContactsData extends DataClass implements Insertable { ..write('verified: $verified, ') ..write('accountDeleted: $accountDeleted, ') ..write('createdAt: $createdAt, ') - ..write('userDiscoveryVersion: $userDiscoveryVersion') + ..write('userDiscoveryVersion: $userDiscoveryVersion, ') + ..write('userDiscoveryExcluded: $userDiscoveryExcluded, ') + ..write('mediaSendCounter: $mediaSendCounter, ') + ..write('mediaReceivedCounter: $mediaReceivedCounter') ..write(')')) .toString(); } @@ -479,6 +562,9 @@ class ContactsData extends DataClass implements Insertable { accountDeleted, createdAt, $driftBlobEquality.hash(userDiscoveryVersion), + userDiscoveryExcluded, + mediaSendCounter, + mediaReceivedCounter, ); @override bool operator ==(Object other) => @@ -503,7 +589,10 @@ class ContactsData extends DataClass implements Insertable { $driftBlobEquality.equals( other.userDiscoveryVersion, this.userDiscoveryVersion, - )); + ) && + other.userDiscoveryExcluded == this.userDiscoveryExcluded && + other.mediaSendCounter == this.mediaSendCounter && + other.mediaReceivedCounter == this.mediaReceivedCounter); } class ContactsCompanion extends UpdateCompanion { @@ -521,6 +610,9 @@ class ContactsCompanion extends UpdateCompanion { final Value accountDeleted; final Value createdAt; final Value userDiscoveryVersion; + final Value userDiscoveryExcluded; + final Value mediaSendCounter; + final Value mediaReceivedCounter; const ContactsCompanion({ this.userId = const Value.absent(), this.username = const Value.absent(), @@ -536,6 +628,9 @@ class ContactsCompanion extends UpdateCompanion { this.accountDeleted = const Value.absent(), this.createdAt = const Value.absent(), this.userDiscoveryVersion = const Value.absent(), + this.userDiscoveryExcluded = const Value.absent(), + this.mediaSendCounter = const Value.absent(), + this.mediaReceivedCounter = const Value.absent(), }); ContactsCompanion.insert({ this.userId = const Value.absent(), @@ -552,6 +647,9 @@ class ContactsCompanion extends UpdateCompanion { this.accountDeleted = const Value.absent(), this.createdAt = const Value.absent(), this.userDiscoveryVersion = const Value.absent(), + this.userDiscoveryExcluded = const Value.absent(), + this.mediaSendCounter = const Value.absent(), + this.mediaReceivedCounter = const Value.absent(), }) : username = Value(username); static Insertable custom({ Expression? userId, @@ -568,6 +666,9 @@ class ContactsCompanion extends UpdateCompanion { Expression? accountDeleted, Expression? createdAt, Expression? userDiscoveryVersion, + Expression? userDiscoveryExcluded, + Expression? mediaSendCounter, + Expression? mediaReceivedCounter, }) { return RawValuesInsertable({ if (userId != null) 'user_id': userId, @@ -587,6 +688,11 @@ class ContactsCompanion extends UpdateCompanion { if (createdAt != null) 'created_at': createdAt, if (userDiscoveryVersion != null) 'user_discovery_version': userDiscoveryVersion, + if (userDiscoveryExcluded != null) + 'user_discovery_excluded': userDiscoveryExcluded, + if (mediaSendCounter != null) 'media_send_counter': mediaSendCounter, + if (mediaReceivedCounter != null) + 'media_received_counter': mediaReceivedCounter, }); } @@ -605,6 +711,9 @@ class ContactsCompanion extends UpdateCompanion { Value? accountDeleted, Value? createdAt, Value? userDiscoveryVersion, + Value? userDiscoveryExcluded, + Value? mediaSendCounter, + Value? mediaReceivedCounter, }) { return ContactsCompanion( userId: userId ?? this.userId, @@ -621,6 +730,10 @@ class ContactsCompanion extends UpdateCompanion { accountDeleted: accountDeleted ?? this.accountDeleted, createdAt: createdAt ?? this.createdAt, userDiscoveryVersion: userDiscoveryVersion ?? this.userDiscoveryVersion, + userDiscoveryExcluded: + userDiscoveryExcluded ?? this.userDiscoveryExcluded, + mediaSendCounter: mediaSendCounter ?? this.mediaSendCounter, + mediaReceivedCounter: mediaReceivedCounter ?? this.mediaReceivedCounter, ); } @@ -673,6 +786,17 @@ class ContactsCompanion extends UpdateCompanion { userDiscoveryVersion.value, ); } + if (userDiscoveryExcluded.present) { + map['user_discovery_excluded'] = Variable( + userDiscoveryExcluded.value, + ); + } + if (mediaSendCounter.present) { + map['media_send_counter'] = Variable(mediaSendCounter.value); + } + if (mediaReceivedCounter.present) { + map['media_received_counter'] = Variable(mediaReceivedCounter.value); + } return map; } @@ -692,7 +816,10 @@ class ContactsCompanion extends UpdateCompanion { ..write('verified: $verified, ') ..write('accountDeleted: $accountDeleted, ') ..write('createdAt: $createdAt, ') - ..write('userDiscoveryVersion: $userDiscoveryVersion') + ..write('userDiscoveryVersion: $userDiscoveryVersion, ') + ..write('userDiscoveryExcluded: $userDiscoveryExcluded, ') + ..write('mediaSendCounter: $mediaSendCounter, ') + ..write('mediaReceivedCounter: $mediaReceivedCounter') ..write(')')) .toString(); } @@ -7813,11 +7940,41 @@ class UserDiscoveryAnnouncedUsers extends Table requiredDuringInsert: true, $customConstraints: 'NOT NULL UNIQUE', ); + late final GeneratedColumn username = GeneratedColumn( + 'username', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + $customConstraints: 'NULL', + ); + late final GeneratedColumn wasShownToTheUser = GeneratedColumn( + 'was_shown_to_the_user', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + $customConstraints: + 'NOT NULL DEFAULT 0 CHECK (was_shown_to_the_user IN (0, 1))', + defaultValue: const CustomExpression('0'), + ); + late final GeneratedColumn isHidden = GeneratedColumn( + 'is_hidden', + aliasedName, + false, + type: DriftSqlType.int, + requiredDuringInsert: false, + $customConstraints: 'NOT NULL DEFAULT 0 CHECK (is_hidden IN (0, 1))', + defaultValue: const CustomExpression('0'), + ); @override List get $columns => [ announcedUserId, announcedPublicKey, publicId, + username, + wasShownToTheUser, + isHidden, ]; @override String get aliasedName => _alias ?? actualTableName; @@ -7845,6 +8002,18 @@ class UserDiscoveryAnnouncedUsers extends Table DriftSqlType.int, data['${effectivePrefix}public_id'], )!, + username: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}username'], + ), + wasShownToTheUser: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}was_shown_to_the_user'], + )!, + isHidden: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}is_hidden'], + )!, ); } @@ -7866,10 +8035,16 @@ class UserDiscoveryAnnouncedUsersData extends DataClass final int announcedUserId; final i2.Uint8List announcedPublicKey; final int publicId; + final String? username; + final int wasShownToTheUser; + final int isHidden; const UserDiscoveryAnnouncedUsersData({ required this.announcedUserId, required this.announcedPublicKey, required this.publicId, + this.username, + required this.wasShownToTheUser, + required this.isHidden, }); @override Map toColumns(bool nullToAbsent) { @@ -7877,6 +8052,11 @@ class UserDiscoveryAnnouncedUsersData extends DataClass map['announced_user_id'] = Variable(announcedUserId); map['announced_public_key'] = Variable(announcedPublicKey); map['public_id'] = Variable(publicId); + if (!nullToAbsent || username != null) { + map['username'] = Variable(username); + } + map['was_shown_to_the_user'] = Variable(wasShownToTheUser); + map['is_hidden'] = Variable(isHidden); return map; } @@ -7885,6 +8065,11 @@ class UserDiscoveryAnnouncedUsersData extends DataClass announcedUserId: Value(announcedUserId), announcedPublicKey: Value(announcedPublicKey), publicId: Value(publicId), + username: username == null && nullToAbsent + ? const Value.absent() + : Value(username), + wasShownToTheUser: Value(wasShownToTheUser), + isHidden: Value(isHidden), ); } @@ -7899,6 +8084,9 @@ class UserDiscoveryAnnouncedUsersData extends DataClass json['announcedPublicKey'], ), publicId: serializer.fromJson(json['publicId']), + username: serializer.fromJson(json['username']), + wasShownToTheUser: serializer.fromJson(json['wasShownToTheUser']), + isHidden: serializer.fromJson(json['isHidden']), ); } @override @@ -7908,6 +8096,9 @@ class UserDiscoveryAnnouncedUsersData extends DataClass 'announcedUserId': serializer.toJson(announcedUserId), 'announcedPublicKey': serializer.toJson(announcedPublicKey), 'publicId': serializer.toJson(publicId), + 'username': serializer.toJson(username), + 'wasShownToTheUser': serializer.toJson(wasShownToTheUser), + 'isHidden': serializer.toJson(isHidden), }; } @@ -7915,10 +8106,16 @@ class UserDiscoveryAnnouncedUsersData extends DataClass int? announcedUserId, i2.Uint8List? announcedPublicKey, int? publicId, + Value username = const Value.absent(), + int? wasShownToTheUser, + int? isHidden, }) => UserDiscoveryAnnouncedUsersData( announcedUserId: announcedUserId ?? this.announcedUserId, announcedPublicKey: announcedPublicKey ?? this.announcedPublicKey, publicId: publicId ?? this.publicId, + username: username.present ? username.value : this.username, + wasShownToTheUser: wasShownToTheUser ?? this.wasShownToTheUser, + isHidden: isHidden ?? this.isHidden, ); UserDiscoveryAnnouncedUsersData copyWithCompanion( UserDiscoveryAnnouncedUsersCompanion data, @@ -7931,6 +8128,11 @@ class UserDiscoveryAnnouncedUsersData extends DataClass ? data.announcedPublicKey.value : this.announcedPublicKey, publicId: data.publicId.present ? data.publicId.value : this.publicId, + username: data.username.present ? data.username.value : this.username, + wasShownToTheUser: data.wasShownToTheUser.present + ? data.wasShownToTheUser.value + : this.wasShownToTheUser, + isHidden: data.isHidden.present ? data.isHidden.value : this.isHidden, ); } @@ -7939,7 +8141,10 @@ class UserDiscoveryAnnouncedUsersData extends DataClass return (StringBuffer('UserDiscoveryAnnouncedUsersData(') ..write('announcedUserId: $announcedUserId, ') ..write('announcedPublicKey: $announcedPublicKey, ') - ..write('publicId: $publicId') + ..write('publicId: $publicId, ') + ..write('username: $username, ') + ..write('wasShownToTheUser: $wasShownToTheUser, ') + ..write('isHidden: $isHidden') ..write(')')) .toString(); } @@ -7949,6 +8154,9 @@ class UserDiscoveryAnnouncedUsersData extends DataClass announcedUserId, $driftBlobEquality.hash(announcedPublicKey), publicId, + username, + wasShownToTheUser, + isHidden, ); @override bool operator ==(Object other) => @@ -7959,7 +8167,10 @@ class UserDiscoveryAnnouncedUsersData extends DataClass other.announcedPublicKey, this.announcedPublicKey, ) && - other.publicId == this.publicId); + other.publicId == this.publicId && + other.username == this.username && + other.wasShownToTheUser == this.wasShownToTheUser && + other.isHidden == this.isHidden); } class UserDiscoveryAnnouncedUsersCompanion @@ -7967,27 +8178,42 @@ class UserDiscoveryAnnouncedUsersCompanion final Value announcedUserId; final Value announcedPublicKey; final Value publicId; + final Value username; + final Value wasShownToTheUser; + final Value isHidden; const UserDiscoveryAnnouncedUsersCompanion({ this.announcedUserId = const Value.absent(), this.announcedPublicKey = const Value.absent(), this.publicId = const Value.absent(), + this.username = const Value.absent(), + this.wasShownToTheUser = const Value.absent(), + this.isHidden = const Value.absent(), }); UserDiscoveryAnnouncedUsersCompanion.insert({ this.announcedUserId = const Value.absent(), required i2.Uint8List announcedPublicKey, required int publicId, + this.username = const Value.absent(), + this.wasShownToTheUser = const Value.absent(), + this.isHidden = const Value.absent(), }) : announcedPublicKey = Value(announcedPublicKey), publicId = Value(publicId); static Insertable custom({ Expression? announcedUserId, Expression? announcedPublicKey, Expression? publicId, + Expression? username, + Expression? wasShownToTheUser, + Expression? isHidden, }) { return RawValuesInsertable({ if (announcedUserId != null) 'announced_user_id': announcedUserId, if (announcedPublicKey != null) 'announced_public_key': announcedPublicKey, if (publicId != null) 'public_id': publicId, + if (username != null) 'username': username, + if (wasShownToTheUser != null) 'was_shown_to_the_user': wasShownToTheUser, + if (isHidden != null) 'is_hidden': isHidden, }); } @@ -7995,11 +8221,17 @@ class UserDiscoveryAnnouncedUsersCompanion Value? announcedUserId, Value? announcedPublicKey, Value? publicId, + Value? username, + Value? wasShownToTheUser, + Value? isHidden, }) { return UserDiscoveryAnnouncedUsersCompanion( announcedUserId: announcedUserId ?? this.announcedUserId, announcedPublicKey: announcedPublicKey ?? this.announcedPublicKey, publicId: publicId ?? this.publicId, + username: username ?? this.username, + wasShownToTheUser: wasShownToTheUser ?? this.wasShownToTheUser, + isHidden: isHidden ?? this.isHidden, ); } @@ -8017,6 +8249,15 @@ class UserDiscoveryAnnouncedUsersCompanion if (publicId.present) { map['public_id'] = Variable(publicId.value); } + if (username.present) { + map['username'] = Variable(username.value); + } + if (wasShownToTheUser.present) { + map['was_shown_to_the_user'] = Variable(wasShownToTheUser.value); + } + if (isHidden.present) { + map['is_hidden'] = Variable(isHidden.value); + } return map; } @@ -8025,7 +8266,10 @@ class UserDiscoveryAnnouncedUsersCompanion return (StringBuffer('UserDiscoveryAnnouncedUsersCompanion(') ..write('announcedUserId: $announcedUserId, ') ..write('announcedPublicKey: $announcedPublicKey, ') - ..write('publicId: $publicId') + ..write('publicId: $publicId, ') + ..write('username: $username, ') + ..write('wasShownToTheUser: $wasShownToTheUser, ') + ..write('isHidden: $isHidden') ..write(')')) .toString(); } @@ -8377,7 +8621,7 @@ class UserDiscoveryOtherPromotions extends Table String get actualTableName => $name; static const String $name = 'user_discovery_other_promotions'; @override - Set get $primaryKey => {fromContactId, promotionId}; + Set get $primaryKey => {fromContactId, publicId}; @override UserDiscoveryOtherPromotionsData map( Map data, { @@ -8419,7 +8663,7 @@ class UserDiscoveryOtherPromotions extends Table @override List get customConstraints => const [ - 'PRIMARY KEY(from_contact_id, promotion_id)', + 'PRIMARY KEY(from_contact_id, public_id)', ]; @override bool get dontWriteConstraints => true;