Skip to content

Commit

Permalink
fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed May 9, 2024
1 parent 0414400 commit 168cb1e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions backend/migrations/versions/f8db11069084_frame_access.py
Expand Up @@ -24,13 +24,20 @@ def upgrade():

from app.models import Frame
from app import db
frames = Frame.query.all()
for frame in frames:
frame.frame_access_key = secure_token(20)
frame.frame_access = "private"
db.session.add(frame)
db.session.commit()
db.session.flush()

frames = db.session.query(Frame.id).all()
for (frame_id,) in frames:
db.session.execute(
sa.update(Frame).
where(Frame.id == frame_id).
values({
Frame.frame_access_key: secure_token(20),
Frame.frame_access: "private"
})
)

# Commit changes
db.session.commit()
# ### end Alembic commands ###


Expand Down

0 comments on commit 168cb1e

Please sign in to comment.