feat: add CMS database model and migrations
Implement Content Management System database layer: Database Model: - ContentPage model with two-tier architecture - Platform defaults (vendor_id=NULL) - Vendor-specific overrides (vendor_id=123) - SEO fields (meta_description, meta_keywords) - Publishing workflow (is_published, published_at) - Navigation flags (show_in_footer, show_in_header) - Display ordering and timestamps Migrations: - Create content_pages table with all columns - Add indexes for performance (vendor_id, slug, published status) - Add unique constraint on (vendor_id, slug) - Add foreign key relationships with cascade delete Model Registration: - Add ContentPage to Vendor relationship - Import model in alembic/env.py for migration detection This provides the foundation for managing static content pages (About, FAQ, Contact, etc.) with platform defaults and vendor overrides. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,13 @@ class Vendor(Base, TimestampMixin):
|
||||
cascade="all, delete-orphan"
|
||||
) # Relationship with VendorTheme model for the active theme of the vendor
|
||||
|
||||
# Content pages relationship (vendor can override platform default pages)
|
||||
content_pages = relationship(
|
||||
"ContentPage",
|
||||
back_populates="vendor",
|
||||
cascade="all, delete-orphan"
|
||||
) # Relationship with ContentPage model for vendor-specific content pages
|
||||
|
||||
def __repr__(self):
|
||||
"""String representation of the Vendor object."""
|
||||
return f"<Vendor(id={self.id}, vendor_code='{self.vendor_code}', name='{self.name}', subdomain='{self.subdomain}')>"
|
||||
|
||||
Reference in New Issue
Block a user