-
Notifications
You must be signed in to change notification settings - Fork 115
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
Full stack mysql test environment #321
Conversation
added mysql test container dependencies
TestContainers.scala: created container definition as part of the mysql project. We may want to move and merge this file with postgresql version in a common location. shop_schema.sql: called by TestContainer to bootstrap test data in docker instance.
fd48d57
to
af12376
Compare
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.
Awesome work thanks @andrewhj! Noting my comments here #69 (comment) can you please remove the "simple" table and use one of the existing tables instead? Other than that I think this is good to merge!
yes I can do that. I added the simple table because the task started expanding further away from the original intent. Mysql either doesn't support (or supports differently) the concept of uuid for example so I changed the id columns to varchar. Is that ok? Going in with that in mind, I'll work on matching up the rows and tests to postgres data example. |
Varchar is horribly inefficient for storing UUIDs. Perhaps changing them to Ints for now would be better? A bit of a pain on the test data but find replace on the primary column wouldn't be amazingly terrible. I think down the track we should probably have something more like binary(16) as described here https://mysqlserverteam.com/storing-uuid-values-in-mysql-tables/ and take care of the conversion. That would be transparent when using zio-sql for queries but makes hand writing queries much harder. Might be a good justification for allowing users to define how they want to store types. |
Created mysql environment heavily insipred (copy/pasted) by the postgres module. MysqlModule.scala: performs the conversion of zio-sql functions into mysql compatible sql. Currently a copy/paste & rename of the postgres module. FunctionDefSpec.scala: module for testing mysql functions (lower, sin, etc.) MysqlModuleTest.scala: runs mysql tests, table selects, limits, offset, etc. MysqlRunnableSpec.scala: ShopSchema.scala: defines schema (loaded in test container definition)
af12376
to
8b717f5
Compare
well, that was a mistake. I'll work through the merge issues. I had tests working with varchar storing UUID. I think that is a nice spot despite the mentioned inefficiency of varchar. The tests remain closer to postgresql examples. If we really want to convert to using ints instead of varchar/uuid, I can work on that next. It requires changes to ShopSchema, shop_schema.sql, and the MysqlRunnableSpec. |
GroupByHavingSpec: reformatted in order to fix sbt check failure
MysqlModule: added stubs for new renderUpdate/renderDelete methods that have been added to Jdbc. MysqlRunnableSpec: added DeleteExecutor to the jdbcTestEnvironment
9cafd97
to
5d9d4b1
Compare
Full stack mysql test environment
Fixes #69
Created mysql environment heavily insipred (copy/pasted) by the postgres
module.
MysqlModule.scala: performs the conversion of zio-sql functions into
mysql compatible sql. Currently a copy/paste & rename of the postgres
module.
FunctionDefSpec.scala: module for testing mysql functions (lower, sin,
etc.)
MysqlModuleTest.scala: runs mysql tests, table selects, limits, offset,
etc.
MysqlRunnableSpec.scala:
ShopSchema.scala: defines schema (loaded in test container definition)