ccfos/nightingale

When trying to initialize the postgres database in version 8.2, table creation failed due to a syntax error

Open

#2,812 创建于 2025年8月1日

在 GitHub 查看
 (11 评论) (0 反应) (0 负责人)Go (1,720 fork)github user discovery
help wanted

仓库指标

Star
 (13,061 star)
PR 合并指标
 (PR 指标待抓取)

描述

Question and Steps to reproduce

安装过程:从官网下载8.2版本的二进制包,解压到服务器,修改好配置文件对接上pg数据库以及redis,使用二进制方式直接启动./n9e,执行报错(见下面的日志)

初步分析是因为migrate的sql语句没有适配好pg数据库,因为pg不支持longtext类型,对应以下建表语句

CREATE TABLE `builtin_payloads` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '''unique identifier''',
  `component_id` bigint NOT NULL DEFAULT 0 COMMENT '''component_id of payload''',
  `uuid` bigint(20) NOT NULL COMMENT '''uuid of payload''',
  `type` varchar(191) NOT NULL COMMENT '''type of payload''',
  `component` varchar(191) NOT NULL COMMENT '''component of payload''',
  `cate` varchar(191) NOT NULL COMMENT '''category of payload''',
  `name` varchar(191) NOT NULL COMMENT '''name of payload''',
  `tags` varchar(191) NOT NULL DEFAULT '' COMMENT '''tags of payload''',
  `content` longtext NOT NULL COMMENT '''content of payload''',
  `created_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''create time''',
  `created_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''creator''',
  `updated_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''update time''',
  `updated_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''updater''',
  PRIMARY KEY (`id`),
  KEY `idx_component` (`component`),
  KEY `idx_name` (`name`),
  KEY `idx_cate` (`cate`),
  KEY `idx_uuid` (`uuid`),
  KEY `idx_type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

或许将longtext改为text就可用,但是因为是二进制文件启动,需要重新发布新的版本才可修复。

Relevant logs and configurations

ormx/ormx.go:68 /home/runner/work/nightingale/nightingale/models/migrate/migrate.go:107 ERROR: type "longtext" does not exist (SQLSTATE 42704)

Version

8.2

贡献者指南