-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support DB servers with lower_case_table_names=1 or 2 (Windows / MacOS)
This commit adds initial support for database servers with non-zero values for lower_case_table_names ("LCTN" below), typically meaning a database instance running natively on Windows or MacOS. These OSes use case-insensitive file- systems by default, which previously caused problems in Skeema if any table names included uppercase characters in their .sql CREATE statement, or any schema names included uppercase characters in .skeema files. The following changes are included in this commit: * In all commands, Skeema can now properly map *.sql CREATE statements to introspected database objects even if the server uses LCTN=1 or LCTN=2 and the objects have mixed-case names. * When using workspace=docker, if the real database server uses LCTN=1, any newly-created Dockerized database instance will be configured to use LCTN=1 as well. (No equivalent behavior is needed for LCTN=2, since that mode retains table name casing.) * With LCTN=1 or LCTN=2, all operations will confirm that there are no case- insensitive duplicate table names among the tables in a single subdirectory's *.sql files. For example, if a directory contains both CREATE TABLE Foo and CREATE TABLE foo, this is illegal with LCTN=1 or LCTN=2 and an error is now thrown before the operation is even attempted. With LCTN=0, this situation is still permitted (these are distinct tables case-sensitive i.e. on a Linux database server) and no error is thrown. * When using `skeema diff` or `skeema push` in a sharded environment (the .skeema file configures the subdir to map to multiple hosts in the same environment name), all shards must have the same LCTN value. If not, Skeema detects this situation and throws a fatal error. * Integration test coverage for LCTN=1 is included. By default it is run in CI but not locally; to enable locally set env var SKEEMA_TEST_LCTN=true. This adds to test execution time since a separate Dockerized database instance must be created for this test. * Integration test coverage for LCTN=2 is included. By default it is not run, as it requires a MacOS host to be possible to test. To enable locally, set env var SKEEMA_TEST_LCTN=true on a MacOS host. This adds to test execution time since a separate Dockerized database instance must be created for this test, and it must bind-mount a host path for the DB's data directory to use a case-insensitive data volume. Fixes #65. Several additional changes specific to views are omitted here, since Skeema Community Edition does not support views. In the upcoming v1.8 release, the Premium Edition CLI will include all changes from this commit, plus additional views-specific fixes and integration testing. On MariaDB in particular, when using LCTN=2 and a mixed-case schema name, SHOW CREATE VIEW has some odd bugs; the Premium Edition CLI properly detects this and uses a workaround to ensure correct behavior even in that situation.
- Loading branch information
Showing
12 changed files
with
572 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.