Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update @mapeo/schema to get new features #477

Merged
merged 6 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ CREATE TABLE `deviceInfo` (
`links` text NOT NULL,
`deleted` integer NOT NULL,
`name` text NOT NULL,
`deviceType` text,
`forks` text NOT NULL
);
--> statement-breakpoint
Expand Down Expand Up @@ -147,3 +148,25 @@ CREATE TABLE `role` (
`fromIndex` real NOT NULL,
`forks` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `translation_backlink` (
`versionId` text PRIMARY KEY NOT NULL
);
--> statement-breakpoint
CREATE TABLE `translation` (
`docId` text PRIMARY KEY NOT NULL,
`versionId` text NOT NULL,
`schemaName` text NOT NULL,
`createdAt` text NOT NULL,
`createdBy` text NOT NULL,
`updatedAt` text NOT NULL,
`links` text NOT NULL,
`deleted` integer NOT NULL,
`schemaNameRef` text NOT NULL,
`docIdRef` text NOT NULL,
`fieldRef` text NOT NULL,
`languageCode` text NOT NULL,
`regionCode` text NOT NULL,
`message` text NOT NULL,
`forks` text NOT NULL
);
139 changes: 138 additions & 1 deletion drizzle/project/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "5",
"dialect": "sqlite",
"id": "1df09db6-316f-496d-a39a-89a99cca1ad9",
"id": "f68815a6-4e7a-4ca7-9882-6f31bb34b716",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"coreOwnership_backlink": {
Expand Down Expand Up @@ -232,6 +232,13 @@
"notNull": true,
"autoincrement": false
},
"deviceType": {
"name": "deviceType",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"forks": {
"name": "forks",
"type": "text",
Expand Down Expand Up @@ -873,6 +880,136 @@
"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
},
"schemaName": {
"name": "schemaName",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"createdAt": {
"name": "createdAt",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"createdBy": {
"name": "createdBy",
"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
},
"schemaNameRef": {
"name": "schemaNameRef",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"docIdRef": {
"name": "docIdRef",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"fieldRef": {
"name": "fieldRef",
"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": true,
"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": {},
Expand Down
4 changes: 2 additions & 2 deletions drizzle/project/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{
"idx": 0,
"version": "5",
"when": 1704981085509,
"tag": "0000_steep_gunslinger",
"when": 1707965473123,
"tag": "0000_supreme_forgotten_one",
"breakpoints": true
}
]
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"@fastify/type-provider-typebox": "^3.3.0",
"@hyperswarm/secret-stream": "^6.1.2",
"@mapeo/crypto": "1.0.0-alpha.10",
"@mapeo/schema": "3.0.0-next.13",
"@mapeo/schema": "3.0.0-next.14",
"@mapeo/sqlite-indexer": "1.0.0-alpha.8",
"@sinclair/typebox": "^0.29.6",
"@types/yauzl-promise": "^2.1.5",
Expand Down
9 changes: 8 additions & 1 deletion src/datastore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ import { createMap } from '../utils.js'

const NAMESPACE_SCHEMAS = /** @type {const} */ ({
data: ['observation'],
config: ['preset', 'field', 'projectSettings', 'deviceInfo', 'icon'],
config: [
'translation',
'preset',
'field',
'projectSettings',
'deviceInfo',
'icon',
],
auth: ['coreOwnership', 'role'],
})

Expand Down
5 changes: 5 additions & 0 deletions src/schema/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { NAMESPACES } from '../constants.js'
import { jsonSchemaToDrizzleColumns as toColumns } from './schema-to-drizzle.js'
import { backlinkTable } from './utils.js'

export const translationTable = sqliteTable(
'translation',
toColumns(schemas.translation)
)
export const observationTable = sqliteTable(
'observation',
toColumns(schemas.observation)
Expand All @@ -23,6 +27,7 @@ export const deviceInfoTable = sqliteTable(
)
export const iconTable = sqliteTable('icon', toColumns(schemas.icon))

export const translationBacklinkTable = backlinkTable(translationTable)
export const observationBacklinkTable = backlinkTable(observationTable)
export const presetBacklinkTable = backlinkTable(presetTable)
export const fieldBacklinkTable = backlinkTable(fieldTable)
Expand Down
Loading