@@ -16,7 +16,7 @@ func (database *DatabasePostgres) init() {
1616
1717 // LOCAL
1818 if connLocal .IsDocker () {
19- if database .Local .User == "" || database .Local .Schema == "" {
19+ if database .Local .User == "" || database .Local .Db == "" {
2020 containerEnv := connLocal .DockerGetEnvironment ()
2121
2222 // try to guess user/password
@@ -36,19 +36,19 @@ func (database *DatabasePostgres) init() {
3636 }
3737 }
3838
39- // get schema from env
40- if database .Local .Schema == "" {
41- if schema , ok := containerEnv ["POSTGRES_DB" ]; ok {
42- fmt .Println (fmt .Sprintf (" -> remote: using postgres schema \" %s\" (from env:POSTGRES_DB)" , schema ))
43- database .Local .Schema = schema
39+ // get database from env
40+ if database .Local .Db == "" {
41+ if db , ok := containerEnv ["POSTGRES_DB" ]; ok {
42+ fmt .Println (fmt .Sprintf (" -> remote: using postgres database \" %s\" (from env:POSTGRES_DB)" , db ))
43+ database .Local .Db = db
4444 }
4545 }
4646 }
4747 }
4848
4949 // Remote
5050 if connRemote .IsDocker () {
51- if database .User == "" || database .Schema == "" {
51+ if database .User == "" || database .Db == "" {
5252 containerEnv := connRemote .DockerGetEnvironment ()
5353
5454 // try to guess user/password
@@ -68,11 +68,11 @@ func (database *DatabasePostgres) init() {
6868 }
6969 }
7070
71- // get schema from env
72- if database .Schema == "" {
73- if schema , ok := containerEnv ["POSTGRES_DB" ]; ok {
74- fmt .Println (fmt .Sprintf (" -> remote: using postgres schema \" %s\" (from env:POSTGRES_DB)" , schema ))
75- database .Schema = schema
71+ // get database from env
72+ if database .Db == "" {
73+ if db , ok := containerEnv ["POSTGRES_DB" ]; ok {
74+ fmt .Println (fmt .Sprintf (" -> remote: using postgres database \" %s\" (from env:POSTGRES_DB)" , db ))
75+ database .Db = db
7676 }
7777 }
7878 }
@@ -126,7 +126,7 @@ func (database *DatabasePostgres) tableList(connectionType string) []string {
126126 FROM information_schema.tables
127127 WHERE table_type = 'BASE TABLE'
128128 AND table_catalog = %s`
129- sqlStmt = fmt .Sprintf (sqlStmt , database .quote (database .Schema ))
129+ sqlStmt = fmt .Sprintf (sqlStmt , database .quote (database .Db ))
130130
131131 cmd := shell .Cmd ("echo" , shell .Quote (sqlStmt )).Pipe (database .psqlCommandBuilder (connectionType )... )
132132 output := cmd .Run ().Stdout .String ()
0 commit comments