Skip to content

Commit

Permalink
renames, pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dorav committed Dec 17, 2023
1 parent 6429522 commit f05fd4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions gormschema/gorm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import (
"testing"

"ariga.io/atlas-go-sdk/recordriver"
ckModels "ariga.io/atlas-provider-gorm/internal/testdata/circular_fk_models"
ckmodels "ariga.io/atlas-provider-gorm/internal/testdata/circularfks"
"ariga.io/atlas-provider-gorm/internal/testdata/models"
"github.com/stretchr/testify/require"
"gorm.io/gorm"
)

func TestSQLiteConfig(t *testing.T) {
l := New("sqlite")
sql, err := l.Load(models.Pet{}, models.User{}, ckModels.Event{}, ckModels.Location{})
sql, err := l.Load(models.Pet{}, models.User{}, ckmodels.Event{}, ckmodels.Location{})
require.NoError(t, err)
require.Contains(t, sql, "CREATE TABLE `pets`")
require.Contains(t, sql, "CREATE TABLE `users`")
Expand All @@ -35,7 +35,7 @@ func TestSQLiteConfig(t *testing.T) {

func TestPostgreSQLConfig(t *testing.T) {
l := New("postgres")
sql, err := l.Load(ckModels.Location{}, ckModels.Event{}, models.User{}, models.Pet{})
sql, err := l.Load(ckmodels.Location{}, ckmodels.Event{}, models.User{}, models.Pet{})
require.NoError(t, err)
require.Contains(t, sql, `CREATE TABLE "users"`)
require.Contains(t, sql, `CREATE INDEX IF NOT EXISTS "idx_users_deleted_at"`)
Expand All @@ -53,7 +53,7 @@ func TestPostgreSQLConfig(t *testing.T) {
&gorm.Config{
DisableForeignKeyConstraintWhenMigrating: true,
}))
sql, err = l.Load(ckModels.Location{}, ckModels.Event{})
sql, err = l.Load(ckmodels.Location{}, ckmodels.Event{})
require.NoError(t, err)
require.Contains(t, sql, `CREATE TABLE "events"`)
require.Contains(t, sql, `CREATE TABLE "locations"`)
Expand All @@ -63,7 +63,7 @@ func TestPostgreSQLConfig(t *testing.T) {

func TestMySQLConfig(t *testing.T) {
l := New("mysql")
sql, err := l.Load(ckModels.Location{}, ckModels.Event{}, models.User{}, models.Pet{})
sql, err := l.Load(ckmodels.Location{}, ckmodels.Event{}, models.User{}, models.Pet{})
require.NoError(t, err)
require.Contains(t, sql, "CREATE TABLE `users`")
require.Contains(t, sql, "CREATE TABLE `pets`")
Expand All @@ -78,7 +78,7 @@ func TestMySQLConfig(t *testing.T) {
DisableForeignKeyConstraintWhenMigrating: true,
},
))
sql, err = l.Load(ckModels.Location{}, ckModels.Event{})
sql, err = l.Load(ckmodels.Location{}, ckmodels.Event{})
require.NoError(t, err)
require.Contains(t, sql, "CREATE TABLE `events`")
require.Contains(t, sql, "CREATE TABLE `locations`")
Expand All @@ -88,5 +88,5 @@ func TestMySQLConfig(t *testing.T) {
func resetSession(t *testing.T) {
sess, ok := recordriver.Session("gorm")
require.True(t, ok)
sess.Statements = []string{}
sess.Statements = nil
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package circular_fk_models
package circularfks

type Location struct {
LocationID string `gorm:"primaryKey;column:locationId;"`
Expand Down

0 comments on commit f05fd4c

Please sign in to comment.