Seed default LMS personas in migration 063.
Insert ids 1-3 catalog rows and sync sequence on up; delete seed ids on down before dropping lms_personas. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
873be1b482
commit
9631711090
|
|
@ -14,4 +14,8 @@ SET persona_id = NULL;
|
|||
ALTER TABLE lms_practices
|
||||
ADD CONSTRAINT lms_practices_persona_id_fkey FOREIGN KEY (persona_id) REFERENCES users (id) ON DELETE SET NULL;
|
||||
|
||||
-- Remove seeded default personas before dropping the catalog table.
|
||||
DELETE FROM lms_personas
|
||||
WHERE id IN (1, 2, 3);
|
||||
|
||||
DROP TABLE IF EXISTS lms_personas;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,36 @@ WHERE is_active;
|
|||
|
||||
CREATE INDEX idx_lms_personas_created_at ON lms_personas (created_at DESC);
|
||||
|
||||
-- Default catalog personas (stable ids for envs and Postman); add more via API.
|
||||
INSERT INTO lms_personas (id, name, description, avatar_url, is_active)
|
||||
VALUES
|
||||
(
|
||||
1,
|
||||
'Friendly Coach',
|
||||
'Warm, encouraging tutor for everyday conversational practice.',
|
||||
NULL,
|
||||
TRUE
|
||||
),
|
||||
(
|
||||
2,
|
||||
'Exam Coach',
|
||||
'Structured, exam-style guidance and clear checkpoints.',
|
||||
NULL,
|
||||
TRUE
|
||||
),
|
||||
(
|
||||
3,
|
||||
'Story Narrator',
|
||||
'Story-led scenarios with character-driven prompts.',
|
||||
NULL,
|
||||
TRUE
|
||||
);
|
||||
|
||||
SELECT setval(
|
||||
pg_get_serial_sequence('lms_personas', 'id'),
|
||||
(SELECT COALESCE(MAX(id), 1) FROM lms_personas)
|
||||
);
|
||||
|
||||
-- persona_id historically referenced users.id; personas are now catalog rows on lms_personas.
|
||||
ALTER TABLE lms_practices DROP CONSTRAINT IF EXISTS lms_practices_persona_id_fkey;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user