Replies: 4 comments 2 replies
-
I'd like to start by sharing some of my experiences.
|
Beta Was this translation helpful? Give feedback.
-
We had 6 services all working on the same database. Each service had its "own" tables it was supposed to manage and this sometimes caused troubles, because some of the migration tools wanted to delete everything else, since they thought of the whole database being theirs (doctrine for example).
|
Beta Was this translation helpful? Give feedback.
-
We have five services using the same MongoDB instance, with different databases and users. This architecture simplifies the migrations process since each service is responsible for its changes. |
Beta Was this translation helpful? Give feedback.
-
I'm relative new to auto-migration (only have experience with Hibernate, Ent and a few tests with GORM), so I will not comment about it. Right now we have a few services, a few with database shared. 1. What tools do you use today for migrating your databases - are you happy with them? what is missing in your opinion? Laravel:
Flyway: migrator: I really like that we dont have to provide down migration, quoting the readme:
It makes the migration more like git, where we revert going forward and not backwards, this creates a history if you think about it. To me seems like that down migrations only works for the easy cases, the reversible cases, the cases where a "static migration analyzer" could prevent in the first place. 2. Where and when do you run your migration tool (CI/CD pipeline / init container / manual script / init of service) But if multiple different services talk to the same database, only one is responsible of handling the migration (usually the one that uses the database/schema most). 3. What are the pros and cons of this method It kinda works as a contract, the service is required to work with the migrations embedded on it. 4. What tools did you previously use and did not work well or why did you change? 5. What are the main pain points you find in the migration area today? Which types of failures have you had in the past/today, and what do you wish was exist in the migration area that could solve this problem? Most of the reversible migrations could be generated by the migration engine (and I know that you guys already do something like this today), the hard cases, are already hard for humans and should be impossible for the migration engine. Another point is that when on the early stages of development I try different things, the database schema is one of them, so helpers commands (like the About failures, I dont think is a problem for us right now, we do integration tests that connects and talk to the database, this tests include the migration, so we dont have many problems with it, I mean, we have problems, but it's user/logic error that is fixed before a deploy. Things get complicated with converting from NULL -> NOT NULL/changing column type or if we share the database with different services or even with multiple instances on a rolling deployment. CHANGE COLUMN NAME:
NULL -> NOT NULL:
I'm sure that there is something that could be improved on this process, maybe something with views/instead trigger and maybe this could be handed by the migration engine. And a final note, something like a "golangci-lint" for migrations/SQL would be really cool as well. We already know a few things not to do, when moving to schema first, we get more knowledge of what we are representing on the database/code and eventually we can use it to improve the usage in the first place. |
Beta Was this translation helpful? Give feedback.
-
With Atlas, we aim to provide a complete solution for database migrations.
When developing an application/service with one developer it usually suffices to use simple migration techniques such as the ones that come built-in with most of the popular ORMs out there. but, as teams grow in size, and their infrastructure grows in scale to multiple micro-services and multiple databases, it becomes more complex and error-prone to use this kind of migration tool.
For example, consider a service with a Django backend, a GraphQL server written with NodeJS+Sequelize, both using the same database and even the same tables.
When developing a feature in one microservice (one that requires a DB migration) you have to also make a change to the other repository.
There are many tools and products out there that try to solve this problem, Yet, there is no "golden standard" for DB migrations. everyone seems to solve it their own way.
Atlas, using the HCL format, inspired by Terraform, aims to unify the data schemas across multiple repositories (think about an organization with 3 databases and 10 micro-services in 3 different programming languages and therefore 3 different ORMs).
The goal of this discussion is to provide the stage for the community to propose ideas, features, and suggestions as well as describe what is missing or what is good with other tooling and/or approaches.
We'd love to hear:
This is an open discussion and as such - any feedback is more than welcome 🙂
Thank you,
The team @ Ariga.
Beta Was this translation helpful? Give feedback.
All reactions