-
Notifications
You must be signed in to change notification settings - Fork 16
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
ZIO Module example app #97
base: master
Are you sure you want to change the base?
Conversation
@guizmaii @AugustNagro, hey guys, please take a look if you are okay with the example. It's probably not the best, but it's a start. And I updated it with @guizmaii's change to the Transactor layer from #93. |
Just chiming in, after #100 is merged into the library, it might be better to show a proper PG enum in the example instead of having Depending on how far off 2.0.0 is, might be better to update and then merge. |
@KaranAhlawat, it makes sense. I am okay with waiting for #100. |
magnum-zio-example/src/main/scala/com/augustnagro/magnum/magzio/example/ExampleZioApp.scala
Outdated
Show resolved
Hide resolved
sql"create table if not exists car (id serial primary key, model text, top_speed int, vin int, color text, created timestamp)" | ||
.update | ||
.run() | ||
|
||
sql"create table if not exists owner (id serial primary key, name text, car_id int references car(id))" | ||
.update | ||
.run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be nicer if we were using something like flyway
. Would be more realistic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guizmaii, do you prefer a programmatic way to run flyway
or maybe a docker-compose way in pairs with the Postges container? I think the second option resonates more with this @AugustNagro's comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I introduced docker-compose.yml
with PG and Flyway and moved schema creation to the magnum-zio-example/sql/migration/V1__create_schema.sql
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you prefer a programmatic way to run flyway or maybe a docker-compose way in pairs with the Postges container?
I personally prefer the first one. It allows you to write tests testing your migrations (the docker might allow that to? 🤔)
9623308
to
72f2bbc
Compare
Close #90