Amazing Tool For Handling Database Migrations In Golang
Vložit
- čas přidán 2. 05. 2024
- ► Join my Discord community for free education 👉 / discord
► Exclusive Videos, Mini courses, Resume reviews, and coaching 👉 thetotalcoder.com
► 33% OFF on my Go + HTMX + Templ Course 👉bit.ly/3UFruxO
► Enjoy a 60% Black Friday Discount on My Golang Course 👉 fulltimegodev.com
► Follow me on Twitter 👉 / anthdm
► Follow me on GitHub 👉 github.com/anthdm
SUBSCRIBE OR NO MARGARITAS
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
► 33% OFF on my Go + HTMX + Templ Course PRESALE bit.ly/3UFruxO
► Exclusive Videos, Mini courses, Resume reviews, and coaching thetotalcoder.com
► Join my Discord community for free education discord.com/invite/Ac7CWREe58
► 60% OFF on my Golang course fulltimegodev.com
Goose GitHub: github.com/pressly/goose
Thanks for watching
From the video I'm not sure in what way goose is different from go migrate? Other than it being more 'batteries included' it seems.
Personally I use 'atlas' for my migrations
what's the advantage?
I literally just used it for the first time before seeing this! It's pretty easy to use.
This is nice. Wanted to try dbmate next after go migrate but I think I might go with goose now.
What’s wrong with GORM auto migration ?
I have been using goose for last few go projects😊
@anthonygg this is great and all, but how do you apply them in production? Do you use Github Actions, or some sort of serverless function in whatever cloud provider, or do you just execute migration on init of your service? If on init of the service, how do you handle that init when you scale the service?
Migrations are done manually.
Really nice video . Can you make a video an optimal solution on how to implement a background download process. When user request multiple download(restrict the duplicate requests). the requests will be sent to the server it can be add it in the queue and process in the background job. User can view the progress of the download in the frontend and the status of the download. Appreciate your work 👏
You missed adding the goose URL in the description as promised
I use liquibase, pretty nice
I have used goose before, and it's great. But when I switched to Bun for my db queries (I had issues with sqlx and the basic go sql is a pita) I just also switched to their migration system. Just to keep it lean.
One has to make sure to always write "CREATE TABLE IF NOT EXISTS" when you switch db migration tools.
hey anthony, what theme do you use for vs code? looks nice
Gruvbox
What do You think about sqlc, to manage db operations in go?
It’s good for making focused functions, but if you try to make general dynamic repositories it’s really hard to set up. But it’s pretty solid overall.
Personally i never found using sql fun for migration. If i want to create a migration, I'll make sure its just simple. So my go to migration solution is actually laravel zero (laravel CLI only). So far laravel has the most complete yet easy when it comes to database related
The minus is we need to keep up yet another repo for our migration. But for my personal experience, it was never an issue
how is go migrate in comparison to this ?
Its a bit harder to setup. Goose just makes sense
Last time I tried go-migrate it was pretty bad. Because of the order it uses to apply migrations but also it frequently put my migrations into a "dirty" state where I was unable to then apply more migrations or rollback
@@dandogamer I also don't like that gomigrate only maintains the current schema version id. Could be an issue when multiple people are generating migrations and the migrations hit "out of sequence".
atlas ftw
I wish this guy would take the time to learn how to type
I cant due to my ADD, and ADHD. This is no joke. The reason this happens is because my mind is already processing the next step, hence failing to coordinate the next letter to type. I tried with slowing down, but that not always helps. 😓
Tips welcome
I wasn't using migration tools, but am working on a big refactor and will eventually need to migrate. This is totally useful.
Maybe run us through an example? Pls not a 1 hour video tho, even when Prime does it, bro I need to feed my kids 😂
Try to use laravel zero