Skip to content

[TASK]: Add deterministic local development seed script for Supabase CLI #19

Description

@Hanu2908

Task summary

Add a deterministic SQL seed script in supabase/seed.sql to provide a reproducible local database environment for new contributors.

Estimated scope / difficulty

Intermediate / DevEx (2 to 4 hours)

Motivation and context

New contributors setting up ClassHub locally with the Supabase CLI need ready-to-use sample sections, subjects, timetable slots, attendance logs, and announcements so they can immediately develop and test features without manually inserting database rows or accessing production credentials.

Relevant files and code pointers

  • supabase/seed.sql (New file)
  • supabase/migrations/ (Reference for active table schema and foreign keys)
  • docs/backend.md
  • CONTRIBUTING.md

Acceptance criteria

  • Create a supabase/seed.sql file containing deterministic mock data for a demo college section (Section P2).
  • Seed data includes:
    • Demo section record
    • Core engineering subjects (e.g., DBMS, Operating Systems, Computer Networks, Data Structures)
    • Weekly recurring timetable schedule slots with batch room assignments
    • Sample attendance records and class logs
    • Sample high-priority and general announcements with tags
  • Uses static UUIDs for deterministic cross-table references.
  • Contains zero real student personal information (PII) and zero real passwords/credentials.
  • Executes cleanly without errors on supabase db reset.
  • Document the local Supabase setup and seed instructions in CONTRIBUTING.md and docs/backend.md.
  • npm test and npm run lint pass with 0 errors.

Implementation guide and hints

  • Inspect the latest migration files in supabase/migrations/ to match column names and table constraints.
  • Ensure insert order respects foreign key hierarchies: sections -> users / subjects -> timetable_slots / announcements / attendance_records.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions