Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💥 Remove builtin sqlite3 adapter #257

Merged
merged 4 commits into from
Nov 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
127 changes: 0 additions & 127 deletions adapter/sqlite3/sqlite3.go

This file was deleted.

120 changes: 0 additions & 120 deletions adapter/sqlite3/sqlite3_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions cmd/rel/internal/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestExecMigrate(t *testing.T) {
args = []string{
"rel",
"migrate",
"-adapter=github.com/go-rel/rel/adapter/sqlite3",
"-adapter=github.com/go-rel/sqlite3",
"-driver=github.com/mattn/go-sqlite3",
"-dsn=:memory:",
"-dir=db",
Expand All @@ -47,7 +47,7 @@ func TestExecMigrate(t *testing.T) {
"migrate",
"-dir=testdata/migrations",
"-module=github.com/go-rel/rel/cmd/rel/internal",
"-adapter=github.com/go-rel/rel/adapter/sqlite3",
"-adapter=github.com/go-rel/sqlite3",
"-driver=github.com/mattn/go-sqlite3",
"-dsn=:memory:",
"-verbose=false",
Expand Down
8 changes: 4 additions & 4 deletions cmd/rel/internal/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func getDatabaseInfo() (string, string, string) {
driver = os.Getenv("DATABASE_DRIVER")
dsn = os.Getenv("DATABASE_URL")
case os.Getenv("SQLITE3_DATABASE") != "":
adapter = "github.com/go-rel/rel/adapter/sqlite3"
adapter = "github.com/go-rel/sqlite3"
driver = "github.com/mattn/go-sqlite3"
dsn = os.Getenv("SQLITE3_DATABASE")
case os.Getenv("MYSQL_HOST") != "":
adapter = "github.com/go-rel/rel/adapter/mysql"
adapter = "github.com/go-rel/mysql"
driver = "github.com/go-sql-driver/mysql"
dsn = fmt.Sprintf("%s:%s@(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local",
os.Getenv("MYSQL_USERNAME"),
Expand All @@ -35,7 +35,7 @@ func getDatabaseInfo() (string, string, string) {
os.Getenv("MYSQL_PORT"),
os.Getenv("MYSQL_DATABASE"))
case os.Getenv("POSTGRES_HOST") != "":
adapter = "github.com/go-rel/rel/adapter/postgres"
adapter = "github.com/go-rel/postgres"
driver = "github.com/lib/pq"
dsn = fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable",
os.Getenv("POSTGRES_USERNAME"),
Expand All @@ -44,7 +44,7 @@ func getDatabaseInfo() (string, string, string) {
os.Getenv("POSTGRES_PORT"),
os.Getenv("POSTGRES_DATABASE"))
case os.Getenv("POSTGRESQL_HOST") != "":
adapter = "github.com/go-rel/rel/adapter/postgres"
adapter = "github.com/go-rel/postgres"
driver = "github.com/lib/pq"
dsn = fmt.Sprintf("postgres://%s:%s@%s:%s/%s?sslmode=disable",
os.Getenv("POSTGRESQL_USERNAME"),
Expand Down
12 changes: 6 additions & 6 deletions cmd/rel/internal/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func TestGetDatabaseInfo(t *testing.T) {
t.Run("database", func(t *testing.T) {
os.Setenv("DATABASE_ADAPTER", "github.com/go-rel/rel/adapter/mysql")
os.Setenv("DATABASE_ADAPTER", "github.com/go-rel/mysql")
os.Setenv("DATABASE_DRIVER", "github.com/go-sql-driver/mysql")
os.Setenv("DATABASE_URL", "user:password@(localhost:3306)/db?charset=utf8&parseTime=True&loc=Local")

Expand All @@ -20,7 +20,7 @@ func TestGetDatabaseInfo(t *testing.T) {
defer os.Setenv("DATABASE_URL", "")

adapter, driver, url := getDatabaseInfo()
assert.Equal(t, "github.com/go-rel/rel/adapter/mysql", adapter)
assert.Equal(t, "github.com/go-rel/mysql", adapter)
assert.Equal(t, "github.com/go-sql-driver/mysql", driver)
assert.Equal(t, "user:password@(localhost:3306)/db?charset=utf8&parseTime=True&loc=Local", url)
})
Expand All @@ -39,7 +39,7 @@ func TestGetDatabaseInfo(t *testing.T) {
defer os.Setenv("MYSQL_PASSWORD", "")

adapter, driver, url := getDatabaseInfo()
assert.Equal(t, "github.com/go-rel/rel/adapter/mysql", adapter)
assert.Equal(t, "github.com/go-rel/mysql", adapter)
assert.Equal(t, "github.com/go-sql-driver/mysql", driver)
assert.Equal(t, "user:password@(localhost:3306)/db?charset=utf8&parseTime=True&loc=Local", url)
})
Expand All @@ -58,7 +58,7 @@ func TestGetDatabaseInfo(t *testing.T) {
defer os.Setenv("POSTGRES_PASSWORD", "")

adapter, driver, url := getDatabaseInfo()
assert.Equal(t, "github.com/go-rel/rel/adapter/postgres", adapter)
assert.Equal(t, "github.com/go-rel/postgres", adapter)
assert.Equal(t, "github.com/lib/pq", driver)
assert.Equal(t, "postgres://user:password@localhost:5432/db?sslmode=disable", url)
})
Expand All @@ -77,7 +77,7 @@ func TestGetDatabaseInfo(t *testing.T) {
defer os.Setenv("POSTGRESQL_PASSWORD", "")

adapter, driver, url := getDatabaseInfo()
assert.Equal(t, "github.com/go-rel/rel/adapter/postgres", adapter)
assert.Equal(t, "github.com/go-rel/postgres", adapter)
assert.Equal(t, "github.com/lib/pq", driver)
assert.Equal(t, "postgres://user:password@localhost:5432/db?sslmode=disable", url)
})
Expand All @@ -87,7 +87,7 @@ func TestGetDatabaseInfo(t *testing.T) {
defer os.Setenv("SQLITE3_DATABASE", "")

adapter, driver, url := getDatabaseInfo()
assert.Equal(t, "github.com/go-rel/rel/adapter/sqlite3", adapter)
assert.Equal(t, "github.com/go-rel/sqlite3", adapter)
assert.Equal(t, "github.com/mattn/go-sqlite3", driver)
assert.Equal(t, "test.db", url)
})
Expand Down