@@ -10,15 +10,15 @@ def __call__(self, cursor: sqlite3.Cursor) -> None:
10
10
def _make_workflow_opened_at_nullable (self , cursor : sqlite3 .Cursor ) -> None :
11
11
"""
12
12
Make the `opened_at` column nullable in the `workflow_library` table. This is accomplished by:
13
- - Renaming the existing column to `opened_at_deprecated`
14
- - Drop the existing `idx_workflow_library_opened_at` index
13
+ - Dropping the existing `idx_workflow_library_opened_at` index (must be done before dropping the column)
14
+ - Dropping the existing `opened_at` column
15
15
- Adding a new nullable column `opened_at` (no data migration needed, all values will be NULL)
16
- - Recreate the `idx_workflow_library_opened_at` index on the `opened_at` column
16
+ - Adding a new `idx_workflow_library_opened_at` index on the `opened_at` column
17
17
"""
18
- # Rename existing column to deprecated
19
- cursor .execute ("ALTER TABLE workflow_library RENAME COLUMN opened_at TO opened_at_deprecated;" )
20
18
# For index renaming in SQLite, we need to drop and recreate
21
19
cursor .execute ("DROP INDEX IF EXISTS idx_workflow_library_opened_at;" )
20
+ # Rename existing column to deprecated
21
+ cursor .execute ("ALTER TABLE workflow_library DROP COLUMN opened_at;" )
22
22
# Add new nullable column - all values will be NULL - no migration of data needed
23
23
cursor .execute ("ALTER TABLE workflow_library ADD COLUMN opened_at DATETIME;" )
24
24
# Create new index on the new column
@@ -33,10 +33,10 @@ def build_migration_18() -> Migration:
33
33
34
34
This migration does the following:
35
35
- Make the `opened_at` column nullable in the `workflow_library` table. This is accomplished by:
36
- - Renaming the existing column to `opened_at_deprecated`
37
- - Drop the existing `idx_workflow_library_opened_at` index
36
+ - Dropping the existing `idx_workflow_library_opened_at` index (must be done before dropping the column)
37
+ - Dropping the existing `opened_at` column
38
38
- Adding a new nullable column `opened_at` (no data migration needed, all values will be NULL)
39
- - Recreate the `idx_workflow_library_opened_at` index on the `opened_at` column
39
+ - Adding a new `idx_workflow_library_opened_at` index on the `opened_at` column
40
40
"""
41
41
migration_18 = Migration (
42
42
from_version = 17 ,
0 commit comments