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

Add `withInitScripts` to the SQL database modules

Đang mở
#1,574 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
67/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, typescript
Lĩnh vực
databases

Hướng nghiên cứu

Start in the module source directories listed in the issue, and check how each database image handles initialization scripts; Java and Go examples are linked in the notes. Implement withInitScripts(...paths) in one module, preserving the supplied order and using its image init directory or database CLI as appropriate. Done means scripts run in order for that module; coordinate the method name with issue #1538.

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

Mô tả

enhancement minor

What happens

None of the SQL database modules has a way to run a schema or seed script at startup. Their builder methods are limited to credentials and the database name:

Module Builder methods
postgresql withDatabase, withUsername, withPassword, withSSL, withSSLCert
mysql, mariadb withDatabase, withUsername, withUserPassword, withRootPassword
mssqlserver withDatabase, withPassword, withWaitForMessage
cockroachdb withDatabase, withUsername
clickhouse, oraclefree withDatabase, withUsername, withPassword

Users copy files into the image's init directory themselves, which means knowing that directory for each image:

new PostgreSqlContainer(image).withCopyFilesToContainer([
  { source: "./schema.sql", target: "/docker-entrypoint-initdb.d/schema.sql" },
]);

For images with no init directory (SQL Server), it means running the script with exec after start.

Expected

withInitScripts(...paths) on each SQL module, run in the order given, using the image's init directory where there is one and the database's CLI otherwise.

Where

packages/modules/{postgresql,mysql,mariadb,mssqlserver,cockroachdb,clickhouse,oraclefree}/src.

Notes

  • Java has withInitScript and withInitScripts on JdbcDatabaseContainer, shared by every JDBC module. Go has WithInitScripts and WithOrderedInitScripts on postgres and WithScripts on mysql.
  • Each module is an independent change.

Dependencies

  • Nothing blocks this. It can start now.
  • Coordinate with #1538: for the method name.
Ngôn ngữ chính
TypeScript
Star
2.6k
Fork
274
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
44

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 testcontainers/testcontainers-node

Tất cả issue của testcontainers/testcontainers-node

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.