Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ограничить размер строковых колонок в бд (#165)
Во время реализации эндпойнта регистрации (#88) были добавлены модели Account и Profile, содержащие колонки со строковым типом данных. Но при этом не были выставлены ограничения длины этих строк. В рамках этой задачи необходимо добавить ограничения длины для колонок строкового типа согласно DDD модели данных. --- **Особенности реализации** В процессе работы над задачей выяснилось, что алембик не может обнаружить изменения типа, которое нам было нужно: varchar -> varchar(42), поэтому миграция была написана вручную. Подробнее об особенности работы алембика в данном случае можно почитать в [обсуждении](sqlalchemy/alembic#1256) в репозитории самого алембика. Здесь же, на всякий случай процитирую основной ответ, закрывающий это обсуждение: > **zzzeek** (maintainer): > > PG allows for unlengthed VARCHAR. the alembic type comparison rules are set so that they only report a "positive" if two parameters don't match. if the number of parameters are different, it does not attempt to guess, so in this case VARCHAR and VARCHAR(6) have a different number of parameters; it's a negative. the overarching priority is to not produce false positives, since a false negative means editing a single migration file to fix for the miss, but a false positive means editing every migration file.
- Loading branch information