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
2
votes
2 answers

Golang-migrate returns "no change"

I'm starting learn Go and SQL. I tryed to make initial migration using golang-migrate in my go project. Database is postgresql This is migration file: CREATE TABLE users ( id serial not null unique, name varchar(255) not null, username…
2
votes
0 answers

Golang-Migrate not able to recognize dollar symbol db.runCommand

While running db.runCommand it is not able to recognize dollar symbol and therefore treating $answer as string and not actual value. [ { "update": "userfeedback", "updates": [ { "q": { "userId": 8426, …
kumar Anny
  • 346
  • 4
  • 12
2
votes
1 answer

Unable to install Beego framwork with GoLang on mac system

I am new in Go Lang and I am trying to install Beego framework on my mac system. But I am not sure how to install Beego and bee tools. I referred couple of sites but unable to find/resolve actual issue. I am using below version of GO. go version…
Aks 1316
  • 372
  • 5
  • 19
2
votes
1 answer

golang-migrate - skip migrations if DB has newer migration version

I have a scenario where if I rollback to a previous version of my application the migration step will fail with errors regarding missing script eg. error: no migration found for version 10 error: file does not exist I do not wish to rollback the DB…
2
votes
1 answer

golang-migrate no change error on initial migration

I'm using golang-migrate for managing migrations everything seems to work correctly when running tests on github actions CI, but I can't make it work when running on docker image. I just keep getting a no change error. Connection to database is…
LeTadas
  • 3,436
  • 9
  • 33
  • 65
2
votes
4 answers

How can I skip a field for json.Marshal & not for json.Unmarshal in go?

type Alpha struct { Name string `json:"name"` SkipWhenMarshal string `json:"skipWhenMarshal"` } func MarshalJSON(out interface{}){ json.Marshal(out) } Is it possible to ignore the SkipWhenMarshal field when I do json.Marshal but…
user12489349
2
votes
2 answers

Go app engine dev_appserver.py doesn't support runtime go112

I am trying to migrate my Go app to runtime go112, but dev_appserver.py throw the following error: RuntimeError: Unknown runtime 'go112'; supported runtimes are 'custom', 'go', 'go111', 'java', 'java7', 'java8', 'php55', 'php72', 'python',…
Chaoming Li
  • 205
  • 2
  • 16
2
votes
1 answer

Include Go dependencies in Docker container using mono repo

I have a mono repo with the structure. mono-repo - serviceA - main.go - Dockerfile -serviceB - main.go - Dockerfile go.mod go.sum The Dockerfile in serviceA contains the following code. FROM golang ENV GO111MODULE=on WORKDIR /app COPY .…
pocockn
  • 1,965
  • 5
  • 21
  • 36
2
votes
1 answer

Migrate library implementation for cassandra with multiple host ip's

I am trying to use golang-migrate library for cassandra migrations. In the Docs, they have mentioned to use cassandra url like this cassandra://host:port/keyspace?param1=value¶m2=value2 We will be having more than one host for cassandra. Do…
Gokul Raj Kumar
  • 335
  • 2
  • 9
1
vote
2 answers

How to implement interface in golang?

I have 3 files in a project in Go: Cat.go package entities type Cat struct { Length int Origin string Image_link string Family_friendly int Shedding int General_health …
1
vote
1 answer

Go relationship error when migrating models using gorm

I am new to go/golang and I have been learning it by trying to create a small project. I have written several models in my go project corresponding to the db tables I want in my db. I have opted to use PostgreSQL, when migrating the models I get the…
Kevnlan
  • 487
  • 2
  • 10
  • 31
1
vote
1 answer

Connection refused when running go migrate in cloud run

I'm trying to run db migration with golang migrate for Cloud SQL, on cloud run and it shows this log cannot create migration: dial tcp 127.0.0.1:5432: connect: connection refused The URI format I'm using is…
1
vote
1 answer

Unable to save the data in two different table in golang using gorm

This is my code I'm not sure what went wrong the value which is in the user is getting updated in the user table properly but the address struct value is not storing the data in the address table I want to save two users and address table with one…
Yogi
  • 21
  • 3
1
vote
1 answer

How to use mongocompact package in mongoclient connect options

Currently I already use NewRegistryBuilder() in the mongo client options , Somehow i want to make use of NewRespectNilValuesRegistryBuilder() from mongocompact so that I can set the nilvalues in the []models as empty array . Currently I have…
Gopher_k
  • 273
  • 2
  • 9
1
vote
3 answers

error: database driver: unknown driver postgresql (forgotten import?) - How to run golang migrate with make file

I am trying to run migrations in my go-fiber rest API using golang-migrate. I added the commands for running the migrations in a makefile. However, when I run make migrateup, I get the following error: migrate -path database/postgres/migrations…
David Essien
  • 1,463
  • 4
  • 22
  • 36