Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""add gc_neighbor and is_dense_region columns

Revision ID: a251bdccb11f
Revises: 385b6cdf44f7
Create Date: 2026-01-29 17:28:38.712851

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a251bdccb11f'
down_revision = '385b6cdf44f7'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('fluxstd', sa.Column('is_gc_neighbor', sa.Boolean(), nullable=True, comment='Flag for globular cluster neighbor'))
op.add_column('fluxstd', sa.Column('is_dense_region', sa.Boolean(), nullable=True, comment='Flag for dense stellar region'))
op.alter_column('fluxstd', 'obj_id',
existing_type=sa.BIGINT(),
comment='source_id (e.g., Gaia EDR3, DR3, etc.)',
existing_comment='Gaia EDR3 sourceid',
existing_nullable=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('fluxstd', 'obj_id',
existing_type=sa.BIGINT(),
comment='Gaia EDR3 sourceid',
existing_comment='source_id (e.g., Gaia EDR3, DR3, etc.)',
existing_nullable=False)
op.drop_column('fluxstd', 'is_dense_region')
op.drop_column('fluxstd', 'is_gc_neighbor')
# ### end Alembic commands ###
Binary file added diagrams/erdiagram_targetdb-20260129174351.pdf
Binary file not shown.
18 changes: 16 additions & 2 deletions src/targetdb/models/fluxstd.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class fluxstd(Base):
obj_id = Column(
BigInteger,
nullable=False,
comment="Gaia EDR3 sourceid",
) # xxxx: need to understand more
comment="source_id (e.g., Gaia EDR3, DR3, etc.)",
)

ra = Column(Float, nullable=False, comment="RA (ICRS, degree)")
dec = Column(Float, nullable=False, comment="Dec (ICRS, degree)")
Expand Down Expand Up @@ -209,6 +209,16 @@ class fluxstd(Base):
default=False,
comment="Flag for F-star from Gaia (Teff=6000-7500K if True)",
)
is_gc_neighbor = Column(
Boolean,
default=False,
comment="Flag for globular cluster neighbor",
)
is_dense_region = Column(
Boolean,
default=False,
comment="Flag for dense stellar region",
)

# version string
version = Column(
Expand Down Expand Up @@ -302,6 +312,8 @@ def __init__(
teff_gspphot_lower,
teff_gspphot_upper,
is_fstar_gaia,
is_gc_neighbor,
is_dense_region,
version,
created_at,
updated_at,
Expand Down Expand Up @@ -364,5 +376,7 @@ def __init__(
self.teff_gspphot_lower = teff_gspphot_lower
self.teff_gspphot_upper = teff_gspphot_upper
self.is_fstar_gaia = is_fstar_gaia
self.is_gc_neighbor = is_gc_neighbor
self.is_dense_region = is_dense_region
self.created_at = created_at
self.updated_at = updated_at
Loading