When I use namespace that have `_` in its name in permission model like `my_namespace` I can’t refer...
f
When I use namespace that have
_
in its name in permission model like
my_namespace
I can’t refer to it via
my-namespace
when adding our checking tuples which I need for the sake of backward compatibility with 0.7.
s
you have to continue using the same namespace name you had until now
just don't change anything
f
What do you mean “don't change anything”? How do a specify that a namespace from the previous version exist? I can't mention it in a permission model, right? And I can’t use both permission model and specify namespaces in yaml, can I?
s
ah so you want to translate
Copy code
namespaces:
  - name: my_namespace
    id: 123
into OPL? in that case just make it
Copy code
class my_namespace implements Namespace {}
in the OPL file
so just use the same name
f
No, I have an old (pre-permission model) namespace named like
my-namespace
and I have new namespaces that I’ve described in permission model. I don’t see a way to have backward compatibility here and use both.
I see from the config schema that I can’t for example combine the old way
Copy code
namespaces:
  - id: 0
    name: my-namespace
with
Copy code
namespaces:
  location: my_model.ts
Sorry for misunderstanding, I guess I wasn’t clear enough
s
Yes exactly, in the location you put a file URI pointing to that file
And the file content is just a class definition for each of your old namespaces with the exact same name
f
But It can’t be “exact same name” if it has dashes in it, can it? What should I do in this case?
s
ah I see... do you want to migrate them in some way anyway?
but tbh, the easiest will be to just update the namespace in SQL with a hand-crafted query
otherwise the migration would be: 1. add the new namespaces (in this case in the old format, but translatable to the new one, so without dashes) 2. write a job that uses the list API to get the relation tuples and then updates then through the batch API (insert new ones, delete old ones) 3. remove the old namespaces 4. 💰
f
Okay, so you confirm that I need a migration, right?
s
Yes in that case you need one