From 43b3ef47f301a53ae6b62d0dd6370d3a86102955 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 14 Sep 2023 22:50:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F=E9=94=99=E4=B9=B1?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#2296)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/init/migration/migrate.go | 1 + backend/init/migration/migrations/init.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/backend/init/migration/migrate.go b/backend/init/migration/migrate.go index 365094f71..582c433f2 100644 --- a/backend/init/migration/migrate.go +++ b/backend/init/migration/migrate.go @@ -42,6 +42,7 @@ func Init() { migrations.AddDatabases, migrations.UpdateDatabase, migrations.UpdateAppInstallResource, + migrations.DropDatabaseLocal, }) if err := m.Migrate(); err != nil { global.LOG.Error(err) diff --git a/backend/init/migration/migrations/init.go b/backend/init/migration/migrations/init.go index 9b5fdbd62..a7fb74a2b 100644 --- a/backend/init/migration/migrations/init.go +++ b/backend/init/migration/migrations/init.go @@ -759,3 +759,11 @@ var UpdateAppInstallResource = &gormigrate.Migration{ return nil }, } + +var DropDatabaseLocal = &gormigrate.Migration{ + ID: "20230914-drop-database-local", + Migrate: func(tx *gorm.DB) error { + _ = tx.Where("name = ? AND address = ?", "local", "127.0.0.1").Delete(&model.Database{}).Error + return nil + }, +}