mirror of
https://github.com/usememos/memos.git
synced 2025-12-11 22:57:09 +08:00
chore: fix mysql migrator
This commit is contained in:
parent
1cdd70e008
commit
7dcc5cbaf1
1 changed files with 1 additions and 4 deletions
|
|
@ -52,11 +52,8 @@ func (d *Driver) nonProdMigrate(ctx context.Context) error {
|
||||||
func (d *Driver) prodMigrate(ctx context.Context) error {
|
func (d *Driver) prodMigrate(ctx context.Context) error {
|
||||||
currentVersion := version.GetCurrentVersion(d.profile.Mode)
|
currentVersion := version.GetCurrentVersion(d.profile.Mode)
|
||||||
migrationHistoryList, err := d.FindMigrationHistoryList(ctx, &MigrationHistoryFind{})
|
migrationHistoryList, err := d.FindMigrationHistoryList(ctx, &MigrationHistoryFind{})
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "failed to find migration history")
|
|
||||||
}
|
|
||||||
// If there is no migration history, we should apply the latest schema.
|
// If there is no migration history, we should apply the latest schema.
|
||||||
if len(migrationHistoryList) == 0 {
|
if err != nil || len(migrationHistoryList) == 0 {
|
||||||
buf, err := migrationFS.ReadFile("migration/prod/" + latestSchemaFileName)
|
buf, err := migrationFS.ReadFile("migration/prod/" + latestSchemaFileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Errorf("failed to read latest schema file: %s", err)
|
return errors.Errorf("failed to read latest schema file: %s", err)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue