@@ -16,7 +16,7 @@ func (database *DatabasePostgres) init() {
16
16
17
17
// LOCAL
18
18
if connLocal .IsDocker () {
19
- if database .Local .User == "" || database .Local .Schema == "" {
19
+ if database .Local .User == "" || database .Local .Db == "" {
20
20
containerEnv := connLocal .DockerGetEnvironment ()
21
21
22
22
// try to guess user/password
@@ -36,19 +36,19 @@ func (database *DatabasePostgres) init() {
36
36
}
37
37
}
38
38
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
44
44
}
45
45
}
46
46
}
47
47
}
48
48
49
49
// Remote
50
50
if connRemote .IsDocker () {
51
- if database .User == "" || database .Schema == "" {
51
+ if database .User == "" || database .Db == "" {
52
52
containerEnv := connRemote .DockerGetEnvironment ()
53
53
54
54
// try to guess user/password
@@ -68,11 +68,11 @@ func (database *DatabasePostgres) init() {
68
68
}
69
69
}
70
70
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
76
76
}
77
77
}
78
78
}
@@ -126,7 +126,7 @@ func (database *DatabasePostgres) tableList(connectionType string) []string {
126
126
FROM information_schema.tables
127
127
WHERE table_type = 'BASE TABLE'
128
128
AND table_catalog = %s`
129
- sqlStmt = fmt .Sprintf (sqlStmt , database .quote (database .Schema ))
129
+ sqlStmt = fmt .Sprintf (sqlStmt , database .quote (database .Db ))
130
130
131
131
cmd := shell .Cmd ("echo" , shell .Quote (sqlStmt )).Pipe (database .psqlCommandBuilder (connectionType )... )
132
132
output := cmd .Run ().Stdout .String ()
0 commit comments