chore: 重写初始提交(清空历史,整理后全量提交)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace addon\blog\library;
|
||||
|
||||
use ywxapp\model\BaseModel;
|
||||
|
||||
/**
|
||||
* 博客(blog)插件专属表结构自愈。
|
||||
*
|
||||
* 归属原则:blog_* 表属于 blog 插件私有表,其列兜底逻辑内聚在本插件,
|
||||
* 不污染核心框架 ywxapp/library/BaseModel 自愈引擎(核心只保留通用引擎)。
|
||||
*
|
||||
* 状态语义:0草稿 1待审 2通过 3驳回(发布接口按 need_audit 配置走机审/人工审)。
|
||||
*/
|
||||
class BlogSchema
|
||||
{
|
||||
/**
|
||||
* 补齐 blog_article 扩展列(审核状态 / 经纬度),幂等。
|
||||
* 建表由插件 install.sql 负责,此处仅做运行时兜底(老库 / 全新安装后结构差异)。
|
||||
*/
|
||||
public static function ensure(): void
|
||||
{
|
||||
$prefix = BaseModel::currentPrefix();
|
||||
$p = $prefix;
|
||||
BaseModel::ensureColumn("{$p}blog_article", 'audit_status', "tinyint NOT NULL DEFAULT 2 COMMENT '审核状态:0草稿 1待审 2通过 3驳回'");
|
||||
BaseModel::ensureColumn("{$p}blog_article", 'lat', "decimal(10,7) NOT NULL DEFAULT '0.0000000' COMMENT '纬度(可选)'");
|
||||
BaseModel::ensureColumn("{$p}blog_article", 'lng', "decimal(10,7) NOT NULL DEFAULT '0.0000000' COMMENT '经度(可选)'");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user