{"repo":"ashraful88/flyway-postgres-golang","free":true,"listed":false,"github":"https://github.com/ashraful88/flyway-postgres-golang","clone":"git clone https://github.com/ashraful88/flyway-postgres-golang.git","description":"Flyway Database Schema Migrations with Golang and Postgres - Template repo for new Golang project","language":"Go","stars":12,"topics":["flyway","database-migrations","postgresql","golang","flywaydb","sql","database","docker","postgres","schema-migrations"],"license":"MIT","category":"databases-storage","readme_excerpt":"Flywaydb PostgreSQL Golang boilerplate Use Flyway database schema migration tool with any Golang project. This repo uses PostgreSQL but can be used for any SQL database that Flyway supports. Read more about versioning SQL files: https://flywaydb.org/documentation/concepts/migrations.html#naming Prerequisites - Go 1.20+ - Docker and Docker Compose Add database schema files Add your .sql files in ./sql directory. Use semver versioning in the filename. Example: V1.1 anyname.sql , V1.2 secondfile.sql Running Flyway in a local development environment 1. Create .env from example.env : 2. Start Docker containers (PostgreSQL, Flyway, and PgAdmin): This creates: - PostgreSQL database container - Flyway container that runs migrations automatically - PgAdmin UI at http://localhost:8080/browser/ 3. Check migration status: 4. Run the Go application locally: Run migrations manually after SQL changes Or run directly with Docker: Reset database and migrate fresh Stop containers Running Flyway in the production environment For production, use the Dockerfile. Set ENV=production in your environment. In production, database migration is executed from the Go application on startup. Note that during CI/CD the database may not be accessible, but once the Docker image is deployed to Kubernetes or another environment, the database will be accessible for migration. Migration functions are defined in ./flyway/flyway.go and triggered from main.go . The Docker image uses flyway/flyway:9-alpine as the bas","default_branch":null,"files":null,"tree":[],"storefront":"/r/ashraful88","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ashraful88/flyway-postgres-golang/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}