Why so serious about database migration?

Why so serious about database migration?

[Version française ici]

Recently, I discussed how you can move to Cockroach DB. I discussed schema adaptations, application changes, etc.

Those posts weren't really funny to read. So I decided, how can we make database migration fun?

The answer is obvious in 2023... Use ChatGPT!

Starting with CoPilot

I used Github CoPilot to create a simple TODO API in Go to add more "AI" in the process.

Simply describe the purpose of your code, and CoPilot will do everything for you!

In the main, I added a comment to ensure the connection is open.

Everything was written by CoPilot! I simply press ENTER and TAB.


Now the migration

The same way, I didn't write any code. I just go straight to ChatGPT. And here it is:

Was it funny?

I've to admit it was really fun to witness how those two tools can greatly improve some tasks. CoPilot and ChatGPT aren't perfect at all, but they can deal with all the "boring" stuff for you. You just need to put your effort where it's the most valuable.

You still need to understand what's important in your code to ensure the migration will be a success. But it was so easy to have everything rewritten for me, and just add some business logic or specific implementation details I wanted, that this is for me a really good way to accelerate application migration.

Remember that ChatGPT will often break, so try to paste functions per functions, otherwise you won't have a complete rewrite.