Files
telegram-management-system/database/migrations/migrate-data-safe.sql
你的用户名 237c7802e5
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit: Telegram Management System
Full-stack web application for Telegram management
- Frontend: Vue 3 + Vben Admin
- Backend: NestJS
- Features: User management, group broadcast, statistics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 15:37:50 +08:00

35 lines
1.3 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 清空目标表避免主键冲突
TRUNCATE TABLE tg_account;
TRUNCATE TABLE tg_firstname;
TRUNCATE TABLE tg_lastname;
TRUNCATE TABLE tg_group;
TRUNCATE TABLE tg_message;
TRUNCATE TABLE tg_config;
TRUNCATE TABLE tg_script;
TRUNCATE TABLE tg_script_article;
TRUNCATE TABLE tg_script_project;
TRUNCATE TABLE tg_script_task;
-- 迁移TG账号数据只迁移共同字段
INSERT INTO tg_account (id, firstname, lastname, phone, password, usageId, isBan, lastOnline, createdAt, updatedAt, status, session, banTime, nextTime, addGroupIds, about, targetId)
SELECT id, firstname, lastname, phone, password, usageId, isBan, lastOnline, createdAt, updatedAt, status, session, banTime, nextTime, addGroupIds, about, targetId
FROM c_tg_account;
-- 迁移名字数据
INSERT INTO tg_firstname SELECT * FROM c_firstname;
INSERT INTO tg_lastname SELECT * FROM c_lastname;
-- 迁移群组数据
INSERT INTO tg_group SELECT * FROM c_group;
-- 迁移消息数据
INSERT INTO tg_message SELECT * FROM c_message;
-- 迁移配置数据
INSERT INTO tg_config SELECT * FROM c_config;
-- 迁移脚本相关数据
INSERT INTO tg_script SELECT * FROM c_script;
INSERT INTO tg_script_article SELECT * FROM c_script_article;
INSERT INTO tg_script_project SELECT * FROM c_script_project;
INSERT INTO tg_script_task SELECT * FROM c_script_task;