Questions tagged [golang-migrate]

golang-migrate is a database migration tool written in Go. Questions tagged golang-migrate should be directly related to database migrations in Go.

See https://github.com/golang-migrate/migrate

Database migrations written in Go. Use as CLI or import as library.

  • Migrate reads migrations from sources and applies them in correct order to a database.
  • Drivers are "dumb", migrate glues everything together and makes sure the logic is bulletproof. (Keeps the drivers lightweight, too.)
  • Database drivers don't assume things or try to correct user input. When in doubt, fail.
107 questions
1
vote
1 answer

How to specify custom migration table in beego

I have 2 repo which uses the same database. I have different migrations in each repo. how can I specify a custom migration table in 1 repo rather than the default migration table in Beego? Beego version 1.10.1 Go version go1.10.3
priyesh
  • 45
  • 6
1
vote
0 answers

Get Error: can't acquire lock when trying to migrate with golang-migrate to postgres database

i am trying to migrate with golang to postgres database using library "github.com/golang-migrate/migrate/v4" I got some error like code below. base_test.go:79: Migrating postgres://db:db@localhost:65432/testdb?sslmode=disable from…
Darmawan Z.
  • 411
  • 8
  • 20
1
vote
1 answer

golang-migrate Close() not closing connection

I am using golang-migrate to migrate schema. Connection open, migration up and down are working fine. However, db connection is not getting closed, not throwing any error and leave idle connection in database server. My code looks like this: m, err…
Mayank
  • 5,411
  • 1
  • 16
  • 16
0
votes
1 answer

How to perform migrations in golang migrate when the sql files are located in a github folder?

I am using the migrate/migrate to perform migrations of my postgres local database. I was using the migrations files inside a local folder and the migrations were running as expected, but I moved the migrations folder to a different repository in…
0
votes
0 answers

Connection Refused Error when Running Database Migration in Jenkins Pipeline with Docker

I am encountering a connection refused error while running a Jenkins pipeline with Docker. The pipeline is responsible for setting up a PostgreSQL container, performing a database migration, and then stopping and removing the container. However,…
0
votes
0 answers

Golang migration stuck with no error message in Codebuild

When running golang migrate command, Golang migration stuck with no error message in AWS Codebuild. I am using RDS ( Aurora PostgreSQL 13.9). Do you have similar issues? I added -verbose flag but it's showing: start buffering... and then it just…
0
votes
1 answer

how to get a line from string with a word in golang

I need to get a line from a multiline string in golang which has common word like if the word is enabled then i need the line from multiline string once enable then we will continue.. The string is Their have a problem with the server.I have to…
0
votes
1 answer

Golang fiber c.Render layout not excute right template

I'm trying to use one layout with different templates, ├── Main Folder ├── cmd └── main.go ├── controllers ├── models ├── views └── partials └── layout.html └── index.html └── dashboard.html …
Hardy
  • 75
  • 4
0
votes
1 answer

How to connect supabase with my golang for jwt token verification API from supabase?

There is no any dedicated video or article on this. I really need this solution.
0
votes
1 answer

How to $push to a null slice in golang

After the code migration from mgo to go-mongo driver the []model are getting updated with null instead of empty array , So i'm not able to do $push operation for a golang struct . How to $push even if the array is null is there a way ? type Sample…
Gopher_k
  • 273
  • 2
  • 9
0
votes
2 answers

"error: pq: role "root" does not exist" when running pq with Postgres for Docker

I am setting up a local Postgres database on Docker with the postgres:14-alpine image, and running database migrations on it with golang-migrate, when I got the following error message after running the migrate tool: error: pq: role "root" does not…
ofekatr
  • 1
  • 2
0
votes
0 answers

Golang Migrate - Migration issues

We're using Golang Migrate which I generally love but recently it's just seemed like I can never actually run the migrations so I end up manually applying the migrations and "fixing" the schema_migrations table. There is always some error. Here's…
JSP
  • 547
  • 1
  • 4
  • 18
0
votes
2 answers

dynamic array dimension in golang

I am trying to create a high dimension array in Golang. Does anyone know how to do it? e.g. dims := [3,2,1] as a parameter -> want high_dims_array := make([3][2][1]int, 0) dims := [2] -> want high_dims_array := make([2]int, 0) dims := [3,3] -> want…
En Xie
  • 510
  • 4
  • 19
0
votes
1 answer

How can I populate a postgres table using docker-compose?

I am trying to populate a postgres table with data from a csv file when running docker-compose up -d, however, all the methods I have tried end up saying the file could not be found. One of the ways I was trying was using golang-migrate and the…
Cole
  • 99
  • 10
0
votes
1 answer

Best way to handling MySQL 1045 Error in Golang

I have a code that control MYSQL Error 1045, res, err := stmt.Exec(Status, Message, Number) if err != nil { if err.(*mysql.MySQLError).Number == 1045 { log.Error(err) stmt.Close() DatabaseErrorHandling() // used for…
GurbaniX
  • 187
  • 2
  • 12