Skip to content

Commit 3cdd610

Browse files
author
Sophie Strausberg
committed
update migration file
1 parent c6eccaa commit 3cdd610

3 files changed

Lines changed: 44 additions & 48 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""add token_blacklist table
2+
3+
Revision ID: 7245f58bb00a
4+
Revises: 0fde4435424e
5+
Create Date: 2025-03-12 17:46:57.085233
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '7245f58bb00a'
14+
down_revision = '0fde4435424e'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# Create the token_blacklist table
21+
op.execute("""
22+
DO $$
23+
BEGIN
24+
IF NOT EXISTS (
25+
SELECT 1
26+
FROM information_schema.tables
27+
WHERE table_name = 'token_blacklist'
28+
) THEN
29+
CREATE TABLE token_blacklist (
30+
id SERIAL PRIMARY KEY,
31+
jti VARCHAR(36) NOT NULL,
32+
expires_at TIMESTAMP NOT NULL
33+
);
34+
CREATE INDEX ix_token_blacklist_jti ON token_blacklist(jti);
35+
END IF;
36+
END $$;
37+
""")
38+
# Create an index on the jti column for faster lookups
39+
40+
41+
def downgrade():
42+
# Drop the index and then the table
43+
op.execute("DROP TABLE IF EXISTS token_blacklist;")

migrations/versions/f02ca08b34d7_add_token_blacklist_table.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

schema.graphql

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,10 @@ type Mutation {
177177
createUser(email: String!, name: String!, netId: String!): User
178178
enterGiveaway(giveawayId: Int!, userNetId: String!): GiveawayInstance
179179
setWorkoutGoals(userId: Int!, workoutGoal: [String]!): User
180-
<<<<<<< HEAD
181-
logWorkout(userId: Int!, workoutTime: DateTime!): Workout
180+
logWorkout(facilityId: Int!, userId: Int!, workoutTime: DateTime!): Workout
182181
loginUser(netId: String!): LoginUser
183182
logoutUser: LogoutUser
184183
refreshAccessToken: RefreshAccessToken
185-
=======
186-
logWorkout(facilityId: Int!, userId: Int!, workoutTime: DateTime!): Workout
187-
>>>>>>> f9a58592618c0a8743aeeaadf2753e083905cb66
188184
createReport(createdAt: DateTime!, description: String!, gymId: Int!, issue: String!): CreateReport
189185
deleteUser(userId: Int!): User
190186
}

0 commit comments

Comments
 (0)