Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[ORM] ORM always destroy my manual set indexes. (e.g. when using `pgvector`)

Đang mở
#2,731 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
postgresql, typescript
Lĩnh vực
databases

Hướng nghiên cứu

Reproduce with bun zen migrate dev --create-only after adding an Unsupported("vector(384)") field to schema.zmodel, then add manual HNSW indexes on chunks and rerun bun zen migrate dev. The payload names no source files; the work is in the migration diffing engine that compares the Prisma schema against the live PostgreSQL database and emits DROP statements, so start by locating where migrations are generated and how Unsupported fields are handled. Done means a follow-up migration leaves manually created indexes intact.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description and expected behavior
When using PostgreSQL extensions like pgvector and manually creating indexes in migrations the ORM will automatically roll back these manual changes and want to DROP these indexes.

How to reproduce?

  1. Add a "Unsupported" field to the schema.zmodel
  2. Create a index using `bun zen migrate dev --create-only"
  3. Add indexes manually in this migrations
  4. Run bun zen migrate dev to apply -> In this case the CLI automatically creates another migration which always DROPs these manual indexes (running bun zen migrate deploy mitigates this one time, but after another migrations it automatically drops all manual indexes again)

Environment (please complete the following information):

  • ZenStack version: 3.8.0
  • Database type: PostgreSQL
  • Node.js/Bun version: Bun v1.3.14
  • Package manager: Bun

Sample schema

type Vectors {
    dimensions Int?

    vec384     Unsupported("vector(384)")?
    vec768     Unsupported("vector(768)")?
    vec1024    Unsupported("vector(1024)")?
    vec1536    Unsupported("vector(1536)")?
    vec3072    Unsupported("halfvec(3072)")?
}

model Chunk with Vectors {
  id String @id @default(uuid())
}

Manual indexes in sql

-- ============================================================
-- CHUNKS
-- ============================================================

CREATE INDEX IF NOT EXISTS idx_chunks_vec384
  ON chunks USING HNSW ("vec384" vector_cosine_ops)
  WITH (m = 16, ef_construction = 64);

CREATE INDEX IF NOT EXISTS idx_chunks_vec768
  ON chunks USING HNSW ("vec768" vector_cosine_ops)
  WITH (m = 16, ef_construction = 64);

CREATE INDEX IF NOT EXISTS idx_chunks_vec1024
  ON chunks USING HNSW ("vec1024" vector_cosine_ops)
  WITH (m = 16, ef_construction = 64);

CREATE INDEX IF NOT EXISTS idx_chunks_vec1536
  ON chunks USING HNSW ("vec1536" vector_cosine_ops)
  WITH (m = 16, ef_construction = 64);

-- halfvec braucht halfvec_cosine_ops
CREATE INDEX IF NOT EXISTS idx_chunks_vec3072
  ON chunks USING HNSW ("vec3072" halfvec_cosine_ops)
  WITH (m = 16, ef_construction = 64);
Ngôn ngữ chính
TypeScript
Star
2.9k
Fork
157
Merge trung bình
11 giờ 42 phút
Pull request đã merge (30 ngày)
20

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của zenstackhq/zenstack

Tất cả issue của zenstackhq/zenstack

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.