seedproject-web/api/db/migrations/006_projects_gallery_skills.sql

20 lines
964 B
MySQL
Raw Normal View History

-- Richer project detail pages: a photo gallery and a grouped skills breakdown.
--
-- Both are JSON, same reasoning as the categories/metrics columns already on
-- this table: small, per-row, repeating lists that never need to be queried
-- across projects. A gallery image belongs to exactly one project; normalising
-- it into cja_project_images would add a table and a join to store what is
-- effectively an ordered list.
--
-- gallery : [ { "src": "/projects/x/1.jpg", "alt": "...", "caption": "..." }, ... ]
-- skills : [ { "group": "Engineering", "items": ["API design", "..."] }, ... ]
--
-- `links` already exists and is JSON — no change needed. It now carries more
-- keys: { "live": "...", "instagram": "...", "github": "..." }.
ALTER TABLE `cja_projects`
ADD COLUMN `gallery` longtext DEFAULT NULL
CHECK (json_valid(`gallery`)) AFTER `metrics`,
ADD COLUMN `skills` longtext DEFAULT NULL
CHECK (json_valid(`skills`)) AFTER `stack`;