Comments (3)
@SharkFourSix if your concern is just having an easier way to run pgmgr after adding it to your go.mod, you can run the version pinned by a particular module with go run github.com/rnubel/pgmgr
. That is, suppose you make a new Go project and install a specific version of pgmgr:
$ go mod init github.com/rnubel/mynewproject
$ go get github.com/rnubel/[email protected]
$ echo {} > .pgmgr.json
You can run the installed version with the go run
command:
$ go run github.com/rnubel/pgmgr -v
pgmgr version 1.1.4
So, e.g., go run github.com/rnubel/pgmgr db create
, go run github.com/rnubel/pgmgr db migrate
, should all work and use the exact version you have pinned.
I also will add that it is possible to import the pgmgr package and use it directly, but you have to build your config struct by hand:
package main
import (
"fmt"
"log"
"github.com/rnubel/pgmgr/pgmgr"
)
func main() {
config := pgmgr.Config{
Host: "localhost",
Port: 5432,
Username: "rnubel",
Database: "mydb",
MigrationDriver: "psql",
MigrationFolder: "migrations",
MigrationTable: "schema_migrations",
SslMode: "disable",
}
if err := pgmgr.Create(&config); err != nil {
log.Fatal(fmt.Errorf("failed to create db: %w", err))
}
if err := pgmgr.Migrate(&config); err != nil {
log.Fatal(fmt.Errorf("failed to migrate: %w", err))
}
}
Let me know if the above addresses your problem or if there's more you're looking for!
from pgmgr.
Thanks. I just ended up whipping up my own library that works for me out of frustration 😆
https://github.com/SharkFourSix/dsync
from pgmgr.
@SharkFourSix good luck with that! I'll close this issue for now.
from pgmgr.
Related Issues (14)
- Feature: Create/Update structure.sql for each migration HOT 2
- Enhancement: Separate configurations for package and database HOT 3
- using deprecated call from codegangsta cli app
- How to connect via SSL HOT 4
- Usable as a library/package HOT 4
- Environment variable duplications HOT 3
- Password in the DSN HOT 3
- error during migration: pq: role "root" does not exist HOT 7
- pgmgr db create when not local HOT 2
- Error: exec: "createdb": executable file not found in $PATH with docker HOT 2
- schema_migrations table doesn't have primary key
- cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal
- Opting out of transactions for some migrations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgmgr.