Moved database migrations for MySQL dialect into approriate package.

This commit is contained in:
Stanislav Nikitin 2018-12-01 02:29:14 +05:00
parent 400ce0db0c
commit b6556d6e90
7 changed files with 5 additions and 3 deletions

View File

@ -35,7 +35,6 @@ import (
"gitlab.com/pztrn/fastpastebin/captcha"
"gitlab.com/pztrn/fastpastebin/context"
"gitlab.com/pztrn/fastpastebin/database"
"gitlab.com/pztrn/fastpastebin/database/migrations"
"gitlab.com/pztrn/fastpastebin/pastes"
"gitlab.com/pztrn/fastpastebin/templater"
)
@ -56,8 +55,6 @@ func main() {
c.LoadConfiguration()
database.New(c)
c.Database.Initialize()
migrations.New(c)
migrations.Migrate()
templater.Initialize(c)
api.New(c)
api.InitializeAPI()

View File

@ -30,6 +30,7 @@ import (
"fmt"
// local
"gitlab.com/pztrn/fastpastebin/database/dialects/mysql/migrations"
"gitlab.com/pztrn/fastpastebin/pastes/model"
// other
@ -145,6 +146,10 @@ func (db *Database) Initialize() {
c.Logger.Info().Msg("Database connection established")
db.db = dbConn
// Perform migrations.
migrations.New(c)
migrations.Migrate()
}
func (db *Database) SavePaste(p *pastesmodel.Paste) (int64, error) {