temparal disable of RETURNING support due to Pragma bug (see tests)

This commit is contained in:
Сахнов Глеб Андреевич
2021-11-30 15:47:17 +03:00
parent 3bdc277e6b
commit 9878e66b9e
5 changed files with 117 additions and 5 deletions

View File

@@ -56,7 +56,11 @@ func (dialector Dialector) Initialize(db *gorm.DB) (err error) {
// https://www.sqlite.org/releaselog/3_35_0.html
if compareVersion(version, "3.35.0") >= 0 {
callbacks.RegisterDefaultCallbacks(db, &callbacks.Config{
CreateClauses: []string{"INSERT", "VALUES", "ON CONFLICT", "RETURNING"},
// CreateClauses should support RETURNING, but for now there's a bug with foreign key pragma
// RETURNING will be added as soon as bug is fixed
// in case of Primary key, the generated SQLite ID is still accessible though,
// due to LastGeneratedID support golang sql package
CreateClauses: []string{"INSERT", "VALUES", "ON CONFLICT"},
UpdateClauses: []string{"UPDATE", "SET", "WHERE", "RETURNING"},
DeleteClauses: []string{"DELETE", "FROM", "WHERE", "RETURNING"},
LastInsertIDReversed: true,