@shumai-one/shumai 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ -- Enable iterative index scans for HNSW so filtered queries don't fall back to seq scan.
2
+ -- Uses current_database() so this works across all environments without hardcoding the DB name.
3
+ -- ALTER DATABASE ... SET persists the GUC for all future connections to this database.
4
+ DO $$
5
+ BEGIN
6
+ EXECUTE format('ALTER DATABASE %I SET hnsw.iterative_scan = ''relaxed_order''', current_database());
7
+ END;
8
+ $$;
9
+
10
+ -- CreateIndex: HNSW index on asset_embeddings.embedding
11
+ -- Uses cosine distance ops (suited for normalized OpenAI-style embeddings)
12
+ -- m=16: controls graph connectivity (higher = better recall, more memory)
13
+ -- ef_construction=64: build-time search width (higher = better quality, slower build)
14
+ CREATE INDEX "AssetEmbedding_embedding_idx"
15
+ ON "asset_embeddings"
16
+ USING hnsw (embedding vector_cosine_ops)
17
+ WITH (m = 16, ef_construction = 64);
@@ -0,0 +1,17 @@
1
+ -- Create ICU collation for natural sort (numbers sort by value, not lexicographically)
2
+ -- Named 'natural_sort' to avoid conflict with the 'numeric' reserved keyword / built-in type in PostgreSQL
3
+ DO $$
4
+ BEGIN
5
+ IF NOT EXISTS (SELECT 1 FROM pg_collation WHERE collname = 'natural_sort') THEN
6
+ CREATE COLLATION natural_sort (provider = icu, locale = 'en@colNumeric=yes');
7
+ END IF;
8
+ END;
9
+ $$;
10
+
11
+ -- Alter assets.name to use the natural_sort collation
12
+ -- This makes all ORDER BY name queries (ORM and raw SQL) use natural sort automatically
13
+ ALTER TABLE "assets" ALTER COLUMN "name" TYPE TEXT COLLATE natural_sort;
14
+
15
+ -- CreateIndex: B-tree index on name using the natural_sort collation
16
+ -- Supports efficient ORDER BY name ASC/DESC without seq scans
17
+ CREATE INDEX "assets_name_idx" ON "assets" ("name" COLLATE natural_sort);
@@ -0,0 +1,2 @@
1
+ -- AlterEnum
2
+ ALTER TYPE "WorkflowTaskType" ADD VALUE 'agent_tool_call';
@@ -0,0 +1,6 @@
1
+ -- AlterTable
2
+ ALTER TABLE "agent_sessions" ADD COLUMN "asset_id" TEXT,
3
+ ADD COLUMN "user_comment_id" TEXT;
4
+
5
+ -- AddForeignKey
6
+ ALTER TABLE "agent_sessions" ADD CONSTRAINT "agent_sessions_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,11 @@
1
+ -- AlterTable
2
+ ALTER TABLE "collections" ADD COLUMN "creator_id" TEXT;
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "share_links" ADD COLUMN "creator_id" TEXT;
6
+
7
+ -- AddForeignKey
8
+ ALTER TABLE "share_links" ADD CONSTRAINT "share_links_creator_id_fkey" FOREIGN KEY ("creator_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
9
+
10
+ -- AddForeignKey
11
+ ALTER TABLE "collections" ADD CONSTRAINT "collections_creator_id_fkey" FOREIGN KEY ("creator_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,3 @@
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "postgresql"