Destroy a group on json or toml and its nameservers stay behind. Same for a
user's sessions and a zone's records. mysql removes all three, because it has a
constraint and the file stores have nothing.
Measured on 96f4799 through lib/<entity>/index.js, one fixture per pair:
| destroy |
child |
constraint |
mysql |
json |
toml |
| group |
nameserver |
nt_nameserver_ibfk_1 |
gone |
stays |
stays |
| user |
session |
nt_user_session_ibfk_1 |
gone |
stays |
stays |
| zone |
zone_record |
nt_zone_record_ibfk_1 |
gone |
stays |
stays |
The file-store destroy() is the whole story:
async destroy(args) {
const groups = await this._load()
const before = groups.length
const filtered = groups.filter((g) => g.id !== args.id)
if (filtered.length === before) return false
await this._save(filtered)
return true
}
user and zone are the same method over a different array.
Repro on json:
const Group = (await import('./lib/group/index.js')).default
const Nameserver = (await import('./lib/nameserver/index.js')).default
await Group.create({ id: 47101, parent_gid: 0, name: 'refgraph.test' })
await Nameserver.create({
id: 47104, gid: 47101, name: 'ns.refgraph.test.',
address: '203.0.113.10', type: 'nsd', ttl: 3600,
})
await Group.destroy({ id: 47101 })
;(await Nameserver.get({ id: 47104 })).length // 1 on json and toml, 0 on mysql
Watch how you check it. mysql reads a session through its user
(session/store/mysql.js joins nt_user on u.deleted=0), so a session that
survived still reads as absent once the user is gone. Delete the row a second
time and see whether anything was there.
#61 adds a fourth, measured the same way: destroy a group and its delegation
rows stay on json and toml, while nt_delegate_ibfk_1 removes them on mysql.
That one hides too — the file store's _present() filters on live group names.
group -> zone and group -> user keep the child on every store. Neither has a
constraint behind it, so that looks like a decision to make, not a difference to
fix.
Destroy a group on json or toml and its nameservers stay behind. Same for a
user's sessions and a zone's records. mysql removes all three, because it has a
constraint and the file stores have nothing.
Measured on 96f4799 through
lib/<entity>/index.js, one fixture per pair:nt_nameserver_ibfk_1nt_user_session_ibfk_1nt_zone_record_ibfk_1The file-store
destroy()is the whole story:user and zone are the same method over a different array.
Repro on json:
Watch how you check it. mysql reads a session through its user
(
session/store/mysql.jsjoinsnt_useronu.deleted=0), so a session thatsurvived still reads as absent once the user is gone. Delete the row a second
time and see whether anything was there.
#61 adds a fourth, measured the same way: destroy a group and its delegation
rows stay on json and toml, while
nt_delegate_ibfk_1removes them on mysql.That one hides too — the file store's
_present()filters on live group names.group -> zoneandgroup -> userkeep the child on every store. Neither has aconstraint behind it, so that looks like a decision to make, not a difference to
fix.