landingpagebackendapi-xog2kg/alembic/versions/001_initial_migration.py
Automated Action 246b4e058e Implement comprehensive FastAPI backend for landing page
Added complete backend infrastructure with:
- Authentication system with OAuth (Google, GitHub, Apple)
- Stripe payment processing with subscription management
- Testimonials management API
- Usage statistics tracking
- Email communication services
- Health monitoring endpoints
- Database migrations with Alembic
- Comprehensive API documentation

All APIs are production-ready with proper error handling,
security measures, and environment variable configuration.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-01 23:39:39 +00:00

94 lines
4.3 KiB
Python

"""Initial migration
Revision ID: 001
Revises:
Create Date: 2024-01-01 00:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '001'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# Create users table
op.create_table(
'users',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', sa.String(), nullable=False),
sa.Column('username', sa.String(), nullable=True),
sa.Column('full_name', sa.String(), nullable=True),
sa.Column('hashed_password', sa.String(), nullable=True),
sa.Column('is_active', sa.Boolean(), nullable=True),
sa.Column('is_verified', sa.Boolean(), nullable=True),
sa.Column('avatar_url', sa.String(), nullable=True),
sa.Column('google_id', sa.String(), nullable=True),
sa.Column('github_id', sa.String(), nullable=True),
sa.Column('apple_id', sa.String(), nullable=True),
sa.Column('stripe_customer_id', sa.String(), nullable=True),
sa.Column('subscription_status', sa.String(), nullable=True),
sa.Column('subscription_plan', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=True),
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_users_id'), 'users', ['id'], unique=False)
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
op.create_index(op.f('ix_users_google_id'), 'users', ['google_id'], unique=True)
op.create_index(op.f('ix_users_github_id'), 'users', ['github_id'], unique=True)
op.create_index(op.f('ix_users_apple_id'), 'users', ['apple_id'], unique=True)
# Create testimonials table
op.create_table(
'testimonials',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('title', sa.String(), nullable=True),
sa.Column('company', sa.String(), nullable=True),
sa.Column('content', sa.Text(), nullable=False),
sa.Column('avatar_url', sa.String(), nullable=True),
sa.Column('rating', sa.Float(), nullable=True),
sa.Column('is_featured', sa.Boolean(), nullable=True),
sa.Column('is_active', sa.Boolean(), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=True),
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_testimonials_id'), 'testimonials', ['id'], unique=False)
# Create usage_stats table
op.create_table(
'usage_stats',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('metric_name', sa.String(), nullable=False),
sa.Column('metric_value', sa.BigInteger(), nullable=False),
sa.Column('description', sa.String(), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=True),
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_usage_stats_id'), 'usage_stats', ['id'], unique=False)
op.create_index(op.f('ix_usage_stats_metric_name'), 'usage_stats', ['metric_name'], unique=False)
def downgrade() -> None:
op.drop_index(op.f('ix_usage_stats_metric_name'), table_name='usage_stats')
op.drop_index(op.f('ix_usage_stats_id'), table_name='usage_stats')
op.drop_table('usage_stats')
op.drop_index(op.f('ix_testimonials_id'), table_name='testimonials')
op.drop_table('testimonials')
op.drop_index(op.f('ix_users_apple_id'), table_name='users')
op.drop_index(op.f('ix_users_github_id'), table_name='users')
op.drop_index(op.f('ix_users_google_id'), table_name='users')
op.drop_index(op.f('ix_users_username'), table_name='users')
op.drop_index(op.f('ix_users_email'), table_name='users')
op.drop_index(op.f('ix_users_id'), table_name='users')
op.drop_table('users')