Preparing your workspace
Production databases need reliable backup and recovery strategies and controlled methods for changing schema over time.
A database can fail because of software errors, accidental deletion, hardware problems, or operational mistakes. Backups provide a way to recover data, but a backup strategy is only useful if restoration is tested. Migrations provide controlled, versioned changes to database structure such as adding columns, creating indexes, or creating new tables. Production schema changes should be planned carefully so application deployments and database changes remain compatible.
As a learning platform grows, a migration may add a new course status column while a backup strategy protects existing course and student data.
ALTER TABLE courses ADD COLUMN status VARCHAR(30) NOT NULL DEFAULT 'draft'; CREATE INDEX idx_courses_status ON courses(status);
The course table receives a new status column and an index to support queries filtering by status.