]> source.dussan.org Git - gitea.git/commit
Set the name Mapper in migrations (#14526) (#14529)
author6543 <6543@obermui.de>
Sat, 30 Jan 2021 19:47:11 +0000 (20:47 +0100)
committerGitHub <noreply@github.com>
Sat, 30 Jan 2021 19:47:11 +0000 (21:47 +0200)
commit446c06b81794a7f71d2890812d0d9ff8b044395e
tree09bd4faa1fca0f4869880f1e56561731e52cd2d0
parent9569607abbcf7aee7d8353dc1ff32c9116081851
Set the name Mapper in migrations (#14526) (#14529)

Migrations currently uses the default Xorm mapper which is
not the same as the mapper Gitea actually uses.

This means that there is a difference between the struct
parsing and mapping to database tables in migrations as
compared to normal Sync2.

This was the cause for the catastrophic problem in v168 -
untagged fields are not mapped in the same way in migrations
as compared to outside of migrations.

This is also likely the cause of some weird subtle failures
in other migrations as any untagged field may not be being
mapped exactly the same way.

This PR suggests that we ensure that the mapper is set at
the start of the migrations code - but also enforces a strict
clean mapper between each migration.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
models/migrations/migrations.go