apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.

Home Page:https://www.apolloconfig.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

低版本升级最新版本 sql结构更新问题

muguan1995 opened this issue · comments

scripts/sql/src 目录下没有2.1之前的升级sql文件了,原来低版本的apollo要如何升级数据库结构版本呢?

🤖

你好,@muguan1995!很高兴再次看到你的提问。

根据我找到的相关问题,你可以参考以下步骤来升级你的Apollo数据库结构版本:

  1. 连接到Apollo使用的MySQL数据库。你可以使用MySQL客户端,如MySQL Workbench,或者使用mysql命令从命令行进行连接。

  2. 使用USE命令选择ApolloPortalDB数据库:

USE ApolloPortalDB;
  1. 执行提供的脚本中的SQL命令。这些命令在数据库的各个表中添加了DeletedAt列:
ALTER TABLE `App`
    ADD COLUMN `DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds' AFTER `IsDeleted`;

-- 根据脚本重复其他表的操作

请注意,在执行任何升级操作之前,你应该备份你的数据库,以防万一出现问题导致数据丢失。同时,确保SQL脚本与你当前的数据库版本和结构兼容。

从2.1版本到最新的2.2.0版本,Apollo数据库结构的具体变化如下:

  1. AppCommitNamespaceReleaseAccessKey表中的AppId列已被修改为具有VARCHAR(64)数据类型,NOT NULL约束,并且默认值为'default'。

  2. Commit表中的AppId索引已被删除并重新添加。

  3. Namespace表中的唯一索引UK_AppId_ClusterName_NamespaceName_DeletedAt已被删除并重新添加,列名相同。

  4. Release表中的AppId_ClusterName_GroupName索引已被删除并重新添加,列名为(AppId,ClusterName(191),NamespaceName(191),DeletedAt)。

  5. 添加了AuditLog表,包含以下列:IdTraceIdSpanIdParentSpanIdFollowsFromSpanIdOperatorOpTypeOpNameDescriptionIsDeletedDeletedAtDataChange_CreatedByDataChange_CreatedTimeDataChange_LastModifiedByDataChange_LastTime

  6. 添加了AuditLogDataInfluence表,包含以下列:IdSpanIdInfluenceEntityIdInfluenceEntityNameFieldNameFieldOldValueFieldNewValueIsDeletedDeletedAtDataChange_CreatedByDataChange_CreatedTimeDataChange_LastModifiedByDataChange_LastTime

这些变化可以在提供的SQL脚本中看到。

参考资料:

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

转移到 https://github.com/apolloconfig/apollo/tree/master/scripts/sql/profiles/mysql-default/delta

找到了,感谢。顺便请问一下 v190-v200/apolloportaldb-v190-v200-after.sql 和普通的apolloportaldb-v190-v200.sql 区别是什么两个都要执行就行了吧

可以看一下 2.0.0 的升级步骤

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.