MENU

Fun & Interesting

Go Database Migrations with Goose and PostgreSQL

BugBytes 5,365 5 months ago
Video Not Working? Fix It Now

Playlist ▶️: https://www.youtube.com/playlist?list=PL-2EBeDYMIbR1ag15E2MonJOj_cCIjUnd In this video, we'll look at the goose package for database migrations in Go. We'll see how to connect to a PostgreSQL database using Docker, and how to manage the database schema using migrations. ☕️ ??? ?? ? ??????: To support the channel and encourage new videos, please consider buying me a coffee here: https://ko-fi.com/bugbytes ? ????????: 00:00 Intro 01:04 Installing Goose 03:03 Creating migrations with goose create command 05:52 Setting up Postgres Docker container 07:27 Applying migrations with goose up command 10:32 Reverting migrations with goose down command 11:42 Adding more complex migration with Foreign Keys 15:06 Passing DBSTRING and DRIVER as environment variables 17:56 Creating test data in migration 19:01 Querying data using Go sql module ?????? ?????: ? Blog: https://bugbytes.io/posts/ ? Github: https://github.com/bugbytes-io ? Twitter: https://twitter.com/bugbytesio ? ??????? ??????? ??? ???????????: Goose: https://github.com/pressly/goose Docker Hub Postgres: https://hub.docker.com/_/postgres VSCode PostgreSQL extension: https://marketplace.visualstudio.com/items?itemName=ckolkman.vscode-postgres pq driver: https://github.com/lib/pq Go database/sql package: https://pkg.go.dev/database/sql #golang #webdevelopment #database #sql

Comment