diff --git a/drizzle/project/0001_medical_wendell_rand.sql b/drizzle/project/0001_medical_wendell_rand.sql new file mode 100644 index 000000000..715982d16 --- /dev/null +++ b/drizzle/project/0001_medical_wendell_rand.sql @@ -0,0 +1,22 @@ +CREATE TABLE `remoteDetectionAlert_backlink` ( + `versionId` text PRIMARY KEY NOT NULL +); +--> statement-breakpoint +CREATE TABLE `remoteDetectionAlert` ( + `docId` text PRIMARY KEY NOT NULL, + `versionId` text NOT NULL, + `originalVersionId` text NOT NULL, + `schemaName` text NOT NULL, + `createdAt` text NOT NULL, + `updatedAt` text NOT NULL, + `links` text NOT NULL, + `deleted` integer NOT NULL, + `detectionDateStart` text NOT NULL, + `detectionDateEnd` text NOT NULL, + `sourceId` text NOT NULL, + `metadata` text NOT NULL, + `geometry` text NOT NULL, + `forks` text NOT NULL +); +--> statement-breakpoint +ALTER TABLE deviceInfo ADD `selfHostedServerDetails` text; \ No newline at end of file diff --git a/drizzle/project/meta/0001_snapshot.json b/drizzle/project/meta/0001_snapshot.json new file mode 100644 index 000000000..ec502c944 --- /dev/null +++ b/drizzle/project/meta/0001_snapshot.json @@ -0,0 +1,1267 @@ +{ + "version": "5", + "dialect": "sqlite", + "id": "fd9449b2-3a8e-440e-ba57-62c2db1dc39f", + "prevId": "597b1fb1-5fe9-4601-abab-9cd02b6a77fe", + "tables": { + "coreOwnership_backlink": { + "name": "coreOwnership_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "coreOwnership": { + "name": "coreOwnership", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "authCoreId": { + "name": "authCoreId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "configCoreId": { + "name": "configCoreId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "dataCoreId": { + "name": "dataCoreId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "blobCoreId": { + "name": "blobCoreId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "blobIndexCoreId": { + "name": "blobIndexCoreId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "cores": { + "name": "cores", + "columns": { + "publicKey": { + "name": "publicKey", + "type": "blob", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "namespace": { + "name": "namespace", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "deviceInfo_backlink": { + "name": "deviceInfo_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "deviceInfo": { + "name": "deviceInfo", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deviceType": { + "name": "deviceType", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "selfHostedServerDetails": { + "name": "selfHostedServerDetails", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "field_backlink": { + "name": "field_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "field": { + "name": "field", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tagKey": { + "name": "tagKey", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "appearance": { + "name": "appearance", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "snakeCase": { + "name": "snakeCase", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "options": { + "name": "options", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "universal": { + "name": "universal", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "placeholder": { + "name": "placeholder", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "helperText": { + "name": "helperText", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "icon_backlink": { + "name": "icon_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "icon": { + "name": "icon", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "variants": { + "name": "variants", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "observation_backlink": { + "name": "observation_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "observation": { + "name": "observation", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lat": { + "name": "lat", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lon": { + "name": "lon", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attachments": { + "name": "attachments", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "presetRef": { + "name": "presetRef", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "preset_backlink": { + "name": "preset_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "preset": { + "name": "preset", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "geometry": { + "name": "geometry", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "addTags": { + "name": "addTags", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "removeTags": { + "name": "removeTags", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fieldRefs": { + "name": "fieldRefs", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "iconRef": { + "name": "iconRef", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "terms": { + "name": "terms", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "remoteDetectionAlert_backlink": { + "name": "remoteDetectionAlert_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "remoteDetectionAlert": { + "name": "remoteDetectionAlert", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "detectionDateStart": { + "name": "detectionDateStart", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "detectionDateEnd": { + "name": "detectionDateEnd", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sourceId": { + "name": "sourceId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "geometry": { + "name": "geometry", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "role_backlink": { + "name": "role_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "role": { + "name": "role", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "roleId": { + "name": "roleId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fromIndex": { + "name": "fromIndex", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "track_backlink": { + "name": "track_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "track": { + "name": "track", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "locations": { + "name": "locations", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "observationRefs": { + "name": "observationRefs", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "translation_backlink": { + "name": "translation_backlink", + "columns": { + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "translation": { + "name": "translation", + "columns": { + "docId": { + "name": "docId", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "versionId": { + "name": "versionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "originalVersionId": { + "name": "originalVersionId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schemaName": { + "name": "schemaName", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "links": { + "name": "links", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted": { + "name": "deleted", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "docRef": { + "name": "docRef", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "docRefType": { + "name": "docRefType", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "propertyRef": { + "name": "propertyRef", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "languageCode": { + "name": "languageCode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "regionCode": { + "name": "regionCode", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "forks": { + "name": "forks", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + } +} \ No newline at end of file diff --git a/drizzle/project/meta/_journal.json b/drizzle/project/meta/_journal.json index 20509e61f..20711e230 100644 --- a/drizzle/project/meta/_journal.json +++ b/drizzle/project/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1726514275142, "tag": "0000_spooky_lady_ursula", "breakpoints": true + }, + { + "idx": 1, + "version": "5", + "when": 1729783892753, + "tag": "0001_medical_wendell_rand", + "breakpoints": true } ] } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 45fe44e94..c421fabc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@comapeo/fallback-smp": "^1.0.0", - "@comapeo/schema": "1.0.0", + "@comapeo/schema": "1.2.0", "@digidem/types": "^2.3.0", "@fastify/error": "^3.4.1", "@fastify/type-provider-typebox": "^4.1.0", @@ -61,7 +61,7 @@ "@bufbuild/buf": "^1.26.1", "@comapeo/core2.0.1": "npm:@comapeo/core@2.0.1", "@mapeo/default-config": "5.0.0", - "@mapeo/mock-data": "2.0.0", + "@mapeo/mock-data": "^2.1.1", "@sinonjs/fake-timers": "^10.0.2", "@types/b4a": "^1.6.0", "@types/bogon": "^1.0.2", @@ -299,16 +299,36 @@ "yauzl-promise": "^4.0.0" } }, + "node_modules/@comapeo/core2.0.1/node_modules/@comapeo/schema": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@comapeo/schema/-/schema-1.0.0.tgz", + "integrity": "sha512-dK227I+0yg9D2y5/O5NGywx50tgeNYyUkl1uYnSmNAPlbv+r2KX9aaC9m4dEjIja2aR2VFnYn6z537ERZiahqQ==", + "dev": true, + "dependencies": { + "compact-encoding": "^2.12.0", + "protobufjs": "^7.2.5", + "type-fest": "^4.26.0" + } + }, "node_modules/@comapeo/fallback-smp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@comapeo/fallback-smp/-/fallback-smp-1.0.0.tgz", "integrity": "sha512-6wLTtBOdlwtYMyrynBq6ZQ7S1aVABXQSwR/1QENkFkc7WyLLs4wLd9ny7WfSUQdHn6E2zfvA7WfKH7R06Zy3gQ==" }, + "node_modules/@comapeo/geometry": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@comapeo/geometry/-/geometry-1.0.2.tgz", + "integrity": "sha512-q6zadJA3lr85GZPTZ+lol9F6ERRq2Rt4upON7HhcwPPBiCLN696SY03OJZCE6xkXHxjJY98FF5DxVX3W0IftLQ==", + "dependencies": { + "protobufjs": "^7.4.0" + } + }, "node_modules/@comapeo/schema": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@comapeo/schema/-/schema-1.0.0.tgz", - "integrity": "sha512-dK227I+0yg9D2y5/O5NGywx50tgeNYyUkl1uYnSmNAPlbv+r2KX9aaC9m4dEjIja2aR2VFnYn6z537ERZiahqQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@comapeo/schema/-/schema-1.2.0.tgz", + "integrity": "sha512-LWrUSqtXmrEmE/B9V/zffKBbJmMo37AlvjXczvGx1+BbCAjOYCPDX6GCtnSKNsvtnNS2KQZDm9apg3mp92tFGA==", "dependencies": { + "@comapeo/geometry": "^1.0.2", "compact-encoding": "^2.12.0", "protobufjs": "^7.2.5", "type-fest": "^4.26.0" @@ -842,12 +862,13 @@ "dev": true }, "node_modules/@mapeo/mock-data": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@mapeo/mock-data/-/mock-data-2.0.0.tgz", - "integrity": "sha512-aYB11zpR2mYojUhwMDIhsaBPjzqa7HgEFkf4HNRyAs9N+zKJN4/X3PBm6Q9+QJjAqB0soS363U9j3Kljnu/QIQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@mapeo/mock-data/-/mock-data-2.1.1.tgz", + "integrity": "sha512-BBR10Dk+eqlm+r75gj/kvMNFSyAuueT2zrxOvMw/Yj9lVxFF4E1077oKzGDu0JD/4bbthBdQYTDT7Xl463zxNw==", "dev": true, "dependencies": { "@faker-js/faker": "^8.3.1", + "dereference-json-schema": "^0.2.1", "json-schema-faker": "^0.5.3", "type-fest": "^4.8.0" }, @@ -856,7 +877,7 @@ "list-mapeo-schemas": "bin/list-mapeo-schemas.js" }, "peerDependencies": { - "@comapeo/schema": "^1.0.0" + "@comapeo/schema": "^1.1.1" } }, "node_modules/@mapeo/sqlite-indexer": { @@ -3137,6 +3158,12 @@ "node": ">=6" } }, + "node_modules/dereference-json-schema": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/dereference-json-schema/-/dereference-json-schema-0.2.1.tgz", + "integrity": "sha512-uzJsrg225owJyRQ8FNTPHIuBOdSzIZlHhss9u6W8mp7jJldHqGuLv9cULagP/E26QVJDnjtG8U7Dw139mM1ydA==", + "dev": true + }, "node_modules/detect-libc": { "version": "2.0.1", "license": "Apache-2.0", @@ -7424,9 +7451,10 @@ } }, "node_modules/protobufjs": { - "version": "7.2.5", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", + "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", "hasInstallScript": true, - "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", diff --git a/package.json b/package.json index 741d7b3db..fba55f462 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "@bufbuild/buf": "^1.26.1", "@comapeo/core2.0.1": "npm:@comapeo/core@2.0.1", "@mapeo/default-config": "5.0.0", - "@mapeo/mock-data": "2.0.0", + "@mapeo/mock-data": "^2.1.1", "@sinonjs/fake-timers": "^10.0.2", "@types/b4a": "^1.6.0", "@types/bogon": "^1.0.2", @@ -154,7 +154,7 @@ }, "dependencies": { "@comapeo/fallback-smp": "^1.0.0", - "@comapeo/schema": "1.0.0", + "@comapeo/schema": "1.2.0", "@digidem/types": "^2.3.0", "@fastify/error": "^3.4.1", "@fastify/type-provider-typebox": "^4.1.0", diff --git a/src/constants.js b/src/constants.js index b7414909c..a95af9df3 100644 --- a/src/constants.js +++ b/src/constants.js @@ -19,7 +19,7 @@ export const DATA_NAMESPACES = NAMESPACES.filter( ) export const NAMESPACE_SCHEMAS = /** @type {const} */ ({ - data: ['observation', 'track'], + data: ['observation', 'track', 'remoteDetectionAlert'], config: [ 'translation', 'preset', diff --git a/src/mapeo-project.js b/src/mapeo-project.js index db85d9865..8bac0de79 100644 --- a/src/mapeo-project.js +++ b/src/mapeo-project.js @@ -24,6 +24,7 @@ import { roleTable, iconTable, translationTable, + remoteDetectionAlertTable, } from './schema/project.js' import { CoreOwnership, @@ -175,6 +176,7 @@ export class MapeoProject extends TypedEmitter { deviceInfoTable, iconTable, translationTable, + remoteDetectionAlertTable, ], sqlite: this.#sqlite, getWinner, @@ -231,6 +233,12 @@ export class MapeoProject extends TypedEmitter { db, getTranslations, }), + remoteDetectionAlert: new DataType({ + dataStore: this.#dataStores.data, + table: remoteDetectionAlertTable, + db, + getTranslations, + }), preset: new DataType({ dataStore: this.#dataStores.config, table: presetTable, @@ -505,6 +513,10 @@ export class MapeoProject extends TypedEmitter { return this.#dataTypes.field } + get remoteDetectionAlert() { + return this.#dataTypes.remoteDetectionAlert + } + get $member() { return this.#memberApi } diff --git a/src/schema/project.js b/src/schema/project.js index facd85f9b..2daa288c9 100644 --- a/src/schema/project.js +++ b/src/schema/project.js @@ -15,6 +15,10 @@ export const observationTable = sqliteTable( toColumns(schemas.observation) ) export const trackTable = sqliteTable('track', toColumns(schemas.track)) +export const remoteDetectionAlertTable = sqliteTable( + 'remoteDetectionAlert', + toColumns(schemas.remoteDetectionAlert) +) export const presetTable = sqliteTable('preset', toColumns(schemas.preset)) export const fieldTable = sqliteTable('field', toColumns(schemas.field)) export const coreOwnershipTable = sqliteTable( @@ -31,6 +35,9 @@ export const iconTable = sqliteTable('icon', toColumns(schemas.icon)) export const translationBacklinkTable = backlinkTable(translationTable) export const observationBacklinkTable = backlinkTable(observationTable) export const trackBacklinkTable = backlinkTable(trackTable) +export const remoteDetectionAlertBacklinkTable = backlinkTable( + remoteDetectionAlertTable +) export const presetBacklinkTable = backlinkTable(presetTable) export const fieldBacklinkTable = backlinkTable(fieldTable) export const coreOwnershipBacklinkTable = backlinkTable(coreOwnershipTable) diff --git a/test-e2e/project-crud.js b/test-e2e/project-crud.js index f2dba8f41..2b0ec7129 100644 --- a/test-e2e/project-crud.js +++ b/test-e2e/project-crud.js @@ -19,11 +19,12 @@ import { setTimeout as delay } from 'timers/promises' * MapeoDoc, * ObservationValue, * PresetValue, + * RemoteDetectionAlertValue, * TrackValue, * } from '@comapeo/schema' */ /** @import { MapeoProject } from '../src/mapeo-project.js' */ -/** @satisfies {Array} */ +/** @type {Array} */ const fixtures = [ { schemaName: 'observation', @@ -61,6 +62,17 @@ const fixtures = [ tags: {}, locations: Array.from({ length: 10 }, trackPositionFixture), }, + { + schemaName: 'remoteDetectionAlert', + detectionDateStart: new Date().toISOString(), + detectionDateEnd: new Date().toISOString(), + sourceId: randomBytes(32).toString('hex'), + metadata: { alert_type: 'fire' }, + geometry: { + type: 'Point', + coordinates: [-3, 37], + }, + }, ] /** @@ -81,7 +93,7 @@ const fixtures = [ * [0]: https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChnIyYBcyIArgLYBG0A3LgL666iSyIoBCcUO+yar1IUa9JiwToQAZzDIANugDmy6MgC8-AkXSkAPABVkEAB6QQAExlpMAPgAUANzgLyEUoYCUmu8imy6AoQAHRKys6u7iG6XgA0AkJQBsZmFtbIPFCOLm4eyN6+-tIyQaHhkXkhSfFMDLgBcsjoAA5gwCWayADaAES6vXHIvUm9ALrIcDaNYAxEfA4zzW0dIM0wy+0lPngES+jUAFakGFgAPpm8Xa1baxr3wwPIAPw4hCTIAIzIjMik2IJhMgAEw-BgEcJqKDdG6rMYOA6HLwMRhAA * * @param {MapeoProject} project - * @param {FieldValue | ObservationValue | PresetValue | TrackValue} value + * @param {FieldValue | ObservationValue | PresetValue | TrackValue | RemoteDetectionAlertValue} value * @returns {Promise} */ function create(project, value) { @@ -92,6 +104,8 @@ function create(project, value) { return project[value.schemaName].create(value) case 'preset': return project[value.schemaName].create(value) + case 'remoteDetectionAlert': + return project[value.schemaName].create(value) case 'track': return project[value.schemaName].create(value) default: @@ -103,7 +117,7 @@ function create(project, value) { * Create a bunch of docs with mocked data. See above for why this function exists. * * @param {MapeoProject} project - * @param {'field' | 'observation' | 'preset' | 'track'} schemaName + * @param {'field' | 'observation' | 'preset' | 'track' | 'remoteDetectionAlert'} schemaName * @param {number} count * @returns {Promise} */ @@ -127,6 +141,12 @@ function createWithMockData(project, schemaName, count) { project[schemaName].create(valueOf(doc)) ) ) + case 'remoteDetectionAlert': + return Promise.all( + generate(schemaName, { count }).map((doc) => + project[schemaName].create(valueOf(doc)) + ) + ) case 'track': return Promise.all( generate(schemaName, { count }).map((doc) => @@ -143,7 +163,7 @@ function createWithMockData(project, schemaName, count) { * * @param {MapeoProject} project * @param {string} versionId - * @param {FieldValue | ObservationValue | PresetValue | TrackValue} value + * @param {FieldValue | ObservationValue | PresetValue | TrackValue | RemoteDetectionAlertValue} value * @returns {Promise} */ function update(project, versionId, value) { @@ -154,6 +174,8 @@ function update(project, versionId, value) { return project[value.schemaName].update(versionId, value) case 'preset': return project[value.schemaName].update(versionId, value) + case 'remoteDetectionAlert': + return project[value.schemaName].update(versionId, value) case 'track': return project[value.schemaName].update(versionId, value) default: