Quiz 2
Registry Synced

Learning Objectives

97 words
1 min read

Reading compass

Now · Database Schema

Learning Objectives

  • Design complex database schema
  • Implement relationships and indexes
  • Use Alembic for migrations

Database Schema

(Diagram)

Migration Example

python
# alembic/versions/xxx_create_tables.py
from alembic import op
import sqlalchemy as sa
def upgrade():
    op.create_table('products',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(200), nullable=False),
        sa.Column('price', sa.Float(), nullable=False),
        sa.Column('category_id', sa.Integer(), sa.ForeignKey('categories.id')),
        sa.Column('created_at', sa.DateTime(), server_default=sa.func.now()),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index('idx_product_category', 'products', ['category_id'])
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.