Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion oracle/clause_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ func OnConflictClauseBuilder(c clause.Clause, builder clause.Builder) {
if len(conflictColumns) == 0 {
// If no columns specified, try to use primary key fields as default
if stmt.Schema == nil || len(stmt.Schema.PrimaryFields) == 0 {
stmt.AddError(fmt.Errorf("OnConflict requires either explicit columns or primary key fields"))
return
}
for _, primaryField := range stmt.Schema.PrimaryFields {
Expand Down
2 changes: 0 additions & 2 deletions oracle/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ func buildBulkInsertPLSQL(db *gorm.DB, createValues clause.Values) {
conflictColumns := onConflict.Columns
if len(conflictColumns) == 0 {
if len(schema.PrimaryFields) == 0 {
db.AddError(fmt.Errorf("OnConflict requires either explicit columns or primary key fields"))
return
}
for _, primaryField := range schema.PrimaryFields {
Expand Down Expand Up @@ -255,7 +254,6 @@ func buildBulkMergePLSQL(db *gorm.DB, createValues clause.Values, onConflictClau
conflictColumns := onConflict.Columns
if len(conflictColumns) == 0 {
if schema == nil || len(schema.PrimaryFields) == 0 {
db.AddError(fmt.Errorf("OnConflict requires either explicit columns or primary key fields"))
return
}
for _, primaryField := range schema.PrimaryFields {
Expand Down
5 changes: 2 additions & 3 deletions tests/joins_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ type PersonAddress struct {
}

func TestOverrideJoinTable(t *testing.T) {
t.Skip()
DB.Migrator().DropTable(&Person{}, &Address{}, &PersonAddress{})

if err := DB.SetupJoinTable(&Person{}, "Addresses", &PersonAddress{}); err != nil {
Expand Down Expand Up @@ -95,7 +94,7 @@ func TestOverrideJoinTable(t *testing.T) {
t.Fatalf("Should have one address left")
}

if DB.Find(&[]PersonAddress{}, "person_id = ?", person.ID).RowsAffected != 1 {
if DB.Find(&[]PersonAddress{}, "\"person_id\" = ?", person.ID).RowsAffected != 1 {
t.Fatalf("Should found one address")
}

Expand All @@ -113,7 +112,7 @@ func TestOverrideJoinTable(t *testing.T) {
t.Fatalf("Failed to find address, got error %v, length: %v", err, len(addresses3))
}

if DB.Unscoped().Find(&[]PersonAddress{}, "person_id = ?", person.ID).RowsAffected != 2 {
if DB.Unscoped().Find(&[]PersonAddress{}, "\"person_id\" = ?", person.ID).RowsAffected != 2 {
t.Fatalf("Should found soft deleted addresses with unscoped")
}

Expand Down
10 changes: 0 additions & 10 deletions tests/joins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import (
)

func TestJoins(t *testing.T) {
t.Skip()
user := *GetUser("joins-1", Config{Company: true, Manager: true, Account: true, NamedPet: false})

DB.Create(&user)
Expand All @@ -66,7 +65,6 @@ func TestJoins(t *testing.T) {
}

func TestJoinsForSlice(t *testing.T) {
t.Skip()
users := []User{
*GetUser("slice-joins-1", Config{Company: true, Manager: true, Account: true}),
*GetUser("slice-joins-2", Config{Company: true, Manager: true, Account: true}),
Expand Down Expand Up @@ -101,8 +99,6 @@ func TestJoinsForSlice(t *testing.T) {
}

func TestJoinConds(t *testing.T) {
t.Skip()

user := *GetUser("joins-conds", Config{Account: true, Pets: 3})
DB.Save(&user)

Expand Down Expand Up @@ -157,8 +153,6 @@ func TestJoinConds(t *testing.T) {
}

func TestJoinOn(t *testing.T) {
t.Skip()

user := *GetUser("joins-on", Config{Pets: 2})
DB.Save(&user)

Expand Down Expand Up @@ -281,8 +275,6 @@ func TestJoinWithSoftDeleted(t *testing.T) {
}

func TestInnerJoins(t *testing.T) {
t.Skip()

user := *GetUser("inner-joins-1", Config{Company: true, Manager: true, Account: true, NamedPet: false})

DB.Create(&user)
Expand Down Expand Up @@ -336,8 +328,6 @@ func TestJoinWithSameColumnName(t *testing.T) {
}

func TestJoinArgsWithDB(t *testing.T) {
t.Skip()

user := *GetUser("joins-args-db", Config{Pets: 2})
DB.Save(&user)

Expand Down
2 changes: 1 addition & 1 deletion tests/passed-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TestHooksForSlice
TestFailedToSaveAssociationShouldRollback
TestUpdateCallbacks
TestPropagateUnscoped
#TestOverrideJoinTable
TestOverrideJoinTable
TestJoins
TestJoinsForSlice
TestJoinConds
Expand Down
Loading