feat(db): update image-board relationships on add

Functionally, `add_image_to_board()` now moves images between boards.
This commit is contained in:
psychedelicious 2023-06-20 22:49:14 +10:00
parent daadf6ebfd
commit 8bce234542

View File

@ -139,9 +139,10 @@ class SqliteBoardImageRecordStorage(BoardImageRecordStorageBase):
self._cursor.execute( self._cursor.execute(
"""--sql """--sql
INSERT INTO board_images (board_id, image_name) INSERT INTO board_images (board_id, image_name)
VALUES (?, ?); VALUES (?, ?)
ON CONFLICT (image_name) DO UPDATE SET board_id = ?;
""", """,
(board_id, image_name), (board_id, image_name, board_id),
) )
self._conn.commit() self._conn.commit()
except sqlite3.Error as e: except sqlite3.Error as e: