0

We have a few engineers all working on the same database.

When one runs alembic revision -m 'name'

We get FAILED: Multiple heads are present; please specify the head revision on which the new revision should be based, or perform a merge.

Not asking how to solve the direct message, but rather the pattern.

Not really concerned with merge conflicts, more with the ability to work and add items without having to fiddle around a bunch.

How is the person to know which revision to use? Is there a way to get around this?


We have a similar issue in the context of a production database. If we have multiple pull requests merging to master, then we want to update the production db near when the pull request merges. But the revision identifiers from say a sandbox db won't match. So the whole (revision id concept) just feels confused then?


Is there a whole different approach to using it for production vs development?

oooiiiii
  • 302
  • 2
  • 11
  • By "same database", do you mean you're running Alembic against a shared database server and DB instance? Because for development purposes, those databases should probably be running locally (or otherwise be private). – Dai Dec 23 '20 at 02:12
  • Yes shared. Sure. But we have a similar issue in the context of a production database. If we have multiple pull requests merging to master, then we want to update the production db near when the pull request merges. But the revision identifiers from say a sandbox db won't match. So the whole (revision id concept) just feels confused then? – oooiiiii Dec 23 '20 at 02:18
  • " then we want to update the production db near when the pull request merges" - oh god no, no, no, no. – Dai Dec 23 '20 at 02:19
  • if there is a best practice in this context please point to it – oooiiiii Dec 23 '20 at 02:24
  • I think you should repost this to dba.stackexchange as production DB schema change management is more of a DBA responsibility. – Dai Dec 23 '20 at 03:24
  • @dai - since this is about client-side programming, it's not on-topic for dba.stackexchange.com – Hannah Vernon Jan 13 '21 at 13:02
  • @MaxVernon There is absolutely nothing in this question about "client-side programming" - where are you getting that from? The OP has said this is in the context of database schema change tracking and they're using Alembic - that's all in the field of server-side databases. – Dai Jan 13 '21 at 13:03
  • @Dai - This is the tag-wiki for [tag:Alembic] - "Alembic is a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python." Python is client-side unless you're talking strictly about using it inside the database engine, as in how SQL Server can execute python code internally. In this instance, the OP is asking how to get Alembic working with *multiple developers*. Developers + Python ergo client-side. – Hannah Vernon Jan 13 '21 at 14:47
  • I made the question on https://dba.stackexchange.com/questions/282093/how-can-multiple-engineers-effectively-change-database-schema more generic. With this question the concern is more about the production DBs – oooiiiii Jan 14 '21 at 01:44

0 Answers0