Re:Better Database Migrations in Postgres
by robertlagrant on Wednesday September 13, 2017 @06:03AM
(#15236895)
Alembic is amazing, but AFAIK only works with its author's (world-beating) ORM, SQLAlchemy. I didn't think it was a general-purpose database change tool.
[ Parent
| on HN ]
Re:Better Database Migrations in Postgres
by sandGorgon on Wednesday September 13, 2017 @06:15AM
(#15236943)
We use it standalone for our nodejs code. It does pull-in SQL alchemy, but who cares. I think what you are really asking is this - We don't autogenerate migrations from models, we write them explicitly.
There is nothing even close enough in the nodejs world and we wanted to manage our dB properly.
Incidentally, three other nodejs startups that I told this to, also started using Alembic for their migrations.
Re:Better Database Migrations in Postgres
by aidos on Wednesday September 13, 2017 @07:32AM
(#15237249)
You could potentially use SQLA's ability to reflect your db to create the models either to get you started, or maybe in an automated fashion. Im sure there are loads of corner cases where it wouldn't work.
We're happy users of alembic. In general we use it to do the initial grunt work and then manually edit the migrations / split into phases ourselves. For some stuff that Alembic doesn't handle very well (like check constraints) we've extended Alembic to handle those automatically in the way we like.
Re:Better Database Migrations in Postgres
by LyndsySimon on Wednesday September 13, 2017 @09:54AM
(#15238240)
I don't know Alembic well enough to know what features of SQLAlchemy it requires, but I do know that SQLAlchemy consists of quite a bit more than just the ORM features. Perhaps Alembic is using it at a lower level, and can be used with any (or no) ORM layer?