koishi-plugin-wordpress-notifier 2.8.2 → 2.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -389,6 +389,20 @@ npm install
389
389
 
390
390
  ## 版本历史
391
391
 
392
+ ### 2.8.3 (2026-02-19)
393
+
394
+ - 🐛 修复数据库表结构初始化问题
395
+
396
+ **核心修复**
397
+ - ✅ 修复 `checkAndFixTableStructure` 函数中的表结构重新初始化逻辑
398
+ - ✅ 确保 `wordpress_post_updates` 表重新初始化时包含 `siteId` 字段,并且唯一约束为 `['siteId', 'postId']`
399
+ - ✅ 确保 `wordpress_user_registrations` 表重新初始化时包含 `siteId` 字段,并且唯一约束为 `['siteId', 'userId']`
400
+ - ✅ 解决了多站点模式下唯一约束失败的问题
401
+
402
+ **稳定性提升**
403
+ - ✅ 提高了插件在数据库表结构异常情况下的恢复能力
404
+ - ✅ 确保表结构重新初始化时与当前代码版本保持一致
405
+
392
406
  ### 2.8.2 (2026-02-19)
393
407
 
394
408
  - 🚀 全面升级插件功能,支持多站点管理和高级配置
package/lib/index.js CHANGED
@@ -533,13 +533,14 @@ function apply(ctx, config) {
533
533
  // 重新扩展模型
534
534
  ctx.model.extend('wordpress_post_updates', {
535
535
  id: 'integer',
536
+ siteId: 'string',
536
537
  postId: 'integer',
537
538
  lastModified: 'timestamp',
538
539
  pushedAt: 'timestamp'
539
540
  }, {
540
541
  primary: 'id',
541
542
  autoInc: true,
542
- unique: ['postId']
543
+ unique: ['siteId', 'postId'] // 每个站点的文章 ID 唯一
543
544
  });
544
545
  ctx.logger.info('wordpress_post_updates 表重新初始化成功');
545
546
  }
@@ -564,12 +565,13 @@ function apply(ctx, config) {
564
565
  // 重新扩展模型
565
566
  ctx.model.extend('wordpress_user_registrations', {
566
567
  id: 'integer',
568
+ siteId: 'string',
567
569
  userId: 'integer',
568
570
  pushedAt: 'timestamp'
569
571
  }, {
570
572
  primary: 'id',
571
573
  autoInc: true,
572
- unique: ['userId']
574
+ unique: ['siteId', 'userId'] // 每个站点的用户 ID 唯一
573
575
  });
574
576
  ctx.logger.info('wordpress_user_registrations 表重新初始化成功');
575
577
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-wordpress-notifier",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "description": "WordPress 文章自动推送到 QQ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",