Skip to content

Commit

Permalink
Allow dbmate to be installable via go install; Take cross-schema dump…
Browse files Browse the repository at this point in the history
… for postgres
  • Loading branch information
Amandeepsinghghai committed Oct 24, 2022
1 parent 649e03f commit 6659818
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 33 deletions.
6 changes: 3 additions & 3 deletions drivers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
_ "github.com/amacneil/dbmate/pkg/driver/clickhouse"
_ "github.com/amacneil/dbmate/pkg/driver/mysql"
_ "github.com/amacneil/dbmate/pkg/driver/postgres"
_ "github.com/Amandeepsinghghai/dbmate/pkg/driver/clickhouse"
_ "github.com/Amandeepsinghghai/dbmate/pkg/driver/mysql"
_ "github.com/Amandeepsinghghai/dbmate/pkg/driver/postgres"
)
2 changes: 1 addition & 1 deletion drivers_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
package main

import (
_ "github.com/amacneil/dbmate/pkg/driver/sqlite"
_ "github.com/Amandeepsinghghai/dbmate/pkg/driver/sqlite"
)
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/amacneil/dbmate
module github.com/Amandeepsinghghai/dbmate

go 1.19

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/joho/godotenv"
"github.com/urfave/cli/v2"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/dbmate/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"sort"
"time"

"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"
)

// DefaultMigrationsDir specifies default directory to find migration files
Expand Down
10 changes: 5 additions & 5 deletions pkg/dbmate/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"testing"
"time"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
_ "github.com/amacneil/dbmate/pkg/driver/mysql"
_ "github.com/amacneil/dbmate/pkg/driver/postgres"
_ "github.com/amacneil/dbmate/pkg/driver/sqlite"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"
_ "github.com/Amandeepsinghghai/dbmate/pkg/driver/mysql"
_ "github.com/Amandeepsinghghai/dbmate/pkg/driver/postgres"
_ "github.com/Amandeepsinghghai/dbmate/pkg/driver/sqlite"

"github.com/kami-zh/go-capturer"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion pkg/dbmate/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"net/url"

"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"
)

// Driver provides top level database functions
Expand Down
2 changes: 1 addition & 1 deletion pkg/dbutil/dbutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"database/sql"
"testing"

"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

_ "github.com/mattn/go-sqlite3" // database/sql driver
"github.com/stretchr/testify/require"
Expand Down
6 changes: 3 additions & 3 deletions pkg/driver/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"sort"
"strings"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

"github.com/ClickHouse/clickhouse-go"
)
Expand Down Expand Up @@ -315,7 +315,7 @@ func (drv *Driver) DeleteMigration(db dbutil.Transaction, version string) error
func (drv *Driver) Ping() error {
// attempt connection to primary database, not "clickhouse" database
// to support servers with no "clickhouse" database
// (see https://github.com/amacneil/dbmate/issues/78)
// (see https://github.com/Amandeepsinghghai/dbmate/issues/78)
db, err := drv.Open()
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/driver/clickhouse/clickhouse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"testing"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

"github.com/stretchr/testify/require"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/driver/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"regexp"
"strings"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

_ "github.com/go-sql-driver/mysql" // database/sql driver
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/driver/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"testing"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

"github.com/stretchr/testify/require"
)
Expand Down
9 changes: 5 additions & 4 deletions pkg/driver/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"runtime"
"strings"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

"github.com/lib/pq"
)
Expand Down Expand Up @@ -94,7 +94,8 @@ func connectionArgsForDump(u *url.URL) []string {
for _, schema := range schemas {
schema = strings.TrimSpace(schema)
if schema != "" {
out = append(out, "--schema", schema)
// Remove schema parameter for dump to contain cross-schema objects like extensions
// out = append(out, "--schema", schema)
}
}
out = append(out, u.String())
Expand Down Expand Up @@ -340,7 +341,7 @@ func (drv *Driver) DeleteMigration(db dbutil.Transaction, version string) error
func (drv *Driver) Ping() error {
// attempt connection to primary database, not "postgres" database
// to support servers with no "postgres" database
// (see https://github.com/amacneil/dbmate/issues/78)
// (see https://github.com/Amandeepsinghghai/dbmate/issues/78)
db, err := drv.Open()
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/driver/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"runtime"
"testing"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

"github.com/stretchr/testify/require"
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/driver/sqlite/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"regexp"
"strings"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

"github.com/lib/pq"
_ "github.com/mattn/go-sqlite3" // database/sql driver
Expand Down
4 changes: 2 additions & 2 deletions pkg/driver/sqlite/sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os"
"testing"

"github.com/amacneil/dbmate/pkg/dbmate"
"github.com/amacneil/dbmate/pkg/dbutil"
"github.com/Amandeepsinghghai/dbmate/pkg/dbmate"
"github.com/Amandeepsinghghai/dbmate/pkg/dbutil"

"github.com/stretchr/testify/require"
)
Expand Down

0 comments on commit 6659818

Please sign in to comment.