Pridani editace fotek

This commit is contained in:
Michal Kváček
2023-10-27 22:30:59 +02:00
parent 322e61bce3
commit 3223d2ac00
17 changed files with 602 additions and 54 deletions
@@ -0,0 +1,39 @@
"""Add photo adjustment
Revision ID: 2acb6fa61028
Revises: 956d295689bf
Create Date: 2023-10-15 22:33:04.911765
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2acb6fa61028'
down_revision = '956d295689bf'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('photo_adjustment',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('photo_id', sa.Integer(), nullable=False),
sa.Column('rotate', sa.Float(), nullable=True),
sa.Column('contrast', sa.Float(), nullable=True),
sa.Column('brightness', sa.Float(), nullable=True),
sa.Column('saturation', sa.Float(), nullable=True),
sa.Column('sharpness', sa.Float(), nullable=True),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.ForeignKeyConstraint(['photo_id'], ['photo.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('photo_adjustment')
# ### end Alembic commands ###
@@ -0,0 +1,34 @@
"""add crop info
Revision ID: c3aef4ae2669
Revises: 2acb6fa61028
Create Date: 2023-10-20 23:53:21.772545
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c3aef4ae2669'
down_revision = '2acb6fa61028'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('photo_adjustment', sa.Column('crop_left', sa.Float(), nullable=True))
op.add_column('photo_adjustment', sa.Column('crop_top', sa.Float(), nullable=True))
op.add_column('photo_adjustment', sa.Column('crop_width', sa.Float(), nullable=True))
op.add_column('photo_adjustment', sa.Column('crop_height', sa.Float(), nullable=True))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('photo_adjustment', 'crop_height')
op.drop_column('photo_adjustment', 'crop_width')
op.drop_column('photo_adjustment', 'crop_top')
op.drop_column('photo_adjustment', 'crop_left')
# ### end Alembic commands ###
@@ -0,0 +1,30 @@
"""add size to photos
Revision ID: 4996ad8bc231
Revises: c3aef4ae2669
Create Date: 2023-10-24 16:32:10.826763
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4996ad8bc231'
down_revision = 'c3aef4ae2669'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('photo', sa.Column('width', sa.Integer(), nullable=False))
op.add_column('photo', sa.Column('height', sa.Integer(), nullable=False))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('photo', 'height')
op.drop_column('photo', 'width')
# ### end Alembic commands ###