lagom-samples icon indicating copy to clipboard operation
lagom-samples copied to clipboard

Merge schemas?

Open TimMoore opened this issue 6 years ago • 6 comments

I noticed that the deployment scripts for shopping cart were moved up a level, outside of the Java/Scala specific projects.

Should we do the same for the "schemas" directory?

https://github.com/lagom/lagom-samples/blob/1.5.x/shopping-cart/shopping-cart-java/schemas/shopping-cart.sql https://github.com/lagom/lagom-samples/blob/1.5.x/shopping-cart/shopping-cart-scala/schemas/shopping-cart.sql

(They're identical)

TimMoore avatar Jul 11 '19 05:07 TimMoore

Yes, sure.

octonato avatar Jul 11 '19 06:07 octonato

I think the best location is shopping-cart/deploy/scripts/sql/ (or ddl/). I'd also split and rename into write-side.sql and read-side.sql (or something like that).

Then, there's also some SQL for schema creation embedded in the .sh scripts.

ignasi35 avatar Jul 11 '19 07:07 ignasi35

@ignasi35 why do you think it's better to split into two files?

TimMoore avatar Jul 11 '19 22:07 TimMoore

@ignasi35 why do you think it's better to split into two files?

I like having smaller, more clear pieces: a sql file for the journal and snapshots and another one for the offset store and, finally, the third one for user-provided tables. Then, if we think it's useful, a fourth one (preceding them all) to create the database schema(s).

This will be a pattern easy to reproduce in, for example, the mixed-persistence samples where read-side and write-side use different technologies.

ignasi35 avatar Jul 12 '19 07:07 ignasi35

Works for me. Any objections?

(I'm doing a revision of the deployment guide, so I'll sync that up with this.)

TimMoore avatar Jul 12 '19 09:07 TimMoore

I'm fine with it.

octonato avatar Jul 12 '19 15:07 octonato