Add Sync options to ignore constrains and indices #2320

Merged
lunny merged 10 commits from 6543/xorm:SyncOptions_add_IgnoreConstrains into master 2023-08-09 03:28:55 +00:00
Contributor
needed for https://github.com/woodpecker-ci/woodpecker/pull/2117
6543 added 2 commits 2023-08-05 01:19:58 +00:00
remove dead code
Some checks failed
test cockroach / test cockroach (pull_request) Has been cancelled
test mariadb / test mariadb (pull_request) Has been cancelled
test mssql / test mssql (pull_request) Has been cancelled
test mysql / test mysql (pull_request) Has been cancelled
test mysql8 / test mysql8 (pull_request) Has been cancelled
test postgres / test postgres (pull_request) Has been cancelled
test sqlite / unit test & test sqlite (pull_request) Has been cancelled
test tidb / test tidb (pull_request) Has been cancelled
93b9dc3fd9
6543 added 1 commit 2023-08-05 01:24:20 +00:00
add more info to code comment
Some checks failed
test cockroach / test cockroach (pull_request) Has been cancelled
test mariadb / test mariadb (pull_request) Has been cancelled
test mssql / test mssql (pull_request) Has been cancelled
test mysql / test mysql (pull_request) Has been cancelled
test mysql8 / test mysql8 (pull_request) Has been cancelled
test postgres / test postgres (pull_request) Has been cancelled
test sqlite / unit test & test sqlite (pull_request) Has been cancelled
test tidb / test tidb (pull_request) Has been cancelled
020a74861b
6543 added 1 commit 2023-08-05 01:26:37 +00:00
better english
All checks were successful
test tidb / test tidb (pull_request) Successful in 5m33s
test sqlite / unit test & test sqlite (pull_request) Successful in 8m41s
test cockroach / test cockroach (pull_request) Successful in 7m23s
test mariadb / test mariadb (pull_request) Successful in 4m34s
test mysql / test mysql (pull_request) Successful in 5m9s
test mssql / test mssql (pull_request) Successful in 6m8s
test mysql8 / test mysql8 (pull_request) Successful in 5m13s
test postgres / test postgres (pull_request) Successful in 5m41s
33765faf2f
6543 requested review from lunny 2023-08-05 04:05:37 +00:00
lunny reviewed 2023-08-05 06:23:50 +00:00
sync.go Outdated
@ -221,24 +235,22 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
}
}
if oriIndex != nil {
Owner

So why remove these lines?

So why remove these lines?
Author
Contributor

see 93b9dc3fd9 :

because you can merge the two if statements to oriIndex != nil && oriIndex.Type != index.Type witch is always false as it is checked 7 lines aboth

( -> it check if index2 is equal index and if true oriIndex is not nill
so if origIndex != index -> origIndey = nil -> false && true
so if origIndex == index -> origIndex != nil -> true && false
)

see https://gitea.com/xorm/xorm/commit/93b9dc3fd96e1c0e62f03d9346303deaa4522a16 : because you can merge the two if statements to `oriIndex != nil && oriIndex.Type != index.Type` witch is always false as it is checked 7 lines aboth ( -> it check if index2 is equal index and if true oriIndex is not nill so if origIndex != index -> origIndey = nil -> `false && true` so if origIndex == index -> origIndex != nil -> `true && false` )
6543 marked this conversation as resolved
6543 added 2 commits 2023-08-06 16:30:08 +00:00
Add tests for SyncWithOptions
All checks were successful
test mariadb / test mariadb (pull_request) Successful in 4m52s
test cockroach / test cockroach (pull_request) Successful in 7m32s
test mssql / test mssql (pull_request) Successful in 5m49s
test mysql / test mysql (pull_request) Successful in 4m49s
test mysql8 / test mysql8 (pull_request) Successful in 5m3s
test postgres / test postgres (pull_request) Successful in 5m43s
test tidb / test tidb (pull_request) Successful in 5m37s
test sqlite / unit test & test sqlite (pull_request) Successful in 8m32s
884358aecd
Author
Contributor

@lunny added tests to cover the new cases ... this implied that I have to add the SyncWithOptions had to be added to EngineInterface

@lunny added tests to cover the new cases ... this implied that I have to add the **SyncWithOptions** had to be added to **EngineInterface**
6543 added 1 commit 2023-08-06 17:12:45 +00:00
enhance test
Some checks failed
test mariadb / test mariadb (pull_request) Failing after 4m32s
test cockroach / test cockroach (pull_request) Failing after 5m6s
test mssql / test mssql (pull_request) Failing after 4m49s
test mysql / test mysql (pull_request) Failing after 4m47s
test mysql8 / test mysql8 (pull_request) Failing after 4m38s
test postgres / test postgres (pull_request) Failing after 4m38s
test sqlite / unit test & test sqlite (pull_request) Failing after 4m16s
test tidb / test tidb (pull_request) Failing after 4m26s
5c957acce4
6543 added 1 commit 2023-08-06 17:13:42 +00:00
fix
All checks were successful
test mariadb / test mariadb (pull_request) Successful in 4m59s
test cockroach / test cockroach (pull_request) Successful in 6m57s
test mssql / test mssql (pull_request) Successful in 6m14s
test sqlite / unit test & test sqlite (pull_request) Successful in 8m59s
test mysql / test mysql (pull_request) Successful in 4m56s
test mysql8 / test mysql8 (pull_request) Successful in 5m1s
test postgres / test postgres (pull_request) Successful in 5m48s
test tidb / test tidb (pull_request) Successful in 4m27s
efc36dec89
Author
Contributor

I would say it's ready?

I would say it's ready?
Author
Contributor

CI failed unrelated :/

CI failed unrelated :/
lunny reviewed 2023-08-07 04:17:37 +00:00
sync.go Outdated
@ -221,24 +235,22 @@ func (session *Session) SyncWithOptions(opts SyncOptions, beans ...interface{})
}
}
if oriIndex != nil {
Owner

I still cannot understand why this lines should be removed.

I still cannot understand why this lines should be removed.
Author
Contributor

I have added it back and we can move this into another pull / discussion

I have added it back and we can move this into another pull / discussion
6543 marked this conversation as resolved
6543 added 2 commits 2023-08-07 14:13:25 +00:00
limit diff
All checks were successful
test mariadb / test mariadb (pull_request) Successful in 4m49s
test cockroach / test cockroach (pull_request) Successful in 7m30s
test mssql / test mssql (pull_request) Successful in 5m52s
test mysql / test mysql (pull_request) Successful in 4m43s
test mysql8 / test mysql8 (pull_request) Successful in 5m12s
test postgres / test postgres (pull_request) Successful in 5m41s
test tidb / test tidb (pull_request) Successful in 5m37s
test sqlite / unit test & test sqlite (pull_request) Successful in 8m22s
fc77a3b490
Author
Contributor

CI passed 🚀

CI passed 🚀
Author
Contributor

@lunny do i have to do something else?

@lunny do i have to do something else?
lunny approved these changes 2023-08-09 03:28:39 +00:00
lunny merged commit db7c264062 into master 2023-08-09 03:28:55 +00:00
lunny added the
kind
enhancement
label 2023-08-09 03:29:20 +00:00
lunny added this to the 1.3.3 milestone 2023-08-09 03:29:25 +00:00
6543 deleted branch SyncOptions_add_IgnoreConstrains 2023-08-09 15:57:12 +00:00
Sign in to join this conversation.
No description provided.