Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Add `withInitScripts` to the SQL database modules

Abierto
#1,574 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
67/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
docker, typescript
Área
databases

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
2.6k
Forks
274
Merge medio
1 d 14 h
PR fusionados (30 d)
44

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de testcontainers/testcontainers-node

Todos los issues de testcontainers/testcontainers-node

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.