Skip to content

Add field option for case-insensitivity (#200)#202

Open
abeverley wants to merge 3 commits into
dbsrgits:masterfrom
abeverley:200_case_insensitive
Open

Add field option for case-insensitivity (#200)#202
abeverley wants to merge 3 commits into
dbsrgits:masterfrom
abeverley:200_case_insensitive

Conversation

@abeverley

Copy link
Copy Markdown
Contributor

This PR adds a field option for case-insensitivity. Whilst this behavior would normally be controlled with collation options, some databases have case-specific options or extensions and it is useful to be able to support these. In my case, I am using SQL::Translator to deploy to a SQLite database and the COLLATE NOCASE options need to be provided as part of the field creation.

Comments/thoughts welcome if there is a better way to achieve this.

@abeverley

Copy link
Copy Markdown
Contributor Author

This is related to issue #200.

@rabbiveesh

Copy link
Copy Markdown
Contributor

Hey, this is great - could you just make it warn if it gets inconsistent data; meaning in the case that the postgres gets weird data where the case insensitive flag is on for a non-text col, it should proceed to make it citext but at least warn

@abeverley

Copy link
Copy Markdown
Contributor Author

Thanks for the prompt review. I've added the warning now (only for Pg; SQLite seems to accept the option for any type of field). This means that the test is (rightly) emitting a warning - would you like me to try and silence that somehow?

@rabbiveesh

Copy link
Copy Markdown
Contributor

best option is to assert that the test warns :)

@abeverley

Copy link
Copy Markdown
Contributor Author

best option is to assert that the test warns :)

Makes sense! Well, I learnt a new module today, I assume Test::Warn is best for this. Now updated.

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.

2 participants