Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/slimy-mice-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/attachments': minor
---

Added `attachmentTableName` option to attachment queue which allows you to specify the table name it should work with.
12 changes: 9 additions & 3 deletions packages/attachments/src/AbstractAttachmentQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ export interface AttachmentQueueOptions {
*/
cacheLimit?: number;
/**
* The name of the directory where attachments are stored on the device, not the full path
* The name of the directory where attachments are stored on the device, not the full path. Defaults to `attachments`.
*/
attachmentDirectoryName?: string;

/**
* The name of the table where attachments are stored, defaults to `attachments` table.
*/
attachmentTableName?: string;
/**
* Whether to mark the initial watched attachment IDs to be synced
*/
Expand All @@ -36,7 +41,8 @@ export interface AttachmentQueueOptions {
}

export const DEFAULT_ATTACHMENT_QUEUE_OPTIONS: Partial<AttachmentQueueOptions> = {
attachmentDirectoryName: 'attachments',
attachmentDirectoryName: ATTACHMENT_TABLE,
attachmentTableName: ATTACHMENT_TABLE,
syncInterval: 30_000,
cacheLimit: 100,
performInitialSync: true,
Expand Down Expand Up @@ -90,7 +96,7 @@ export abstract class AbstractAttachmentQueue<T extends AttachmentQueueOptions =
}

get table() {
return ATTACHMENT_TABLE;
return this.options.attachmentTableName!;
}

async init() {
Expand Down