Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 0 additions & 107 deletions alembic/versions/046ada00e750_creation_of_upscaling_tables.py

This file was deleted.

This file was deleted.

88 changes: 88 additions & 0 deletions alembic/versions/833e4a41c2ad_generation_of_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
"""generation of tables

Revision ID: 833e4a41c2ad
Revises:
Create Date: 2025-11-24 13:43:40.278229

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision: str = '833e4a41c2ad'
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('upscaling_tasks',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('title', sa.String(length=255), nullable=False),
sa.Column('label', sa.Enum('OPENEO', 'OGC_API_PROCESS', name='processtypeenum'), nullable=False),
sa.Column('status', sa.Enum('CREATED', 'QUEUED', 'RUNNING', 'FINISHED', 'CANCELED', 'FAILED', 'UNKNOWN', name='processingstatusenum'), nullable=False),
sa.Column('user_id', sa.String(length=255), nullable=False),
sa.Column('service', mysql.LONGTEXT(), nullable=False),
sa.Column('created', sa.DateTime(), nullable=False),
sa.Column('updated', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_upscaling_tasks_created'), 'upscaling_tasks', ['created'], unique=False)
op.create_index(op.f('ix_upscaling_tasks_id'), 'upscaling_tasks', ['id'], unique=False)
op.create_index(op.f('ix_upscaling_tasks_label'), 'upscaling_tasks', ['label'], unique=False)
op.create_index(op.f('ix_upscaling_tasks_status'), 'upscaling_tasks', ['status'], unique=False)
op.create_index(op.f('ix_upscaling_tasks_title'), 'upscaling_tasks', ['title'], unique=False)
op.create_index(op.f('ix_upscaling_tasks_updated'), 'upscaling_tasks', ['updated'], unique=False)
op.create_index(op.f('ix_upscaling_tasks_user_id'), 'upscaling_tasks', ['user_id'], unique=False)
op.create_table('processing_jobs',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('title', sa.String(length=255), nullable=False),
sa.Column('label', sa.Enum('OPENEO', 'OGC_API_PROCESS', name='processtypeenum'), nullable=False),
sa.Column('status', sa.Enum('CREATED', 'QUEUED', 'RUNNING', 'FINISHED', 'CANCELED', 'FAILED', 'UNKNOWN', name='processingstatusenum'), nullable=False),
sa.Column('user_id', sa.String(length=255), nullable=False),
sa.Column('platform_job_id', sa.String(length=255), nullable=True),
sa.Column('parameters', mysql.LONGTEXT(), nullable=False),
sa.Column('service', mysql.LONGTEXT(), nullable=False),
sa.Column('created', sa.DateTime(), nullable=False),
sa.Column('updated', sa.DateTime(), nullable=False),
sa.Column('upscaling_task_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['upscaling_task_id'], ['upscaling_tasks.id'], ondelete='SET NULL'),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_processing_jobs_created'), 'processing_jobs', ['created'], unique=False)
op.create_index(op.f('ix_processing_jobs_id'), 'processing_jobs', ['id'], unique=False)
op.create_index(op.f('ix_processing_jobs_label'), 'processing_jobs', ['label'], unique=False)
op.create_index(op.f('ix_processing_jobs_platform_job_id'), 'processing_jobs', ['platform_job_id'], unique=False)
op.create_index(op.f('ix_processing_jobs_status'), 'processing_jobs', ['status'], unique=False)
op.create_index(op.f('ix_processing_jobs_title'), 'processing_jobs', ['title'], unique=False)
op.create_index(op.f('ix_processing_jobs_updated'), 'processing_jobs', ['updated'], unique=False)
op.create_index(op.f('ix_processing_jobs_user_id'), 'processing_jobs', ['user_id'], unique=False)
# ### end Alembic commands ###


def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_processing_jobs_user_id'), table_name='processing_jobs')
op.drop_index(op.f('ix_processing_jobs_updated'), table_name='processing_jobs')
op.drop_index(op.f('ix_processing_jobs_title'), table_name='processing_jobs')
op.drop_index(op.f('ix_processing_jobs_status'), table_name='processing_jobs')
op.drop_index(op.f('ix_processing_jobs_platform_job_id'), table_name='processing_jobs')
op.drop_index(op.f('ix_processing_jobs_label'), table_name='processing_jobs')
op.drop_index(op.f('ix_processing_jobs_id'), table_name='processing_jobs')
op.drop_index(op.f('ix_processing_jobs_created'), table_name='processing_jobs')
op.drop_table('processing_jobs')
op.drop_index(op.f('ix_upscaling_tasks_user_id'), table_name='upscaling_tasks')
op.drop_index(op.f('ix_upscaling_tasks_updated'), table_name='upscaling_tasks')
op.drop_index(op.f('ix_upscaling_tasks_title'), table_name='upscaling_tasks')
op.drop_index(op.f('ix_upscaling_tasks_status'), table_name='upscaling_tasks')
op.drop_index(op.f('ix_upscaling_tasks_label'), table_name='upscaling_tasks')
op.drop_index(op.f('ix_upscaling_tasks_id'), table_name='upscaling_tasks')
op.drop_index(op.f('ix_upscaling_tasks_created'), table_name='upscaling_tasks')
op.drop_table('upscaling_tasks')
# ### end Alembic commands ###

This file was deleted.

63 changes: 0 additions & 63 deletions alembic/versions/a0ca6614c7c1_creation_of_processing_jobs.py

This file was deleted.

36 changes: 0 additions & 36 deletions alembic/versions/be54acd4d160_platform_job_id_becomes_optional.py

This file was deleted.

11 changes: 6 additions & 5 deletions app/database/models/processing_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from loguru import logger
from sqlalchemy import DateTime, Enum, ForeignKey, Integer, String
from sqlalchemy.dialects.mysql import LONGTEXT
from sqlalchemy.orm import Mapped, Session, mapped_column

from app.database.db import Base
Expand All @@ -18,15 +19,15 @@ class ProcessingJobRecord(Base):
id: Mapped[int] = mapped_column(
Integer, primary_key=True, index=True, autoincrement=True
)
title: Mapped[str] = mapped_column(String, index=True)
title: Mapped[str] = mapped_column(String(255), index=True)
label: Mapped[ProcessTypeEnum] = mapped_column(Enum(ProcessTypeEnum), index=True)
status: Mapped[ProcessingStatusEnum] = mapped_column(
Enum(ProcessingStatusEnum), index=True
)
user_id: Mapped[str] = mapped_column(String, index=True)
platform_job_id: Mapped[Optional[str]] = mapped_column(String, index=True)
parameters: Mapped[str] = mapped_column(String, index=False)
service: Mapped[str] = mapped_column(String, index=True)
user_id: Mapped[str] = mapped_column(String(255), index=True)
platform_job_id: Mapped[Optional[str]] = mapped_column(String(255), index=True)
parameters: Mapped[str] = mapped_column(LONGTEXT())
service: Mapped[str] = mapped_column(LONGTEXT())
created: Mapped[datetime.datetime] = mapped_column(
DateTime, default=datetime.datetime.utcnow, index=True
)
Expand Down
Loading