MIGRATION_INSTRUCTIONS.md 1.5 KB

Database Migration Instructions

Adding Description Field to Strategic Cooperation

This migration adds a description field to the strategic_cooperation table to allow configurable descriptions from the admin panel.

Option 1: Using Python Migration Script (Recommended)

cd backend
python migrate_strategic_cooperation.py

Option 2: Using SQL Directly

If you prefer to run SQL directly, connect to your MySQL database and run:

ALTER TABLE strategic_cooperation ADD COLUMN description TEXT;

Or use the SQL file:

mysql -h 47.109.147.74 -u official_web -p official_web < add_description_to_strategic_cooperation.sql

Verification

After running the migration, verify the column was added:

DESCRIBE strategic_cooperation;

You should see a description column in the output.

What Changed

  1. Backend Model (backend/app/models.py): Added description field to StrategicCooperation model
  2. Backend Routes (backend/app/routes.py): Updated API endpoints to handle description field
  3. Admin Panel (admin-web/src/views/StrategicCooperation.vue): Added description textarea input
  4. Official Website (official-web/src/views/Home.vue): Updated to display description from API with 2-line limit

Usage

After migration, you can:

  1. Log into the admin panel
  2. Navigate to "战略合作" (Strategic Cooperation)
  3. Edit or create items with custom descriptions
  4. Descriptions will display on the official website homepage (limited to 2 lines)