mirror of
https://github.com/colanode/colanode.git
synced 2025-12-29 00:25:03 +01:00
Remove unused table in desktop
This commit is contained in:
@@ -56,31 +56,6 @@ const createNodeTransactionsTable: Migration = {
|
||||
},
|
||||
};
|
||||
|
||||
const createCollaborationsTable: Migration = {
|
||||
up: async (db) => {
|
||||
await db.schema
|
||||
.createTable('collaborations')
|
||||
.addColumn('user_id', 'text', (col) => col.notNull())
|
||||
.addColumn('node_id', 'text', (col) => col.notNull())
|
||||
.addColumn('type', 'text', (col) =>
|
||||
col
|
||||
.notNull()
|
||||
.generatedAlwaysAs(sql`json_extract(attributes, '$.type')`)
|
||||
.stored()
|
||||
)
|
||||
.addColumn('attributes', 'text', (col) => col.notNull())
|
||||
.addColumn('state', 'blob', (col) => col.notNull())
|
||||
.addColumn('created_at', 'text', (col) => col.notNull())
|
||||
.addColumn('updated_at', 'text')
|
||||
.addColumn('number', 'integer')
|
||||
.addPrimaryKeyConstraint('collaborations_pk', ['user_id', 'node_id'])
|
||||
.execute();
|
||||
},
|
||||
down: async (db) => {
|
||||
await db.schema.dropTable('collaborations').execute();
|
||||
},
|
||||
};
|
||||
|
||||
const createDownloadsTable: Migration = {
|
||||
up: async (db) => {
|
||||
await db.schema
|
||||
@@ -261,12 +236,11 @@ const createNodeDeleteNameTrigger: Migration = {
|
||||
export const workspaceDatabaseMigrations: Record<string, Migration> = {
|
||||
'00001_create_nodes_table': createNodesTable,
|
||||
'00002_create_node_transactions_table': createNodeTransactionsTable,
|
||||
'00003_create_collaborations_table': createCollaborationsTable,
|
||||
'00004_create_uploads_table': createUploadsTable,
|
||||
'00005_create_downloads_table': createDownloadsTable,
|
||||
'00006_create_node_paths_table': createNodePathsTable,
|
||||
'00007_create_node_names_table': createNodeNamesTable,
|
||||
'00008_create_node_insert_name_trigger': createNodeInsertNameTrigger,
|
||||
'00009_create_node_update_name_trigger': createNodeUpdateNameTrigger,
|
||||
'00010_create_node_delete_name_trigger': createNodeDeleteNameTrigger,
|
||||
'00003_create_uploads_table': createUploadsTable,
|
||||
'00004_create_downloads_table': createDownloadsTable,
|
||||
'00005_create_node_paths_table': createNodePathsTable,
|
||||
'00006_create_node_names_table': createNodeNamesTable,
|
||||
'00007_create_node_insert_name_trigger': createNodeInsertNameTrigger,
|
||||
'00008_create_node_update_name_trigger': createNodeUpdateNameTrigger,
|
||||
'00009_create_node_delete_name_trigger': createNodeDeleteNameTrigger,
|
||||
};
|
||||
|
||||
@@ -42,21 +42,6 @@ export type SelectNodeTransaction = Selectable<NodeTransactionTable>;
|
||||
export type CreateNodeTransaction = Insertable<NodeTransactionTable>;
|
||||
export type UpdateNodeTransaction = Updateable<NodeTransactionTable>;
|
||||
|
||||
interface CollaborationTable {
|
||||
user_id: ColumnType<string, string, never>;
|
||||
node_id: ColumnType<string, string, never>;
|
||||
type: ColumnType<string, never, never>;
|
||||
attributes: ColumnType<string, string, string>;
|
||||
state: ColumnType<Uint8Array, Uint8Array, Uint8Array>;
|
||||
created_at: ColumnType<string, string, never>;
|
||||
updated_at: ColumnType<string | null, string | null, string | null>;
|
||||
number: ColumnType<bigint | null, bigint | null, bigint | null>;
|
||||
}
|
||||
|
||||
export type SelectCollaboration = Selectable<CollaborationTable>;
|
||||
export type CreateCollaboration = Insertable<CollaborationTable>;
|
||||
export type UpdateCollaboration = Updateable<CollaborationTable>;
|
||||
|
||||
interface UploadTable {
|
||||
node_id: ColumnType<string, string, never>;
|
||||
upload_id: ColumnType<string, string, never>;
|
||||
@@ -88,7 +73,6 @@ export interface WorkspaceDatabaseSchema {
|
||||
nodes: NodeTable;
|
||||
node_transactions: NodeTransactionTable;
|
||||
node_paths: NodePathTable;
|
||||
collaborations: CollaborationTable;
|
||||
uploads: UploadTable;
|
||||
downloads: DownloadTable;
|
||||
}
|
||||
|
||||
@@ -15,12 +15,6 @@ class CollaborationService {
|
||||
.where('id', '=', revocation.nodeId)
|
||||
.execute();
|
||||
|
||||
await tx
|
||||
.deleteFrom('collaborations')
|
||||
.where('user_id', '=', userId)
|
||||
.where('node_id', '=', revocation.nodeId)
|
||||
.execute();
|
||||
|
||||
await tx
|
||||
.deleteFrom('node_transactions')
|
||||
.where('node_id', '=', revocation.nodeId)
|
||||
|
||||
@@ -235,7 +235,7 @@ class SynapseService {
|
||||
.where('cr.user_id', '=', userId)
|
||||
.where('cr.version', '>', BigInt(state.cursor))
|
||||
.orderBy('cr.version', 'asc')
|
||||
.limit(20)
|
||||
.limit(50)
|
||||
.execute();
|
||||
|
||||
if (unsyncedRevocations.length === 0) {
|
||||
|
||||
@@ -5,21 +5,4 @@ export type NodeTransactionCreatedEvent = {
|
||||
workspaceId: string;
|
||||
};
|
||||
|
||||
export type CollaborationCreatedEvent = {
|
||||
type: 'collaboration_created';
|
||||
userId: string;
|
||||
nodeId: string;
|
||||
workspaceId: string;
|
||||
};
|
||||
|
||||
export type CollaborationUpdatedEvent = {
|
||||
type: 'collaboration_updated';
|
||||
userId: string;
|
||||
nodeId: string;
|
||||
workspaceId: string;
|
||||
};
|
||||
|
||||
export type Event =
|
||||
| NodeTransactionCreatedEvent
|
||||
| CollaborationCreatedEvent
|
||||
| CollaborationUpdatedEvent;
|
||||
export type Event = NodeTransactionCreatedEvent;
|
||||
|
||||
Reference in New Issue
Block a user