go-bananas/internal/store/migrations/0002_drop_api_keys.sql

19 lines
1,009 B
MySQL
Raw Normal View History

2026-10-07 15:11:35 +02:00
-- Drop the machine-credential table.
--
-- API keys were removed: the runtime API is public by design and the admin API is
-- for people, so there is no machine caller left to authenticate. The table is
-- dropped rather than left behind, because an unused table holding SHA-256 digests
-- of credentials that no longer authenticate anything is a liability with no
-- upside, and its presence in the schema implies a capability that no longer exists.
--
-- The rows go with it. That is destructive by definition, which is why this is a
-- migration rather than a code change: it happens once, in order, and is recorded in
-- schema_migrations so a restore from an older backup is visible rather than silent.
--
-- A backup taken before this migration still contains the table and its rows. The
-- credentials in it do not work against any version of this service, so restoring
-- one is harmless.
DROP INDEX IF EXISTS idx_api_keys_hash;
DROP INDEX IF EXISTS idx_api_keys_live;
DROP TABLE IF EXISTS api_keys;