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

Тел: +7 965 3737 888

436

Просмотров

2

Ответов

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
file_3940.py(1.1Кб)
None

Ответы (2):

Ответguettli:17.09.2008
Ответ полезен? Да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.

Ответoggy:18.08.2008
Ответ полезен? Да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 :)