|
| 1 | +"""add required_services_runtime to plugin |
| 2 | +
|
| 3 | +Revision ID: 5d073fe444c9 |
| 4 | +Revises: 219da9748f46 |
| 5 | +Create Date: 2025-08-25 21:27:45.545834 |
| 6 | +
|
| 7 | +""" |
| 8 | +from typing import Sequence, Union |
| 9 | + |
| 10 | +from alembic import op |
| 11 | +import sqlalchemy as sa |
| 12 | + |
| 13 | + |
| 14 | +# revision identifiers, used by Alembic. |
| 15 | +revision: str = '5d073fe444c9' |
| 16 | +down_revision: Union[str, None] = '219da9748f46' |
| 17 | +branch_labels: Union[str, Sequence[str], None] = None |
| 18 | +depends_on: Union[str, Sequence[str], None] = None |
| 19 | + |
| 20 | + |
| 21 | +def upgrade() -> None: |
| 22 | + # ### commands auto generated by Alembic - please adjust! ### |
| 23 | + op.create_table('plugin_service_runtime', |
| 24 | + sa.Column('id', sa.String(), nullable=False), |
| 25 | + sa.Column('plugin_id', sa.String(), nullable=False), |
| 26 | + sa.Column('plugin_slug', sa.String(), nullable=False), |
| 27 | + sa.Column('name', sa.String(), nullable=False), |
| 28 | + sa.Column('source_url', sa.String(), nullable=True), |
| 29 | + sa.Column('type', sa.String(), nullable=True), |
| 30 | + sa.Column('install_command', sa.Text(), nullable=True), |
| 31 | + sa.Column('start_command', sa.Text(), nullable=True), |
| 32 | + sa.Column('healthcheck_url', sa.String(), nullable=True), |
| 33 | + sa.Column('required_env_vars', sa.Text(), nullable=True), |
| 34 | + sa.Column('status', sa.String(), nullable=True), |
| 35 | + sa.Column('created_at', sa.DateTime(), nullable=True), |
| 36 | + sa.Column('updated_at', sa.DateTime(), nullable=True), |
| 37 | + sa.Column('user_id', sa.String(length=32), nullable=False), |
| 38 | + sa.ForeignKeyConstraint(['plugin_id'], ['plugin.id'], ), |
| 39 | + sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='fk_plugin_service_runtime_user_id'), |
| 40 | + sa.PrimaryKeyConstraint('id') |
| 41 | + ) |
| 42 | + with op.batch_alter_table('plugin_service_runtime', schema=None) as batch_op: |
| 43 | + batch_op.create_index(batch_op.f('ix_plugin_service_runtime_id'), ['id'], unique=False) |
| 44 | + batch_op.create_index(batch_op.f('ix_plugin_service_runtime_plugin_id'), ['plugin_id'], unique=False) |
| 45 | + batch_op.create_index(batch_op.f('ix_plugin_service_runtime_plugin_slug'), ['plugin_slug'], unique=False) |
| 46 | + |
| 47 | + with op.batch_alter_table('plugin', schema=None) as batch_op: |
| 48 | + batch_op.add_column(sa.Column('required_services_runtime', sa.Text(), nullable=True)) |
| 49 | + |
| 50 | + # ### end Alembic commands ### |
| 51 | + |
| 52 | + |
| 53 | +def downgrade() -> None: |
| 54 | + # ### commands auto generated by Alembic - please adjust! ### |
| 55 | + with op.batch_alter_table('plugin', schema=None) as batch_op: |
| 56 | + batch_op.drop_column('required_services_runtime') |
| 57 | + |
| 58 | + with op.batch_alter_table('plugin_service_runtime', schema=None) as batch_op: |
| 59 | + batch_op.drop_index(batch_op.f('ix_plugin_service_runtime_plugin_slug')) |
| 60 | + batch_op.drop_index(batch_op.f('ix_plugin_service_runtime_plugin_id')) |
| 61 | + batch_op.drop_index(batch_op.f('ix_plugin_service_runtime_id')) |
| 62 | + |
| 63 | + op.drop_table('plugin_service_runtime') |
| 64 | + # ### end Alembic commands ### |
0 commit comments