mirror of
https://github.com/bnair123/MusicAnalyser.git
synced 2026-02-25 11:46:07 +00:00
- Initialize React+Vite Frontend with Ant Design Dashboard. - Implement Data Enrichment: ReccoBeats (Audio Features) and Spotify (Genres). - Update Database Schema via Alembic Migrations. - Add Docker support (Dockerfile, docker-compose.yml). - Update README with hosting instructions.
74 lines
3.0 KiB
Python
74 lines
3.0 KiB
Python
"""Initial Schema Complete
|
|
|
|
Revision ID: 707387fe1be2
|
|
Revises:
|
|
Create Date: 2025-12-24 21:23:43.744292
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '707387fe1be2'
|
|
down_revision: Union[str, Sequence[str], None] = None
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('tracks',
|
|
sa.Column('id', sa.String(), nullable=False),
|
|
sa.Column('name', sa.String(), nullable=True),
|
|
sa.Column('artist', sa.String(), nullable=True),
|
|
sa.Column('album', sa.String(), nullable=True),
|
|
sa.Column('duration_ms', sa.Integer(), nullable=True),
|
|
sa.Column('popularity', sa.Integer(), nullable=True),
|
|
sa.Column('raw_data', sa.JSON(), nullable=True),
|
|
sa.Column('danceability', sa.Float(), nullable=True),
|
|
sa.Column('energy', sa.Float(), nullable=True),
|
|
sa.Column('key', sa.Integer(), nullable=True),
|
|
sa.Column('loudness', sa.Float(), nullable=True),
|
|
sa.Column('mode', sa.Integer(), nullable=True),
|
|
sa.Column('speechiness', sa.Float(), nullable=True),
|
|
sa.Column('acousticness', sa.Float(), nullable=True),
|
|
sa.Column('instrumentalness', sa.Float(), nullable=True),
|
|
sa.Column('liveness', sa.Float(), nullable=True),
|
|
sa.Column('valence', sa.Float(), nullable=True),
|
|
sa.Column('tempo', sa.Float(), nullable=True),
|
|
sa.Column('time_signature', sa.Integer(), nullable=True),
|
|
sa.Column('genres', sa.JSON(), nullable=True),
|
|
sa.Column('lyrics_summary', sa.String(), nullable=True),
|
|
sa.Column('genre_tags', sa.String(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_tracks_id'), 'tracks', ['id'], unique=False)
|
|
op.create_table('play_history',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('track_id', sa.String(), nullable=True),
|
|
sa.Column('played_at', sa.DateTime(), nullable=True),
|
|
sa.Column('context_uri', sa.String(), nullable=True),
|
|
sa.ForeignKeyConstraint(['track_id'], ['tracks.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_play_history_id'), 'play_history', ['id'], unique=False)
|
|
op.create_index(op.f('ix_play_history_played_at'), 'play_history', ['played_at'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_play_history_played_at'), table_name='play_history')
|
|
op.drop_index(op.f('ix_play_history_id'), table_name='play_history')
|
|
op.drop_table('play_history')
|
|
op.drop_index(op.f('ix_tracks_id'), table_name='tracks')
|
|
op.drop_table('tracks')
|
|
# ### end Alembic commands ###
|