chore: add assets/attachments DB migration, CLI docs, and lockfile
Add migration 0010 for assets and issue_attachments tables, update CLI documentation with storage configuration section, and sync pnpm lockfile. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
14
doc/CLI.md
14
doc/CLI.md
@@ -119,6 +119,7 @@ Default local instance root is `~/.paperclip/instances/default`:
|
||||
- config: `~/.paperclip/instances/default/config.json`
|
||||
- embedded db: `~/.paperclip/instances/default/db`
|
||||
- logs: `~/.paperclip/instances/default/logs`
|
||||
- storage: `~/.paperclip/instances/default/data/storage`
|
||||
- secrets key: `~/.paperclip/instances/default/secrets/master.key`
|
||||
|
||||
Override base home or instance with env vars:
|
||||
@@ -126,3 +127,16 @@ Override base home or instance with env vars:
|
||||
```sh
|
||||
PAPERCLIP_HOME=/custom/home PAPERCLIP_INSTANCE_ID=dev pnpm paperclip run
|
||||
```
|
||||
|
||||
## Storage Configuration
|
||||
|
||||
Configure storage provider and settings:
|
||||
|
||||
```sh
|
||||
pnpm paperclip configure --section storage
|
||||
```
|
||||
|
||||
Supported providers:
|
||||
|
||||
- `local_disk` (default; local single-user installs)
|
||||
- `s3` (S3-compatible object storage)
|
||||
|
||||
37
packages/db/src/migrations/0010_stale_justin_hammer.sql
Normal file
37
packages/db/src/migrations/0010_stale_justin_hammer.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
CREATE TABLE "assets" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"company_id" uuid NOT NULL,
|
||||
"provider" text NOT NULL,
|
||||
"object_key" text NOT NULL,
|
||||
"content_type" text NOT NULL,
|
||||
"byte_size" integer NOT NULL,
|
||||
"sha256" text NOT NULL,
|
||||
"original_filename" text,
|
||||
"created_by_agent_id" uuid,
|
||||
"created_by_user_id" text,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "issue_attachments" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"company_id" uuid NOT NULL,
|
||||
"issue_id" uuid NOT NULL,
|
||||
"asset_id" uuid NOT NULL,
|
||||
"issue_comment_id" uuid,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "assets" ADD CONSTRAINT "assets_created_by_agent_id_agents_id_fk" FOREIGN KEY ("created_by_agent_id") REFERENCES "public"."agents"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "issue_attachments" ADD CONSTRAINT "issue_attachments_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "issue_attachments" ADD CONSTRAINT "issue_attachments_issue_id_issues_id_fk" FOREIGN KEY ("issue_id") REFERENCES "public"."issues"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "issue_attachments" ADD CONSTRAINT "issue_attachments_asset_id_assets_id_fk" FOREIGN KEY ("asset_id") REFERENCES "public"."assets"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "issue_attachments" ADD CONSTRAINT "issue_attachments_issue_comment_id_issue_comments_id_fk" FOREIGN KEY ("issue_comment_id") REFERENCES "public"."issue_comments"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "assets_company_created_idx" ON "assets" USING btree ("company_id","created_at");--> statement-breakpoint
|
||||
CREATE INDEX "assets_company_provider_idx" ON "assets" USING btree ("company_id","provider");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "assets_company_object_key_uq" ON "assets" USING btree ("company_id","object_key");--> statement-breakpoint
|
||||
CREATE INDEX "issue_attachments_company_issue_idx" ON "issue_attachments" USING btree ("company_id","issue_id");--> statement-breakpoint
|
||||
CREATE INDEX "issue_attachments_issue_comment_idx" ON "issue_attachments" USING btree ("issue_comment_id");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "issue_attachments_asset_uq" ON "issue_attachments" USING btree ("asset_id");
|
||||
3929
packages/db/src/migrations/meta/0010_snapshot.json
Normal file
3929
packages/db/src/migrations/meta/0010_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -71,6 +71,13 @@
|
||||
"when": 1771534211029,
|
||||
"tag": "0009_fast_jackal",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 10,
|
||||
"version": "7",
|
||||
"when": 1771605173513,
|
||||
"tag": "0010_stale_justin_hammer",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
1351
pnpm-lock.yaml
generated
1351
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user