Full project rename per m's call. Single atomic commit because the codebase rename is a coupled change — go module path, env vars, DB default, Docker artefact names, and on-disk mDock paths all flip together. - go.mod: module mgit.msbls.de/m/mcables → mgit.msbls.de/m/cablegui - cmd/mcables → cmd/cablegui (git mv) - All Go imports rewritten to the new module path - Env vars: MCABLES_ADDR/MCABLES_DB → CABLEGUI_ADDR/CABLEGUI_DB - DB default path: data/mcables.db → data/cablegui.db - Dockerfile + docker-compose.yml: image, container_name, env vars, bind-mount /home/m/stacks/mcables → /home/m/stacks/cablegui, secrets /home/m/secrets/mcables → /home/m/secrets/cablegui - Makefile: bin target + run/build commands point at cmd/cablegui - .gitignore + .dockerignore: /mcables → /cablegui - README, docs/design.md, CLAUDE.md: prose + paths + image name - web/static/index.html: <title> + brand - web/static/main.js + web/web.go: header comment - internal/exporter: Scene.Source "mcables" → "cablegui" - internal/server/export.go: error-detail secrets path - internal/db/migrations/*.sql: header comments (mCables vN → CableGUI vN) Memory group_id kept as "mcables" to preserve existing memory continuity. Documented as historical in CLAUDE.md. go build ./... clean; go test -race ./... green
35 lines
2.0 KiB
SQL
35 lines
2.0 KiB
SQL
-- CableGUI v4.1 connection requirements + solver-owned cable flag.
|
|
-- See docs/design.md §2.1 + §2 connection_requirements + §5b.3.
|
|
|
|
-- The solver's input: "device A must connect to device B via cable type T".
|
|
-- Many per device. (from, to) is normalised on insert as
|
|
-- (pair_lo, pair_hi) = (MIN(from, to), MAX(from, to)) so (A,B,T) and (B,A,T)
|
|
-- can't coexist (UNIQUE enforces it).
|
|
CREATE TABLE connection_requirements (
|
|
id INTEGER PRIMARY KEY,
|
|
project_id INTEGER NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
from_device_id INTEGER NOT NULL REFERENCES devices(id) ON DELETE CASCADE,
|
|
to_device_id INTEGER NOT NULL REFERENCES devices(id) ON DELETE CASCADE,
|
|
preferred_cable_type_id INTEGER REFERENCES cable_types(id) ON DELETE SET NULL,
|
|
must_connect INTEGER NOT NULL DEFAULT 1 CHECK (must_connect IN (0, 1)),
|
|
notes TEXT NOT NULL DEFAULT '',
|
|
pair_lo INTEGER NOT NULL,
|
|
pair_hi INTEGER NOT NULL,
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
updated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
CHECK (from_device_id != to_device_id),
|
|
UNIQUE (project_id, pair_lo, pair_hi, preferred_cable_type_id)
|
|
);
|
|
CREATE INDEX conn_reqs_project_idx ON connection_requirements(project_id);
|
|
CREATE INDEX conn_reqs_pair_idx ON connection_requirements(project_id, pair_lo, pair_hi);
|
|
CREATE INDEX conn_reqs_from_idx ON connection_requirements(from_device_id);
|
|
CREATE INDEX conn_reqs_to_idx ON connection_requirements(to_device_id);
|
|
|
|
-- Solver-owned cable flag (§5b.3): 1 = the solver placed this cable,
|
|
-- replaceable on re-solve. 0 = m hand-drew it, left alone by the solver.
|
|
-- Slice 6 ships the solver that writes auto=1; slice 7 ships hand-drawn
|
|
-- cable creation that writes auto=0.
|
|
ALTER TABLE cables ADD COLUMN auto INTEGER NOT NULL DEFAULT 0
|
|
CHECK (auto IN (0, 1));
|
|
CREATE INDEX cables_auto_idx ON cables(auto);
|