Skip to content

Commit

Permalink
Also force fix_com and fix_orientation to be true
Browse files Browse the repository at this point in the history
  • Loading branch information
bennybp committed Jan 7, 2024
1 parent d857947 commit bab1263
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""remove explicit fix_ columns in molecule
Revision ID: 49cfda6eb87e
Revises: de44b1b34097
Create Date: 2024-01-06 19:18:04.534992
"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "49cfda6eb87e"
down_revision = "de44b1b34097"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("molecule", "fix_orientation")
op.drop_column("molecule", "fix_com")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("molecule", sa.Column("fix_com", sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column("molecule", sa.Column("fix_orientation", sa.BOOLEAN(), autoincrement=False, nullable=True))
op.execute(sa.text("UPDATE molecule SET fix_com = True, fix_orientation = True"))
op.alter_column("molecule", "fix_com", nullable=False)
op.alter_column("molecule", "fix_orientation", nullable=False)
# ### end Alembic commands ###
6 changes: 4 additions & 2 deletions qcfractal/qcfractal/components/molecules/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ class MoleculeORM(BaseORM):
fragment_multiplicities = Column(JSON) # Column(ARRAY(Integer))

# Orientation & symmetry
fix_com = Column(Boolean, nullable=False, default=True)
fix_orientation = Column(Boolean, nullable=False, default=True)
fix_symmetry = Column(String)

# These are always forced to be true
fix_com = column_property(True)
fix_orientation = column_property(True)

# Molecule is always validated before going in the database
validated = column_property(True)

Expand Down

0 comments on commit bab1263

Please sign in to comment.