pallets-eco / flask-sqlalchemy

Adds SQLAlchemy support to Flask
https://flask-sqlalchemy.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
4.18k stars 896 forks source link

Default naming convention #1352

Open yuxiaoy1 opened 2 days ago

yuxiaoy1 commented 2 days ago

The naming convetion mentioned in docs is useful in some migration situations, would it be better to set it as default?

davidism commented 2 days ago

It would break all existing databases that were created with the default. Fairly sure that’s why it wasn’t changed in SQLAlchemy either.

davidism commented 2 days ago

I have thought about adding the suggested value as something that can be imported. Perhaps a subclass that uses that value if nothing is passed.

yuxiaoy1 commented 2 days ago

Maybe a new metadata object MetaDataWithNamingConvetion? then the db can be initialized as db = SQLAlchemy(metadata=MetaDataWithNamingConvetion)