Performing Data Migrations in SpiceDB: S...
# spicedb
g
Hi folks, I read through https://authzed.com/blog/online-schema-migrations but am wondering how to modify the signature of a caveat? Old version is like: caveat ttl(current_time timestamp, expiration timestamp) { current_time < expiration } and new version is like: caveat ttl(create_time timestamp, lifetime duration, current_time timestamp) { create_time + lifetime >= current_time } But when I run "zed schema write authzed.zaml" then I get: 11:11AM FTL failed to write schema error="rpc error: code = InvalidArgument desc = cannot remove parameter
expiration
on caveat `ttl`" Do I need to keep the old caveat and add a new one like "ttl2" or something?
Looks like I was able to rename the caveat to "ttl2" and then rename it again to "ttl"
I'm unblocked for local development but would still welcome advice / input on schema updates to caveats
j
you add a new caveat and then rewrite the old relationships
to point the new caveat
and then you delete the old caveat
g
Great. And what are the rules about deleting the old caveat -- does it require that the caveat is removed from all relationships first?
j
yes