Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omnet/blob/main/integration/headscale/downgrade.sql # omnet aien-dev/omnet Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omnet / integration / headscale / downgrade.sql` 22 lines ยท 1204 bytes Raw Blame History 1 -- SPDX-License-Identifier: Apache-2.0 2 -- Rollback only: return a Headscale v0.29.6 database that the omnet adapter has 3 -- used to the exact schema stock Headscale v0.29.6 validates at startup. 4 -- Removes what migration `202610251600`-omnet-tka-registration added and nothing 5 -- else. Run only with Headscale and tkad stopped, on a database whose lock is 6 -- already disabled, after a copy of the file (plus -wal/-shm) has been saved. 7 -- sqlite3 -bail /var/lib/headscale/db.sqlite < downgrade.sql 8 -- Needs sqlite3 3.35 or newer (ALTER TABLE ... DROP COLUMN). ".bail on" below 9 -- stops at the first failing statement even without -bail, so an old sqlite3 10 -- leaves the transaction uncommitted and the file unchanged. 11 -- Rehearsed by integration/e2e/run.sh --scenario runbook (receipt 12 -- rollback-to-stock-headscale-on-current-database-reconnects-everyone) with this 13 -- exact command, after a run that must fail on a deliberately broken copy. 14 .bail on 15 PRAGMA foreign_keys = OFF; 16 BEGIN; 17 ALTER TABLE nodes DROP COLUMN tka_signature; 18 ALTER TABLE nodes DROP COLUMN tka_key; 19 DROP TABLE omnet_checkpoints; 20 DELETE FROM migrations WHERE id = '`202610251600`-omnet-tka-registration'; 21 COMMIT; 22 PRAGMA foreign_keys = ON;