-- Add short_name column to celestial_bodies table
-- This field stores NASA SBDB API abbreviated names for planets

-- Add column
ALTER TABLE celestial_bodies
ADD COLUMN IF NOT EXISTS short_name VARCHAR(50);

COMMENT ON COLUMN celestial_bodies.short_name IS 'NASA SBDB API short name (e.g., Juptr for Jupiter)';

-- Update short_name for 8 major planets
UPDATE celestial_bodies SET short_name = 'Merc' WHERE id = '199' AND name = 'Mercury';
UPDATE celestial_bodies SET short_name = 'Venus' WHERE id = '299' AND name = 'Venus';
UPDATE celestial_bodies SET short_name = 'Earth' WHERE id = '399' AND name = 'Earth';
UPDATE celestial_bodies SET short_name = 'Mars' WHERE id = '499' AND name = 'Mars';
UPDATE celestial_bodies SET short_name = 'Juptr' WHERE id = '599' AND name = 'Jupiter';
UPDATE celestial_bodies SET short_name = 'Satrn' WHERE id = '699' AND name = 'Saturn';
UPDATE celestial_bodies SET short_name = 'Urnus' WHERE id = '799' AND name = 'Uranus';
UPDATE celestial_bodies SET short_name = 'Neptn' WHERE id = '899' AND name = 'Neptune';

-- Verify the updates
SELECT id, name, name_zh, short_name
FROM celestial_bodies
WHERE short_name IS NOT NULL
ORDER BY CAST(id AS INTEGER);
