Initialize sql_write before sql_read so file can be created.

The read only handle doesn't want to create the db file
when it does not yet exist.
This commit is contained in:
voussoir 2022-09-07 18:06:32 -07:00
parent 97e14b9917
commit 57d311569f
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -1587,8 +1587,8 @@ class PhotoDB(
def _init_sql(self, create, skip_version_check):
if self.ephemeral:
existing_database = False
self.sql_read = self._make_sqlite_read_connection(':memory:')
self.sql_write = self._make_sqlite_write_connection(':memory:')
self.sql_read = self._make_sqlite_read_connection(':memory:')
self._first_time_setup()
return
@ -1600,8 +1600,8 @@ class PhotoDB(
raise FileNotFoundError(msg)
self.data_directory.makedirs(exist_ok=True)
self.sql_read = self._make_sqlite_read_connection(self.database_filepath)
self.sql_write = self._make_sqlite_write_connection(self.database_filepath)
self.sql_read = self._make_sqlite_read_connection(self.database_filepath)
if existing_database:
if not skip_version_check: