feat: Require scopeId cascade FK relation to crdt_scopes for synced tables (#79)

Co-authored-by: Marcelo Soares <marcelo.me.soares@gmail.com>
This commit is contained in:
Copilot 2026-06-21 10:02:08 -03:00 • committed by GitHub
commit 5642d9b94d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 393 additions and 35 deletions

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
street: String
inhabitantId: UuidValue?, unique
inhabitant: Person?, relation(name=person_address, field=inhabitantId, onDelete=Restrict)

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
citizens: List<Person>?, relation
organizations: List<Organization>?, relation(name=city_org)

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
town: Town?, relation(field=townId, onDelete=SetDefault)
townId: UuidValue, default='550e8400-e29b-41d4-a716-446655440000'

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
root: FkChainRoot?, relation(field=rootId, onDelete=Cascade)
rootId: UuidValue?

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
restrictBlocker: FkChainRestrictBlocker?, relation(field=restrictBlockerId, onDelete=Cascade)
restrictBlockerId: UuidValue?

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
restrictBlocker: FkChainRestrictBlocker?, relation(field=restrictBlockerId, onDelete=SetNull)
restrictBlockerId: UuidValue?

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
cascadeMiddle: FkChainCascadeMiddle?, relation(field=cascadeMiddleId, onDelete=Restrict)
cascadeMiddleId: UuidValue?

View file

@ -4,5 +4,5 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
setNullMiddle: FkChainSetNullMiddle?, relation(field=setNullMiddleId, onDelete=Cascade)
setNullMiddleId: UuidValue?

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
cascadeMiddle: FkChainCascadeMiddle?, relation(field=cascadeMiddleId, onDelete=SetNull)
cascadeMiddleId: UuidValue?

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
setNullMiddle: FkChainSetNullMiddle?, relation(field=setNullMiddleId, onDelete=Restrict)
setNullMiddleId: UuidValue?

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
setNullMiddle: FkChainSetNullMiddle?, relation(field=setNullMiddleId, onDelete=SetNull)
setNullMiddleId: UuidValue?

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
people: List<Person>?, relation(name=org_person)
city: City?, relation(name=city_org, optional, onDelete=Cascade)

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
surname: String?
address: Address?, relation(name=person_address)

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
parent: Person?, relation(field=parentId, onDelete=SetNull)
parentId: UuidValue

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
parent: Person?, relation(field=parentId, onDelete=Restrict)
parentId: UuidValue?

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String
city: City?, relation(optional, onDelete=Cascade)
mayor: Person?, relation(optional, onDelete=SetNull)

View file

@ -5,7 +5,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
aBool: bool
aDateTime: DateTime
aText: String

View file

@ -4,5 +4,5 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
name: String, unique(per=scopeId)

View file

@ -4,7 +4,7 @@ database: all
fields:
id: UuidValue?, defaultPersist=random_v7
### Owner scope of this row. Maintained by the CRDT sync layer.
scopeId: int?
scopeId: int?, relation(parent=crdt_scopes, onDelete=Cascade)
### This scope field has no relation with the CRDT sync layer.
scope: String
value: String, unique(per=[scopeId, scope])

Some files were not shown because too many files have changed in this diff Show more