This repository was archived by the owner on Jun 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ def run_migrations_offline() -> None:
35
35
target_metadata = target_metadata ,
36
36
literal_binds = True ,
37
37
dialect_opts = {"paramstyle" : "named" },
38
+ transactional_ddl = True ,
38
39
)
39
40
40
41
with context .begin_transaction ():
Original file line number Diff line number Diff line change @@ -45,11 +45,9 @@ def set_sqlite_pragma(dbapi_connection, connection_record):
45
45
[SQLite docs](https://www.sqlite.org/foreignkeys.html)
46
46
[SO](https://stackoverflow.com/questions/2614984/sqlite-sqlalchemy-how-to-enforce-foreign-keys)
47
47
"""
48
- # Only enable foreign keys if the connection record has the flag set to True
49
- if connection_record .info .get ("enable_fks" , False ):
50
- cursor = dbapi_connection .cursor ()
51
- cursor .execute ("PRAGMA foreign_keys=ON" )
52
- cursor .close ()
48
+ cursor = dbapi_connection .cursor ()
49
+ cursor .execute ("PRAGMA foreign_keys=ON" )
50
+ cursor .close ()
53
51
54
52
55
53
class DbCodeGate :
@@ -80,7 +78,6 @@ def __init__(self, sqlite_path: Optional[str] = None):
80
78
"isolation_level" : "AUTOCOMMIT" , # Required for SQLite
81
79
}
82
80
self ._async_db_engine = create_async_engine (** engine_dict )
83
- self ._async_db_engine .connect ().connection .connection_record .info ["enable_fks" ] = True
84
81
85
82
def does_db_exist (self ):
86
83
return self ._db_path .is_file ()
You can’t perform that action at this time.
0 commit comments