Commit Graph
4 Commits
Author SHA1 Message Date
zeripathandGitHub 9302eba971 DBContext is just a Context (#17100)
* DBContext is just a Context

This PR removes some of the specialness from the DBContext and makes it context
This allows us to simplify the GetEngine code to wrap around any context in future
and means that we can change our loadRepo(e Engine) functions to simply take contexts.

Signed-off-by: Andrew Thornton <[email protected]>

* fix unit tests

Signed-off-by: Andrew Thornton <[email protected]>

* another place that needs to set the initial context

Signed-off-by: Andrew Thornton <[email protected]>

* avoid race

Signed-off-by: Andrew Thornton <[email protected]>

* change attachment error

Signed-off-by: Andrew Thornton <[email protected]>
2021-09-23 23:45:36 +08:00
a4bfef265d Move db related basic functions to models/db (#17075)
* Move db related basic functions to models/db

* Fix lint

* Fix lint

* Fix test

* Fix lint

* Fix lint

* revert unnecessary change

* Fix test

* Fix wrong replace string

* Use *Context

* Correct committer spelling and fix wrong replaced words

Co-authored-by: zeripath <[email protected]>
2021-09-19 19:49:59 +08:00
6ebd833780 Fix DB session cleanup (#15697)
The DB session clean up needs to check expiry not created_unix.

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
2021-05-01 22:51:03 -04:00
0a9a484e1e Create DB session provider(based on xorm) (#13031)
* Create Xorm session provider

This PR creates a Xorm session provider which creates
the appropriate Session table for macaron/session.

Fix #7137

Signed-off-by: Andrew Thornton <[email protected]>

* extraneous l

Signed-off-by: Andrew Thornton <[email protected]>

* fix lint

Signed-off-by: Andrew Thornton <[email protected]>

* use key instead of ID to be compatible with go-macaron/session

Signed-off-by: Andrew Thornton <[email protected]>

* And change the migration too.

Signed-off-by: Andrew Thornton <[email protected]>

* Update spacing of imports

Co-authored-by: 6543 <[email protected]>

* Update modules/session/xorm.go

Co-authored-by: techknowlogick <[email protected]>

* add xorm provider to the virtual provider

Signed-off-by: Andrew Thornton <[email protected]>

* prep for master merge

* prep for merge master

* As per @lunny

* move migration out of the way

* Move to call this db session as per @lunny

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2021-02-15 00:33:31 -05:00