update
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""add detail to asset state nodes
|
||||
|
||||
Revision ID: 0f1b9bb2156c
|
||||
Revises: f4f0c9c9426e
|
||||
Create Date: 2026-04-25 23:15:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0f1b9bb2156c'
|
||||
down_revision = 'f4f0c9c9426e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('asset_state_nodes', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('detail', sa.Text(), nullable=True))
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('asset_state_nodes', schema=None) as batch_op:
|
||||
batch_op.drop_column('detail')
|
||||
@@ -0,0 +1,71 @@
|
||||
"""add asset log tables
|
||||
|
||||
Revision ID: 6c2a57f2b1e9
|
||||
Revises: 83be4d38636d
|
||||
Create Date: 2026-04-24 09:40:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6c2a57f2b1e9'
|
||||
down_revision = '83be4d38636d'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'assets',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('name', sa.String(length=255), nullable=False),
|
||||
sa.Column('asset_type', sa.String(length=120), nullable=False),
|
||||
sa.Column('program', sa.String(length=255), nullable=True),
|
||||
sa.Column('home_region', sa.String(length=120), nullable=True),
|
||||
sa.Column('note', sa.Text(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name'),
|
||||
)
|
||||
with op.batch_alter_table('assets', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_assets_asset_type'), ['asset_type'], unique=False)
|
||||
batch_op.create_index(batch_op.f('ix_assets_name'), ['name'], unique=False)
|
||||
|
||||
op.create_table(
|
||||
'asset_log_entries',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('asset_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('entry_kind', sa.String(length=16), nullable=False),
|
||||
sa.Column('title', sa.String(length=255), nullable=False),
|
||||
sa.Column('state_label', sa.String(length=120), nullable=True),
|
||||
sa.Column('mission_label', sa.String(length=255), nullable=True),
|
||||
sa.Column('location', sa.String(length=255), nullable=True),
|
||||
sa.Column('start_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('end_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column('summary', sa.Text(), nullable=True),
|
||||
sa.Column('note', sa.Text(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['asset_id'], ['assets.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
)
|
||||
with op.batch_alter_table('asset_log_entries', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_asset_log_entries_asset_id'), ['asset_id'], unique=False)
|
||||
batch_op.create_index(batch_op.f('ix_asset_log_entries_start_at'), ['start_at'], unique=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('asset_log_entries', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_asset_log_entries_start_at'))
|
||||
batch_op.drop_index(batch_op.f('ix_asset_log_entries_asset_id'))
|
||||
|
||||
op.drop_table('asset_log_entries')
|
||||
|
||||
with op.batch_alter_table('assets', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_assets_name'))
|
||||
batch_op.drop_index(batch_op.f('ix_assets_asset_type'))
|
||||
|
||||
op.drop_table('assets')
|
||||
@@ -0,0 +1,46 @@
|
||||
"""expand communication range precision
|
||||
|
||||
Revision ID: 83be4d38636d
|
||||
Revises: f1fa035d3afe
|
||||
Create Date: 2026-04-23 14:39:48.339810
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '83be4d38636d'
|
||||
down_revision = 'f1fa035d3afe'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('communication_parts', schema=None) as batch_op:
|
||||
batch_op.alter_column('range_raw',
|
||||
existing_type=sa.NUMERIC(precision=18, scale=3),
|
||||
type_=sa.Numeric(precision=24, scale=3),
|
||||
existing_nullable=True)
|
||||
batch_op.alter_column('range_km',
|
||||
existing_type=sa.NUMERIC(precision=18, scale=3),
|
||||
type_=sa.Numeric(precision=24, scale=3),
|
||||
existing_nullable=True)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('communication_parts', schema=None) as batch_op:
|
||||
batch_op.alter_column('range_km',
|
||||
existing_type=sa.Numeric(precision=24, scale=3),
|
||||
type_=sa.NUMERIC(precision=18, scale=3),
|
||||
existing_nullable=True)
|
||||
batch_op.alter_column('range_raw',
|
||||
existing_type=sa.Numeric(precision=24, scale=3),
|
||||
type_=sa.NUMERIC(precision=18, scale=3),
|
||||
existing_nullable=True)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,29 @@
|
||||
"""add retired flag to assets
|
||||
|
||||
Revision ID: 8bbf69ea2013
|
||||
Revises: 0f1b9bb2156c
|
||||
Create Date: 2026-04-26 01:25:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8bbf69ea2013'
|
||||
down_revision = '0f1b9bb2156c'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('assets', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('is_retired', sa.Boolean(), nullable=False, server_default=sa.false()))
|
||||
|
||||
with op.batch_alter_table('assets', schema=None) as batch_op:
|
||||
batch_op.alter_column('is_retired', server_default=None)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('assets', schema=None) as batch_op:
|
||||
batch_op.drop_column('is_retired')
|
||||
@@ -0,0 +1,154 @@
|
||||
"""initial schema
|
||||
|
||||
Revision ID: f1fa035d3afe
|
||||
Revises:
|
||||
Create Date: 2026-04-23 14:38:17.484705
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'f1fa035d3afe'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('communication_parts',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('part_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('display_name', sa.String(length=255), nullable=True),
|
||||
sa.Column('mass_t', sa.Numeric(precision=10, scale=4), nullable=True),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=True),
|
||||
sa.Column('is_deployable', sa.Boolean(), nullable=True),
|
||||
sa.Column('antenna_type', sa.String(length=120), nullable=True),
|
||||
sa.Column('deployed_diameter_m', sa.Numeric(precision=10, scale=3), nullable=True),
|
||||
sa.Column('range_raw', sa.Numeric(precision=18, scale=3), nullable=True),
|
||||
sa.Column('range_km', sa.Numeric(precision=18, scale=3), nullable=True),
|
||||
sa.Column('range_au', sa.Numeric(precision=18, scale=6), nullable=True),
|
||||
sa.Column('range_light_year', sa.Numeric(precision=18, scale=6), nullable=True),
|
||||
sa.Column('angle_deg', sa.Numeric(precision=10, scale=3), nullable=True),
|
||||
sa.Column('speed', sa.Numeric(precision=10, scale=3), nullable=True),
|
||||
sa.Column('idle_power_watt', sa.Numeric(precision=12, scale=4), nullable=True),
|
||||
sa.Column('idle_power_text', sa.String(length=64), nullable=True),
|
||||
sa.Column('transmitting_power_watt', sa.Numeric(precision=12, scale=4), nullable=True),
|
||||
sa.Column('transmitting_power_text', sa.String(length=64), nullable=True),
|
||||
sa.Column('source', sa.String(length=120), nullable=True),
|
||||
sa.Column('entry_cost', sa.Integer(), nullable=True),
|
||||
sa.Column('cost', sa.Integer(), nullable=True),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('rescale_factor', sa.Numeric(precision=8, scale=3), nullable=True),
|
||||
sa.Column('tweakscale', sa.String(length=64), nullable=True),
|
||||
sa.Column('is_feeder', sa.Boolean(), nullable=True),
|
||||
sa.Column('tech_required', sa.String(length=120), nullable=True),
|
||||
sa.Column('note', sa.Text(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
with op.batch_alter_table('communication_parts', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_communication_parts_part_name'), ['part_name'], unique=False)
|
||||
|
||||
op.create_table('engine_families',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('engine_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('part_name', sa.String(length=255), nullable=True),
|
||||
sa.Column('cycle', sa.String(length=120), nullable=True),
|
||||
sa.Column('size_m', sa.Numeric(precision=8, scale=3), nullable=True),
|
||||
sa.Column('entry_cost', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('engine_name')
|
||||
)
|
||||
op.create_table('tank_specs',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('tank_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('fuel_type', sa.String(length=120), nullable=True),
|
||||
sa.Column('dry_mass_t', sa.Numeric(precision=10, scale=4), nullable=True),
|
||||
sa.Column('fuel_mass_t', sa.Numeric(precision=10, scale=4), nullable=True),
|
||||
sa.Column('wet_mass_t', sa.Numeric(precision=10, scale=4), nullable=True),
|
||||
sa.Column('tank_volume_l', sa.Numeric(precision=12, scale=3), nullable=True),
|
||||
sa.Column('mass_ratio', sa.Numeric(precision=12, scale=4), nullable=True),
|
||||
sa.Column('kiloliters_per_ton', sa.Numeric(precision=12, scale=4), nullable=True),
|
||||
sa.Column('vehicle_name', sa.String(length=120), nullable=True),
|
||||
sa.Column('source', sa.String(length=120), nullable=True),
|
||||
sa.Column('note', sa.Text(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
with op.batch_alter_table('tank_specs', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_tank_specs_tank_name'), ['tank_name'], unique=False)
|
||||
|
||||
op.create_table('vehicle_costs',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('vehicle_name', sa.String(length=255), nullable=False),
|
||||
sa.Column('launch_price', sa.Integer(), nullable=True),
|
||||
sa.Column('source', sa.String(length=120), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
with op.batch_alter_table('vehicle_costs', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_vehicle_costs_vehicle_name'), ['vehicle_name'], unique=False)
|
||||
|
||||
op.create_table('engine_variants',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('family_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('fuel_type', sa.String(length=120), nullable=False),
|
||||
sa.Column('work_env', sa.String(length=32), nullable=True),
|
||||
sa.Column('sl_isp', sa.Numeric(precision=10, scale=3), nullable=True),
|
||||
sa.Column('vac_isp', sa.Numeric(precision=10, scale=3), nullable=True),
|
||||
sa.Column('min_thrust_kn', sa.Numeric(precision=12, scale=3), nullable=True),
|
||||
sa.Column('max_thrust_kn', sa.Numeric(precision=12, scale=3), nullable=True),
|
||||
sa.Column('mass_t', sa.Numeric(precision=10, scale=4), nullable=True),
|
||||
sa.Column('twr', sa.Numeric(precision=12, scale=4), nullable=True),
|
||||
sa.Column('throttle_ratio', sa.Numeric(precision=8, scale=4), nullable=True),
|
||||
sa.Column('tvc_deg', sa.Numeric(precision=8, scale=3), nullable=True),
|
||||
sa.Column('price_kd', sa.Integer(), nullable=True),
|
||||
sa.Column('ignitions', sa.Integer(), nullable=True),
|
||||
sa.Column('has_unlimited_ignitions', sa.Boolean(), nullable=False),
|
||||
sa.Column('mod_source', sa.String(length=120), nullable=True),
|
||||
sa.Column('engine_note', sa.Text(), nullable=True),
|
||||
sa.Column('config_name', sa.String(length=255), nullable=True),
|
||||
sa.Column('tech_required', sa.String(length=120), nullable=True),
|
||||
sa.Column('config_note', sa.Text(), nullable=True),
|
||||
sa.Column('source_sheet_row', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['family_id'], ['engine_families.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
with op.batch_alter_table('engine_variants', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_engine_variants_config_name'), ['config_name'], unique=False)
|
||||
batch_op.create_index(batch_op.f('ix_engine_variants_family_id'), ['family_id'], unique=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('engine_variants', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_engine_variants_family_id'))
|
||||
batch_op.drop_index(batch_op.f('ix_engine_variants_config_name'))
|
||||
|
||||
op.drop_table('engine_variants')
|
||||
with op.batch_alter_table('vehicle_costs', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_vehicle_costs_vehicle_name'))
|
||||
|
||||
op.drop_table('vehicle_costs')
|
||||
with op.batch_alter_table('tank_specs', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_tank_specs_tank_name'))
|
||||
|
||||
op.drop_table('tank_specs')
|
||||
op.drop_table('engine_families')
|
||||
with op.batch_alter_table('communication_parts', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_communication_parts_part_name'))
|
||||
|
||||
op.drop_table('communication_parts')
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,41 @@
|
||||
"""add asset state nodes
|
||||
|
||||
Revision ID: f4f0c9c9426e
|
||||
Revises: 6c2a57f2b1e9
|
||||
Create Date: 2026-04-25 21:20:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'f4f0c9c9426e'
|
||||
down_revision = '6c2a57f2b1e9'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'asset_state_nodes',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('entry_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('title', sa.String(length=255), nullable=False),
|
||||
sa.Column('at_time', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.ForeignKeyConstraint(['entry_id'], ['asset_log_entries.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
)
|
||||
with op.batch_alter_table('asset_state_nodes', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_asset_state_nodes_entry_id'), ['entry_id'], unique=False)
|
||||
batch_op.create_index(batch_op.f('ix_asset_state_nodes_at_time'), ['at_time'], unique=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('asset_state_nodes', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_asset_state_nodes_at_time'))
|
||||
batch_op.drop_index(batch_op.f('ix_asset_state_nodes_entry_id'))
|
||||
|
||||
op.drop_table('asset_state_nodes')
|
||||
Reference in New Issue
Block a user