24 lines
1.4 KiB
SQL
24 lines
1.4 KiB
SQL
-- A machine's names are one seat's (novox/hq ADR 0223 part 3): `node-hosts-file` is renamed
|
|
-- `node-hostname`, whose holder writes /etc/hostname beside the machine's own lines in /etc/hosts.
|
|
--
|
|
-- A rename is a database update (ADR 0122): the row keeps its verbs, the former name becomes an alias
|
|
-- that resolves to it, so a manifest registered under the old name — the `hosts` module still assigned
|
|
-- while machines move to `hostname` — goes on holding the one seat, and two claimants of it on one
|
|
-- machine are still refused.
|
|
--
|
|
-- **Both rows may exist when this runs**, as 0048 found for the artifact store: a controller whose
|
|
-- compiled defaults carry the new name may seed it before this migration. Then the old row's holding
|
|
-- moves to it and the old row goes; otherwise the old row is renamed. Either way the old name becomes
|
|
-- an alias.
|
|
update seat_holding set seat = 'node-hostname'
|
|
where seat = 'node-hosts-file'
|
|
and exists (select 1 from seat where name = 'node-hostname');
|
|
delete from seat
|
|
where name = 'node-hosts-file'
|
|
and exists (select 1 from seat where name = 'node-hostname');
|
|
update seat set name = 'node-hostname', decided = 'novox/hq ADR 0199, ADR 0223'
|
|
where name = 'node-hosts-file';
|
|
insert into seat_alias (alias, seat) values ('node-hosts-file', 'node-hostname')
|
|
on conflict (alias) do update set seat = excluded.seat;
|
|
update seat_alias set seat = 'node-hostname' where seat = 'node-hosts-file';
|