Files
medical-mall/doc_mall/QUICK_START_MIGRATION.md
2026-01-21 12:12:22 +08:00

2.3 KiB

快速开始迁移

🚀 快速执行迁移

Windows (PowerShell)

1. 预览模式(推荐先执行)

cd doc_mall
.\migrate.ps1 -TargetPath "D:\path\to\new-repo" -DryRun

2. 执行迁移

cd doc_mall
.\migrate.ps1 -TargetPath "D:\path\to\new-repo"

3. 包含 Supabase 组件

.\migrate.ps1 -TargetPath "D:\path\to\new-repo" -CopySupabaseComponents

4. 包含工具函数

.\migrate.ps1 -TargetPath "D:\path\to\new-repo" -CopyUtils

Linux/Mac (Bash)

1. 预览模式

cd doc_mall
chmod +x migrate.sh
./migrate.sh /path/to/new-repo --dry-run

2. 执行迁移

./migrate.sh /path/to/new-repo

3. 包含可选组件

./migrate.sh /path/to/new-repo --copy-supabase --copy-utils

📋 迁移后的必要步骤

1. 检查迁移结果

# 检查目标目录
ls D:\path\to\new-repo\doc_mall
ls D:\path\to\new-repo\pages\mall
ls D:\path\to\new-repo\types

2. 配置 Supabase

创建配置文件 config/supabase.config.ts:

export const supabaseConfig = {
  url: 'https://your-project.supabase.co',
  anonKey: 'your-anon-key',
}

3. 执行数据库脚本

方式 1: Supabase Dashboard

  1. 登录 Supabase Dashboard
  2. 进入 SQL Editor
  3. 复制 doc_mall/database/complete_mall_database.sql 内容
  4. 执行脚本

方式 2: psql 命令行

psql -h your-host -U postgres -d your_database -f doc_mall/database/complete_mall_database.sql

4. 验证数据库

psql -h your-host -U postgres -d your_database -f doc_mall/database/validation_test.sql

5. 插入测试数据(可选)

psql -h your-host -U postgres -d your_database -f doc_mall/database/mock_data_insert.sql

验证清单

  • 文件已复制到目标目录
  • 目录结构正确
  • Supabase 配置已更新
  • 数据库脚本已执行
  • 数据库验证通过
  • 项目可以编译
  • 页面可以正常加载

📚 更多信息