Skip to content

Commit

Permalink
目录合并
Browse files Browse the repository at this point in the history
  • Loading branch information
movsb committed Mar 9, 2024
1 parent 59c5fc7 commit 9f05e30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/movsb/taoblog/metrics"
"github.com/movsb/taoblog/modules/auth"
"github.com/movsb/taoblog/service"
inits "github.com/movsb/taoblog/setup/init"
"github.com/movsb/taoblog/setup/migration"
"github.com/movsb/taoblog/theme"
"github.com/movsb/taoblog/theme/modules/canonical"
Expand Down Expand Up @@ -127,7 +126,7 @@ func initDatabase(cfg *config.Config) *sql.DB {
if err := row.Scan(&count); err != nil {
if se, ok := err.(sqlite3.Error); ok {
if strings.Contains(se.Error(), `no such table`) {
inits.Init(cfg, db)
migration.Init(cfg, db)
return db
}
}
Expand Down
5 changes: 2 additions & 3 deletions setup/init/init.go → setup/migration/init.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package inits
package migration

import (
"database/sql"
Expand All @@ -10,7 +10,6 @@ import (

"github.com/movsb/taoblog/config"
"github.com/movsb/taoblog/service/models"
"github.com/movsb/taoblog/setup/migration"
"github.com/movsb/taorm/taorm"
)

Expand Down Expand Up @@ -42,7 +41,7 @@ func Init(cfg *config.Config, db *sql.DB) {
now := int32(time.Now().Unix())
tx.Model(&models.Option{
Name: `db_ver`,
Value: fmt.Sprint(migration.MaxVersionNumber()),
Value: fmt.Sprint(MaxVersionNumber()),
}).MustCreate()
tx.Model(&models.Post{
Date: now,
Expand Down

0 comments on commit 9f05e30

Please sign in to comment.