|
@@ -187,6 +187,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|
f"{allowed_transaction_modes}, or None."
|
|
f"{allowed_transaction_modes}, or None."
|
|
)
|
|
)
|
|
self.transaction_mode = transaction_mode.upper() if transaction_mode else None
|
|
self.transaction_mode = transaction_mode.upper() if transaction_mode else None
|
|
|
|
+
|
|
|
|
+ init_command = kwargs.pop("init_command", "")
|
|
|
|
+ self.init_commands = init_command.split(";")
|
|
return kwargs
|
|
return kwargs
|
|
|
|
|
|
def get_database_version(self):
|
|
def get_database_version(self):
|
|
@@ -201,6 +204,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|
# The macOS bundled SQLite defaults legacy_alter_table ON, which
|
|
# The macOS bundled SQLite defaults legacy_alter_table ON, which
|
|
# prevents atomic table renames.
|
|
# prevents atomic table renames.
|
|
conn.execute("PRAGMA legacy_alter_table = OFF")
|
|
conn.execute("PRAGMA legacy_alter_table = OFF")
|
|
|
|
+ for init_command in self.init_commands:
|
|
|
|
+ if init_command := init_command.strip():
|
|
|
|
+ conn.execute(init_command)
|
|
return conn
|
|
return conn
|
|
|
|
|
|
def create_cursor(self, name=None):
|
|
def create_cursor(self, name=None):
|