2022-08-16 23:30:23 +08:00
|
|
|
package migration
|
|
|
|
|
|
|
|
import (
|
2022-10-17 16:32:31 +08:00
|
|
|
"github.com/1Panel-dev/1Panel/backend/global"
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/init/migration/migrations"
|
2022-08-16 23:30:23 +08:00
|
|
|
|
|
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Init() {
|
|
|
|
m := gormigrate.New(global.DB, gormigrate.DefaultOptions, []*gormigrate.Migration{
|
|
|
|
migrations.AddTableOperationLog,
|
2022-08-18 18:54:21 +08:00
|
|
|
migrations.AddTableHost,
|
2022-09-15 10:44:43 +08:00
|
|
|
migrations.AddTableMonitor,
|
|
|
|
migrations.AddTableSetting,
|
2022-09-16 18:53:45 +08:00
|
|
|
migrations.AddTableBackupAccount,
|
2022-09-20 19:12:48 +08:00
|
|
|
migrations.AddTableCronjob,
|
2022-09-22 16:16:04 +08:00
|
|
|
migrations.AddTableApp,
|
2022-10-09 16:17:15 +08:00
|
|
|
migrations.AddTableImageRepo,
|
2022-10-28 17:04:57 +08:00
|
|
|
migrations.AddTableWebsite,
|
2022-10-20 18:45:47 +08:00
|
|
|
migrations.AddTableDatabaseMysql,
|
2023-01-09 22:55:10 +08:00
|
|
|
migrations.AddTableSnap,
|
2023-03-22 21:42:30 +08:00
|
|
|
migrations.AddDefaultGroup,
|
2023-03-29 14:58:28 +08:00
|
|
|
migrations.AddTableRuntime,
|
2023-04-08 14:02:14 +08:00
|
|
|
migrations.UpdateTableApp,
|
2023-04-10 21:50:24 +08:00
|
|
|
migrations.UpdateTableHost,
|
2023-04-12 21:52:30 +08:00
|
|
|
migrations.UpdateTableWebsite,
|
2023-04-25 14:34:16 +08:00
|
|
|
migrations.AddEntranceAndSSL,
|
2023-05-15 22:40:05 +08:00
|
|
|
migrations.UpdateTableSetting,
|
|
|
|
migrations.UpdateTableAppDetail,
|
2023-05-19 21:47:46 +08:00
|
|
|
migrations.AddBindAndAllowIPs,
|
2023-05-24 18:36:41 +08:00
|
|
|
migrations.UpdateCronjobWithSecond,
|
2023-05-30 14:22:57 +08:00
|
|
|
migrations.UpdateWebsite,
|
2023-06-23 23:06:13 +08:00
|
|
|
migrations.AddBackupAccountDir,
|
2023-06-25 17:52:13 +08:00
|
|
|
migrations.AddMfaInterval,
|
2023-07-03 16:36:18 +08:00
|
|
|
migrations.UpdateAppDetail,
|
2023-07-03 16:48:14 +08:00
|
|
|
migrations.EncryptHostPassword,
|
2023-07-19 16:25:41 +08:00
|
|
|
migrations.AddRemoteDB,
|
2023-08-03 18:36:01 +08:00
|
|
|
migrations.UpdateRedisParam,
|
2023-08-09 14:14:12 +08:00
|
|
|
migrations.UpdateCronjobWithDb,
|
2023-08-15 22:48:11 +08:00
|
|
|
migrations.AddTableFirewall,
|
2023-09-01 23:10:14 +08:00
|
|
|
migrations.AddDatabases,
|
2023-08-29 10:50:15 +08:00
|
|
|
migrations.UpdateDatabase,
|
2023-08-31 15:14:11 +08:00
|
|
|
migrations.UpdateAppInstallResource,
|
2023-09-14 22:50:13 +08:00
|
|
|
migrations.DropDatabaseLocal,
|
2023-09-18 17:22:21 +08:00
|
|
|
|
|
|
|
migrations.AddDefaultNetwork,
|
2023-09-25 17:50:14 +08:00
|
|
|
migrations.UpdateRuntime,
|
2023-10-08 14:54:14 +08:00
|
|
|
migrations.UpdateTag,
|
2023-10-25 10:41:26 +08:00
|
|
|
|
2023-10-20 17:56:46 +08:00
|
|
|
migrations.AddFavorite,
|
2023-10-25 10:41:26 +08:00
|
|
|
migrations.AddBindAddress,
|
2023-10-31 14:14:30 +08:00
|
|
|
migrations.AddCommandGroup,
|
2023-11-03 18:18:12 +08:00
|
|
|
migrations.AddAppSyncStatus,
|
2023-11-14 18:44:09 +08:00
|
|
|
|
|
|
|
migrations.UpdateAcmeAccount,
|
2023-11-20 10:44:10 +08:00
|
|
|
migrations.UpdateWebsiteSSL,
|
2023-11-27 12:04:09 +08:00
|
|
|
migrations.AddWebsiteCA,
|
2023-11-28 15:00:10 +08:00
|
|
|
migrations.AddDockerSockPath,
|
2023-11-29 10:46:07 +08:00
|
|
|
migrations.AddDatabaseSSL,
|
2023-11-29 22:04:08 +08:00
|
|
|
migrations.AddDefaultCA,
|
2023-12-04 14:56:09 +08:00
|
|
|
migrations.AddSettingRecycleBin,
|
2023-12-18 17:54:15 +08:00
|
|
|
migrations.UpdateWebsiteBackupRecord,
|
2024-01-02 21:54:28 +08:00
|
|
|
|
|
|
|
migrations.AddTablePHPExtensions,
|
2024-01-07 22:52:41 +08:00
|
|
|
migrations.AddTableDatabasePostgresql,
|
2024-01-09 12:43:33 +08:00
|
|
|
migrations.AddPostgresqlSuperUser,
|
2024-01-11 11:01:40 +08:00
|
|
|
migrations.UpdateCronjobWithWebsite,
|
2024-01-19 16:48:41 +08:00
|
|
|
migrations.UpdateOneDriveToken,
|
2024-01-22 22:29:19 +08:00
|
|
|
migrations.UpdateCronjobSpec,
|
2024-01-24 17:41:56 +08:00
|
|
|
migrations.UpdateBackupRecordPath,
|
2024-01-25 13:55:11 +08:00
|
|
|
migrations.UpdateSnapshotRecords,
|
2024-02-05 17:28:12 +08:00
|
|
|
|
|
|
|
migrations.UpdateWebDavConf,
|
2022-08-16 23:30:23 +08:00
|
|
|
})
|
|
|
|
if err := m.Migrate(); err != nil {
|
|
|
|
global.LOG.Error(err)
|
|
|
|
panic(err)
|
|
|
|
}
|
2023-03-01 18:17:31 +08:00
|
|
|
global.LOG.Info("Migration run successfully")
|
2022-08-16 23:30:23 +08:00
|
|
|
}
|