Subscriptions belong to a company; BroV owns its Keychain token

- ops: subscriptions get a client (company) column (migrated in place); the brain fills it
  from «компания сага / для планеты»; /subs and «Весь план» group by company with
  per-company monthly totals; the company shows in agenda rows and the calendar.
- BroV: the API token handed over in ops-token.import is saved by BroV itself, so the
  Keychain item belongs to BroV and macOS stops asking for the password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-10 03:42:41 +03:00
parent 36326ba0b6
commit 18aed2beb9
8 changed files with 161 additions and 55 deletions
+6 -1
View File
@@ -30,7 +30,8 @@ CREATE TABLE IF NOT EXISTS subscriptions (
next_date TEXT NOT NULL, -- YYYY-MM-DD of the next charge
remind_days INTEGER NOT NULL DEFAULT 3,
notes TEXT NOT NULL DEFAULT '',
active INTEGER NOT NULL DEFAULT 1
active INTEGER NOT NULL DEFAULT 1,
client TEXT NOT NULL DEFAULT '' -- company it's paid for: saga / planet9 / home / …
);
CREATE TABLE IF NOT EXISTS payments (
id INTEGER PRIMARY KEY,
@@ -71,4 +72,8 @@ def connect(path: str) -> sqlite3.Connection:
con.execute("PRAGMA foreign_keys = ON")
con.execute("PRAGMA journal_mode = WAL")
con.executescript(SCHEMA)
# Databases created before subscriptions had a company.
cols = {r["name"] for r in con.execute("PRAGMA table_info(subscriptions)")}
if "client" not in cols:
con.execute("ALTER TABLE subscriptions ADD COLUMN client TEXT NOT NULL DEFAULT ''")
return con