Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement with_init_sql for Postgres, Mysql and Mariadb #182

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

CommanderStorm
Copy link
Contributor

@CommanderStorm CommanderStorm commented Aug 19, 2024

Resolves #164

The implementation is a bit hacky, am open to better approaches or other feedback ^^

The implementation is pretty straigtforeward and similar to #217

src/postgres/mod.rs Outdated Show resolved Hide resolved
src/postgres/mod.rs Outdated Show resolved Hide resolved
@DDtKey
Copy link
Contributor

DDtKey commented Aug 20, 2024

Thank you for the contribution! ❤️
Left a couple of suggestions that could significantly expand the capabilities of the crate, but they need to be discussed and possibly postponed

@CommanderStorm CommanderStorm marked this pull request as draft August 20, 2024 13:38
@DDtKey
Copy link
Contributor

DDtKey commented Sep 25, 2024

Now it's possible with with_copy_to:

         image.with_copy_to(
            "/docker-entrypoint-initdb.d/init.sql",
            include_bytes!("initdb.sql").to_vec(),
        )

Which I found simple enough.
So we can actually provide a guidance and probably shortcut for it. May simplify work done here

@CommanderStorm
Copy link
Contributor Author

Yea that definitely cleans things up a ton. Thanks 🙏
Sorry for the lacking progress, I was on vacation for the last month and am still in a bit of a catch-up mode work wise.

=> This PR might take a few weeks before I can actually invest the time it deserves

@CommanderStorm CommanderStorm changed the title feat: implemented Postgres::with_init_sql feat: implemented Self::with_init_sql Sep 25, 2024
src/postgres/mod.rs Outdated Show resolved Hide resolved
@CommanderStorm CommanderStorm marked this pull request as ready for review September 25, 2024 14:53
@CommanderStorm CommanderStorm force-pushed the postgres-init branch 2 times, most recently from 9565042 to c8cb10a Compare September 25, 2024 15:21
src/mariadb/mod.rs Outdated Show resolved Hide resolved
@CommanderStorm CommanderStorm changed the title feat: implemented Self::with_init_sql feat: implement Self::with_init_sql Sep 25, 2024
@CommanderStorm CommanderStorm changed the title feat: implement Self::with_init_sql feat: implement Self::with_init_sql for postgres, mysql and mariadb Sep 25, 2024
@CommanderStorm CommanderStorm changed the title feat: implement Self::with_init_sql for postgres, mysql and mariadb feat: implement Postgres::with_init_sql, Mysql::with_init_sql and and Mariadb::with_init_sql` Sep 25, 2024
@CommanderStorm CommanderStorm changed the title feat: implement Postgres::with_init_sql, Mysql::with_init_sql and and Mariadb::with_init_sql` feat: implement Postgres::with_init_sql, Mysql::with_init_sql and Mariadb::with_init_sql Sep 25, 2024
@DDtKey DDtKey changed the title feat: implement Postgres::with_init_sql, Mysql::with_init_sql and Mariadb::with_init_sql feat: implement with_init_sql for Postgres, Mysql and Mariadb Sep 25, 2024
src/mariadb/mod.rs Outdated Show resolved Hide resolved
@DDtKey DDtKey merged commit 674a926 into testcontainers:main Sep 26, 2024
5 of 6 checks passed
@github-actions github-actions bot mentioned this pull request Sep 26, 2024
@CommanderStorm CommanderStorm deleted the postgres-init branch September 26, 2024 15:07
DDtKey pushed a commit that referenced this pull request Sep 26, 2024
## 🤖 New release
* `testcontainers-modules`: 0.11.0 -> 0.11.1 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.11.1] - 2024-09-26

### Documentation

- Disallow missing docs on crate level and allow where necessary
([#222](#222))

### Features

- Implement `with_init_sql` for `Postgres`, `Mysql` and `Mariadb`
([#182](#182))
- Tls certs and ldif file
([#217](#217))

<!-- generated by git-cliff -->
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

initSQL for postgres container
2 participants