-- Migration 017: 模型分组
SET search_path TO crawl;

CREATE TABLE IF NOT EXISTS model_groups (
    id          BIGSERIAL    PRIMARY KEY,
    name        VARCHAR(200) NOT NULL,
    note        TEXT,
    created_at  TIMESTAMPTZ  NOT NULL DEFAULT NOW(),
    updated_at  TIMESTAMPTZ  NOT NULL DEFAULT NOW()
);

ALTER TABLE models ADD COLUMN IF NOT EXISTS group_id BIGINT;

COMMENT ON TABLE  model_groups      IS '模型分组，如"文本生成"、"图像生成"等';
COMMENT ON COLUMN models.group_id   IS '所属分组 ID，NULL 表示未分组';
