-
Notifications
You must be signed in to change notification settings - Fork 134
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
Fix MySQL case-insensitive search, order by id when looking for next short code #17
Conversation
Hu1-Li
commented
May 17, 2018
- fix bug when getting latest short code using order by link.id
- fix bug when comparing two short code using collate
1. fix bug when getting latest short code using order by link.id 2. fix bug when comparing two short code using collate
Tested using sqlite3 and mysql; Psql is not tested.
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.
Sorry for not getting back early. Please make comment changes, squash the commits in one and rebase the branch with the master when done.
src/pygmy/model/link.py
Outdated
table=Link.__tablename__ | ||
) | ||
).execute_if(dialect='mysql') | ||
) |
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.
I am sure it would be a good idea to write migrations here. This will clutter the code.
Instead of doing alter table we after the table is created one solution is to do
if config.database['engine'] == 'mysql':
short_code_data_type = Unicode(6, collation="utf8_bin")
else:
short_code_data_type = Unicode(6)
short_code = Column(short_code_data_type, unique=True, index=True, default=None)
This handles MySql case. As postgresql and sqliet are already case sensitive.
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.
This will also require moving DatabaseFactory
import in initialize.py to initialize_db
function.
Fixes #15 Squashed your commits and fixed with commit 67260ba @Hu1-Li your initial Thanks for fixing this. |