diff --git a/backend/app/models/log_records.py b/backend/app/models/log_records.py index e0a1e470..0ad73bb3 100644 --- a/backend/app/models/log_records.py +++ b/backend/app/models/log_records.py @@ -9,7 +9,6 @@ class LogRecords(db.Model): employee_id = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=False) datetime = db.Column(db.DateTime(timezone=True), nullable=False) flagged = db.Column(db.Boolean, nullable=False) - attn_to = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=True) note = db.Column(db.String, nullable=False) building_id = db.Column(db.Integer, db.ForeignKey("buildings.id"), nullable=False) tags = db.relationship( diff --git a/backend/migrations/versions/5a9f9b3bdc20_remove_attn_to_column_from_log_records_.py b/backend/migrations/versions/5a9f9b3bdc20_remove_attn_to_column_from_log_records_.py new file mode 100644 index 00000000..be429b61 --- /dev/null +++ b/backend/migrations/versions/5a9f9b3bdc20_remove_attn_to_column_from_log_records_.py @@ -0,0 +1,38 @@ +"""remove attn_to column from log records table + +Revision ID: 5a9f9b3bdc20 +Revises: 51ad56d133e9 +Create Date: 2024-04-21 04:15:23.112342 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "5a9f9b3bdc20" +down_revision = "51ad56d133e9" +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table("log_records", schema=None) as batch_op: + batch_op.drop_constraint("log_records_attn_to_fkey", type_="foreignkey") + batch_op.drop_column("attn_to") + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table("log_records", schema=None) as batch_op: + batch_op.add_column( + sa.Column("attn_to", sa.INTEGER(), autoincrement=False, nullable=True) + ) + batch_op.create_foreign_key( + "log_records_attn_to_fkey", "users", ["attn_to"], ["id"] + ) + + # ### end Alembic commands ###