§
    øžyjn  ã                  óP   — d Z ddlmZ ddlZddlZdd„Zej        dd„¦   «         ZdS )u  Shared SQLite primitives for the small per-profile / board stores.

The projects and kanban stores open WAL SQLite files with the same two
primitives â€” an idempotent column-add migration and an IMMEDIATE write
transaction. One definition here keeps the two stores from drifting.
é    )ÚannotationsNÚconnúsqlite3.ConnectionÚtableÚstrÚcolumnÚddlÚreturnÚboolc                óÀ   — 	 |                       d|› d|› �¦  «         dS # t          j        $ r/}dt          |¦  «                             ¦   «         v rY d}~dS ‚ d}~ww xY w)aP  ``ALTER TABLE <table> ADD COLUMN <ddl>``, idempotent across races.

    Returns ``True`` when this call added the column. Swallows the
    ``duplicate column name`` error a concurrent migrator may have run first
    (issue #21708). ``column`` is the human-readable name for the call site;
    ``ddl`` carries the actual definition.
    zALTER TABLE z ADD COLUMN Tzduplicate column nameNF)ÚexecuteÚsqlite3ÚOperationalErrorr   Úlower)r   r   r   r	   Úexcs        ú</home/ragecks/.hermes/hermes-agent/hermes_cli/sqlite_util.pyÚadd_column_if_missingr      s|   € ðØ�ŠÐ< EÐ<Ð<°sÐ<Ð<Ñ=Ô=Ð=ØˆtøÝÔ#ð ð ð Ø"¥c¨#¡h¤h§n¢nÑ&6Ô&6Ð6Ð6Ø�5�5�5�5�5Øøøøøðøøøs   ‚ ŸA®#AÁAÁAc              #  óÞ   K  — |                       d¦  «         	 | V — |                       d¦  «         dS # t          $ r. 	 |                       d¦  «         n# t          j        $ r Y nw xY w‚ w xY w)a  An IMMEDIATE write transaction: at most one concurrent writer wins.

    The explicit ROLLBACK is guarded so a SQLite auto-rollback (no active
    transaction left under EIO / lock contention / corruption) cannot shadow
    the original exception with a spurious rollback error.
    zBEGIN IMMEDIATEÚCOMMITÚROLLBACKN)r   Ú	Exceptionr   r   )r   s    r   Ú	write_txnr      s    è è € ð 	‡L‚LÐ"Ñ#Ô#Ð#ð	Øˆ
ˆ
ˆ
ð 	�Š�XÑÔÐÐÐøõ ð ð ð ð	Ø�LŠL˜Ñ$Ô$Ð$Ð$øÝÔ'ð 	ð 	ð 	ØˆDð	øøøàðøøøs,   ™4 ´
A,¿AÁA,ÁA'Á$A,Á&A'Á'A,)
r   r   r   r   r   r   r	   r   r
   r   )r   r   )Ú__doc__Ú
__future__r   Ú
contextlibr   r   Úcontextmanagerr   © ó    r   ú<module>r      sz   ððð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø €€€ðð ð ð ð" Ôðð ð ñ Ôðð ð r   