1616
1717def upgrade ():
1818 """Add performance indexes for frequently queried columns."""
19- # Jobs table indexes
20- op .create_index (op .f ('ix_jobs_api_key' ), 'jobs' , ['api_key' ])
21- op .create_index (op .f ('ix_jobs_status' ), 'jobs' , ['status' ])
19+ # Jobs table indexes (ix_jobs_api_key and ix_jobs_status already exist from 001)
2220 op .create_index (op .f ('ix_jobs_created_at' ), 'jobs' , ['created_at' ])
2321 op .create_index (op .f ('ix_jobs_status_api_key' ), 'jobs' , ['status' , 'api_key' ])
2422 op .create_index (op .f ('ix_jobs_api_key_created_at' ), 'jobs' , ['api_key' , 'created_at' ])
25-
26- # API keys table indexes
27- op .create_index (op .f ('ix_api_keys_key_hash' ), 'api_keys' , ['key_hash' ])
28- op .create_index (op .f ('ix_api_keys_is_active' ), 'api_keys' , ['is_active' ])
29- op .create_index (op .f ('ix_api_keys_expires_at' ), 'api_keys' , ['expires_at' ])
23+ # API keys indexes already created in migration 002
3024
3125def downgrade ():
3226 """Remove performance indexes."""
33- # Jobs table indexes
27+ # Jobs table indexes (only drop ones added by this migration)
3428 op .drop_index (op .f ('ix_jobs_api_key_created_at' ), table_name = 'jobs' )
3529 op .drop_index (op .f ('ix_jobs_status_api_key' ), table_name = 'jobs' )
3630 op .drop_index (op .f ('ix_jobs_created_at' ), table_name = 'jobs' )
37- op .drop_index (op .f ('ix_jobs_status' ), table_name = 'jobs' )
38- op .drop_index (op .f ('ix_jobs_api_key' ), table_name = 'jobs' )
39-
40- # API keys table indexes
41- op .drop_index (op .f ('ix_api_keys_expires_at' ), table_name = 'api_keys' )
42- op .drop_index (op .f ('ix_api_keys_is_active' ), table_name = 'api_keys' )
43- op .drop_index (op .f ('ix_api_keys_key_hash' ), table_name = 'api_keys' )
31+ # API keys indexes managed by migration 002
0 commit comments