Giter Club home page Giter Club logo

pgmgr's People

Contributors

campnowhere avatar coding-brigadier avatar johnmcconnell avatar mobidots avatar ncultimate avatar packrat386 avatar pd avatar rnubel avatar skinnyjames avatar tbruyelle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pgmgr's Issues

Feature: Create/Update structure.sql for each migration

Currently each time a migration is applied and unless pgmgr dump is executed there's no dump or structure file that gets generated.

This feature would create a structure only sql file each time a migration is ran and can be toggled on and off via the config file through the setting:

{
  "db-structure": "path/to/structure/"
}

By default, the structure is not generated unless this part of the configuration is specified.

Usable as a library/package

Right now (correct me if I am wrong) but it's usage is tied to the CLI right?
What're your thoughts on allowing the package to be used in a code?

Error: exec: "createdb": executable file not found in $PATH with docker

I have postgres running in docker, when I try run pgmgr db create, got error: Error: exec: "createdb": executable file not found in $PATH
How I can fix this, and work with docker?

{
  "host": "localhost",
  "port": 5432,
  "username": "postgres",
  "password": "postgres",
  "database": "local",
  "migration-table": "public.schema_migrations",
  "migration-folder": "db/migrations",
  "dump-file": "etc/db/dump.sql",
  "column-type": "string",
  "format": "unix"
}

pgmgr db create when not local

> pgmgr db create
createdb: could not connect to database template1: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Error:  exit status 1
{
  "host": "192.168.56.2",
  "port": 5432,
  "username": "vagrant",
  "password": "vagrant",
  "database": "goscratch",
  "sslmode": "disable",
  "migration-table": "public.schema_migrations",
  "migration-folder": "migrations",
  "dump-file": "migrations/dump.sql",
  "column-type": "integer",
  "format": "unix"
}

When attempting pgmgr db create it fails because the config is not passed into the createdb command correctly.

https://github.com/rnubel/pgmgr/blob/master/pgmgr/pgmgr.go#L48

passing in something manually, works and then the rest of the commands (migrate function correctly)
createdb -h 192.168.56.2 -U vagrant -O vagrant goscratch

> createbd -V
createdb (PostgreSQL) 9.6.3

How to connect via SSL

We are using this tool heavily in our project in development.

We need to connect to heroku-postgres. It requires SSL. I checked that sslmode=require functionality is a TODO. But for now, what could be the way to connect, until this is implemented?

Thanks!

cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal

This issue is for documenting the fix to the above error -- if you are trying to install pgmgr from a folder where Go module support is not found, you may see this error as the cli dependency was not stable. In #46, I moved pgmgr to use Go modules to lock down its dependencies, so the fix for this is to install the tool with modules turned on:

GO111MODULE=on go get github.com/rnubel/pgmgr

This workaround should become unnecessary once Go changes its default setting for GO11MODULE to on, which should be in Go 1.14 or so.

Enhancement: Separate configurations for package and database

Currently pgmgr looks for a .pgmgr.json file to set the package and database configuration.
Although we are able to override the default search path via PGMGR_CONFIG_FILE I propose that
the .pgmgr.json configuration will only have configuration attributes specific to the package commands.

So instead of this configuration (which is db config related):

{
  "host": "localhost",
  "port": 5432,
  "username": "test",
  "password": "test",
  "database": "testdb",
  "migration-table": "public.schema_migrations",
  "migration-folder": "db/migrate",
  "dump-file": "db/dump.sql",
  "column-type": "integer",
  "format": "unix",
  "seed-tables": [ "foos", "bars" ]
}

It would be better if we have this file configure where the database configuration resides and toggle the different configurations via env vars that has a default to development.

{
  "dbconfig-folder": "config/db.conf.json",
  "migration-folder": "db/migrate",
  "dump-file": "db/dump.sql"
}

This would still work well with the current configuration that allows overrides with the environmental variables.

Password in the DSN

It doesn't look like the password for the database gets parsed by func (config *Config) overrideFromURL()
whereas the documentation seems like it would. Is there a reason for that?
I can make a PR if not, otherwise I might be missing your intention?

error during migration: pq: role "root" does not exist

Was using pgmgr yesterday with the connection string in the environment, now it doesn't seem to recognize the user in a CI environment. I'll double check to see if I'm doing anything different, but I do not think I am.

 PGMGR_URL='postgres://postgres@database:5432/postgres?sslmode=disable' pgmgr db migrate
 Error during migration: pq: role "root" does not exist`

Convert to library

Is it possible to convert this into a library?

To remove development and deployment/CI complexity, it would be nice to have a library version.

Environment variable duplications

Is there a reason why you duplicate the standards postgres environment variables into the PGMGR_* ones ?

If they're no specific reason, I think you should reuse the ones from postgres, it would be more convenient for the user.

Opting out of transactions for some migrations

I'd like to implement something that provides a feature similar to ActiveRecord::Migration#disable_ddl_transaction!. Mostly so I can run CREATE INDEX CONCURRENTLY ....

I've currently got two ideas for how this could happen:

  1. Magic comments, eg -- transaction: false or such.
  2. Encode it in the filenames, eg <ts>_<name>.notx.up.sql or such.

Option 1 reminds me of tools I didn't like using, and means we'd have to read the migration and do some juggling of the contents before we could run them.

Option 2 is simpler, but if another option comes along, suddenly we gotta figure out how to encode that into the filename as well. I can't think of any other useful options, tho.

You into either of these? Or got any other ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.