Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add `withInitScripts` to the SQL database modules

Aperta
#1,574 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
67/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, typescript
Ambito
databases

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
TypeScript
Stelle
2.6k
Fork
274
Merge medio
1g 14h
PR unite (30g)
44

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di testcontainers/testcontainers-node

Tutte le issue di testcontainers/testcontainers-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.