core: name the unique index on wallet_seeds

The one key per device rule is meant to be lifted later. SQLite cannot drop
a column with an inline UNIQUE, or its automatic index, so lifting it would
have meant rebuilding the table. As a named index it is a DROP INDEX and a
DROP COLUMN.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rvc3HbiWBTqbAvRT45G5oX
This commit is contained in:
Alain BrenzikoferandClaude Opus 5 committed 2026-09-10 09:53:26 +00:00
1 parent fe9c20370f
commit e7f5908d01
5 files changed
+12 -10

No files matched your search

@@ -15,12 +15,13 @@ CREATE TABLE wallet_seeds (
-- see the SQLite migration
next_account_index BIGINT NOT NULL DEFAULT 0,
-- one key per device for now
single_seed SMALLINT NOT NULL DEFAULT 1 UNIQUE
single_seed SMALLINT NOT NULL DEFAULT 1
);
ALTER TABLE users ADD COLUMN wallet_seed_id BIGINT REFERENCES wallet_seeds ON DELETE RESTRICT;
ALTER TABLE users ADD COLUMN wallet_account_index BIGINT;
CREATE UNIQUE INDEX idx_wallet_seeds_single_seed ON wallet_seeds(single_seed);
CREATE INDEX idx_users_wallet_seed_id ON users(wallet_seed_id);
|]
@@ -1918,11 +1918,6 @@ ALTER TABLE ONLY test_chat_schema.wallet_seeds
ALTER TABLE ONLY test_chat_schema.wallet_seeds
ADD CONSTRAINT wallet_seeds_single_seed_key UNIQUE (single_seed);
ALTER TABLE ONLY test_chat_schema.xftp_file_descriptions
ADD CONSTRAINT xftp_file_descriptions_pkey PRIMARY KEY (file_descr_id);
@@ -2676,6 +2671,10 @@ CREATE INDEX idx_users_wallet_seed_id ON test_chat_schema.users USING btree (wal
CREATE UNIQUE INDEX idx_wallet_seeds_single_seed ON test_chat_schema.wallet_seeds USING btree (single_seed);
CREATE INDEX idx_xftp_file_descriptions_user_id ON test_chat_schema.xftp_file_descriptions USING btree (user_id);