Задать вопрос

Тел: +7 965 3737 888





Unittest: Compare max_size with column size of database

Changing the size of max_length in the model is fast. But sometimes you forget to update all running systems which use this model.

This unittest helps you to find the difference between Model and DB before the users get uncaught exceptions.

Вопрос полезен? Да0/Нет0

Ответы (2):

Ответ полезен? Да0/Нет0

I use postgresql and psycopg2. I am sorry if it does not work for you. Since I don't have MySQL here, I can't update this snippet. Please send me a patch if you got it working for you.

Ответ полезен? Да0/Нет0

What database are you using there? That doesn't work in MySQL. First off, you can't use double quotes for quoting identifiers in MySQL (have to use backticks). Furthermore, even with that corrected, I always get internal_size to be reported 3x the max_length parameter.

But other than that, I like the idea :)