<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-create-database-migrations-in-go-using-docker-and-postgres-gkqnwmiko" -->

---
title: How to Create Database Migrations in Go Using Docker and...
description: Learn how to create and manage database migrations in Go using Docker and Postgres. This guide covers setting up a Docker container, creating a schema with...
canonical: https://daily.dev/posts/how-to-create-database-migrations-in-go-using-docker-and-postgres-gkqnwmiko
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Create Database Migrations in Go Using Docker and Postgres | daily.dev
og:description: Learn how to create and manage database migrations in Go using Docker and Postgres. This guide covers setting up a Docker container, creating a schema with...
og:url: https://daily.dev/posts/how-to-create-database-migrations-in-go-using-docker-and-postgres-gkqnwmiko
og:image: https://api.daily.dev/og/posts/GkqnWmIKO.png
og:image:alt: How to Create Database Migrations in Go Using Docker and Postgres
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Create Database Migrations in Go Using Docker and Postgres

**[freeCodeCamp](https://daily.dev/sources/freecodecamp)** · 8 min read · 41 upvotes · 1 comments

## Summary

Learn how to create and manage database migrations in Go using Docker and Postgres. This guide covers setting up a Docker container, creating a schema with TablePlus, installing golang-migrate, generating migration scripts, and running migrations effectively.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.freecodecamp.org/news/how-to-create-database-migrations-in-go/>

## Community discussion

Top comments from developers on daily.dev.

**@alexlopezt** · 0 upvotes

> Great article. Thank you!!

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#database](https://daily.dev/tags/database), [#golang](https://daily.dev/tags/golang), [#docker](https://daily.dev/tags/docker), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/how-to-create-database-migrations-in-go-using-docker-and-postgres-gkqnwmiko)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to Create Database Migrations in Go Using Docker and Postgres","url":"https://daily.dev/posts/how-to-create-database-migrations-in-go-using-docker-and-postgres-gkqnwmiko","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-create-database-migrations-in-go-using-docker-and-postgres-gkqnwmiko"},"datePublished":"2024-06-26T13:11:01.924Z","dateModified":"2024-10-05T17:14:51.210Z","description":"Learn how to create and manage database migrations in Go using Docker and Postgres. This guide covers setting up a Docker container, creating a schema with...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d8985d2c00effde19d5bb7f541a1eded?_a=AQAEuiZ","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d8985d2c00effde19d5bb7f541a1eded?_a=AQAEuiZ","isAccessibleForFree":true,"articleSection":"freeCodeCamp","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"freeCodeCamp","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1628412854/logos/freecodecamp","url":"https://daily.dev/sources/freecodecamp"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/how-to-create-database-migrations-in-go-using-docker-and-postgres-gkqnwmiko","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":41},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"webdev,database,golang,docker,postgresql","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"freeCodeCamp","item":"https://daily.dev/sources/freecodecamp"},{"@type":"ListItem","position":3,"name":"How to Create Database Migrations in Go Using Docker and Postgres"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/how-to-create-database-migrations-in-go-using-docker-and-postgres-gkqnwmiko","comment":[{"@type":"Comment","text":"Great article. Thank you!!","datePublished":"2024-07-12T06:19:32.152Z","url":"https://daily.dev/posts/GkqnWmIKO#c-YC4RT9KEw","author":{"@type":"Person","name":"Alex","url":"https://daily.dev/alexlopezt","image":"https://avatars.githubusercontent.com/u/25333097?v=4"}}]}
```

