Can 'schema name' and 'type key' be used in the same C3 Type declaration?


#1

What does it mean to have a schema name and a type key in one declaration?


#2

#3

Yes they can.

“schema name” is used when creating a new table (e.g. a type that does not extend any other type)
“type key” is used when your type is extendable OR extends an extendable type


#4

In the example Kavi has provided, it says ‘extendable’ AND has ‘type key’. Do you need to use ‘type key’ even if you specify the current type as extendable? It covers the first part of your premise (‘type is extendable’) by adding the word ‘extendable’ and isn’t doing the second part (‘extends an extendable type’).


#5

@rileysiebel could you explain the benefits of having a type key for an extendable type that does not extend anything?


#6

@rileysiebel

Where is the data physically stored when using extends?
Is it in the parent table, or is there a behind-the-scenes join between multiple tables that happens?

If it is stored in the parent table, is the type key used to identify the child type records from the parent type records?


#7

It is stored in the same table and the type key is used to identify the child type records. So that means you cannot used the same id for two children type records that extends the same type…


#8

“They are stored in the same table” is an implementation detail that is not guaranteed to always be the case. The API is that ‘typeKey’ is required when defining types that are extendable or extend an extendable type.