Skip to content

migrations Directory

Purpose

This directory contains Django database migration files for the parodynews application. These migrations define database schema changes, table creation, field modifications, and data transformations that evolve the database structure over time while maintaining data integrity.

Contents

  • __init__.py: Python package initialization file making this directory a Python package
  • Migration files (generated by Django): Python files that define database schema changes and data migrations

Usage

Django migrations are managed through Django's migration framework:

# Create new migrations after model changes
python manage.py makemigrations parodynews

# Apply migrations to database
python manage.py migrate

# Show migration status
python manage.py showmigrations

# Reverse migrations (if needed)
python manage.py migrate parodynews <migration_number>

# Create empty migration for custom operations
python manage.py makemigrations --empty parodynews

Migration workflow: 1. Model Changes: Modify Django models in models.py 2. Generate Migrations: Run makemigrations to create migration files 3. Review: Check generated migration files for correctness 4. Apply: Run migrate to apply changes to database 5. Version Control: Commit migration files with model changes

Container Configuration

Migrations are executed within the Django application environment: - Applied automatically during container startup in production - Can be run manually in development containers - Database connection configured through Django settings - PostgreSQL-only (this project does not support SQLite)

  • Incoming: Generated from Django model definitions and schema changes
  • Outgoing: Applied to database to create/modify tables and data structures