<@U04UQ68083H> I set up a new identity schema with...
# ory-copilot
a
@chilly-king-10285 I set up a new identity schema with the id admin but after I update it through the cli it returns a different id: 0ae043cf7b900aa9a21e9683820ce02563697eb2f5e8ec7e3eef32e11289b84478be349334f6ba1300de1cfcd1096a47e110f6f90 b2ceab743d2b8f8babcfeb0
c
A message from kapa.ai
When you update an identity schema in Ory, you must create a new revision of that schema. You can't update existing identity schemas by editing them. This means that every time you update an identity schema, a new unique ID is generated for that revision. This is why you're seeing a different ID after updating the schema. Here are the steps to update an identity schema: 1. Sign in to Ory Console and select [Identity Schema]. 2. Using the dropdown menu, select the "admin" schema. 3. Check the Customize Identity Schema box to enable editing and make the necessary changes. 4. Enter a new name in the Identity Model Schema text box, for example "admin_v2". 5. Click the Update button to save. You can also use versioning to keep track of changes to your identity schema when using the Ory CLI and Ory configuration files. This allows you to gradually update your identity schema without affecting existing identities. For example:
Copy code
json identity:    default_schema_id: admin_v1    schemas:    - id: admin_v0    url: base64://{b46-encoded-admin_v0}    - id: admin_v1    url: base64://{b46-encoded-admin_v1}
In this configuration, existing identities continue to use the
admin_v0
identity schema, and all newly created identities will use
admin_v1
schema. When you're ready to migrate all identities that use the
admin_v0
to the
admin_v1
schema, use the REST API to list all identities using the old version and perform the required data transformations. Sources: - [Manage Identity Schema](https://www.ory.sh/docs/identities/model/manage-identity-schema) - [Identity Schema Best Practices](https://www.ory.sh/docs/kratos/manage-identities/best-practices) - [Manage Ory Network Configuration in Git](https://www.ory.sh/docs/guides/gitops) - [Ory CLI Update Identity Config](https://www.ory.sh/docs/cli/ory-update-identity-config)
a
i followed the steps and got the same result
@chilly-king-10285 i followed the steps and got the same result
c
A message from kapa.ai
I'm sorry to hear that you're still experiencing issues. The ID you're seeing is likely the unique identifier for the new revision of your identity schema. This is expected behavior as each revision of an identity schema in Ory has a unique ID. If you're trying to reference the updated schema, you should use the new ID that was generated after the update. If you're trying to keep track of different versions of your schema, consider using a versioning system in your schema IDs, such as "admin_v1", "admin_v2", etc. If you're still having issues, it might be a good idea to check the Ory documentation or reach out to the Ory community for further assistance. Sources: - [Manage Identity Schema](https://www.ory.sh/docs/identities/model/manage-identity-schema) - [Identity Schema Best Practices](https://www.ory.sh/docs/kratos/manage-identities/best-practices) - [Manage Ory Network Configuration in Git](https://www.ory.sh/docs/guides/gitops) - [Ory CLI Update Identity Config](https://www.ory.sh/docs/cli/ory-update-identity-config)
a
but and if i want to check the schema_id to verify the type of the entity, like if the identity is a user or a admin etc
@chilly-king-10285 but and if i want to check the schema_id to verify the type of the entity, like if the identity is a user or a admin etc
c
A message from kapa.ai
To verify the type of an identity (like if it's a user or an admin), you can check the
schema_id
associated with that identity. This
schema_id
is set when the identity is created and corresponds to the identity schema used. In your application's business logic, you can use a switch statement to handle different types of identities based on their
schema_id
. Here's an example:
Copy code
javascript // This is an example program that can deal with different types of identities   session, err := ory.SessionFromRequest(r)   // some error handling   switch (session.Identity.SchemaID) {    case "customer":    // ...    case "admin":    // ...    case "default":    fallthrough    default:    // ...   }
In this example, if the
schema_id
of an identity is "admin", the corresponding case in the switch statement will be executed. Remember, the
schema_id
is a unique identifier for each identity schema, and it's used to distinguish between different types of identities in your system. Source: [Managing Users Identities Metadata](https://www.ory.sh/docs/kratos/manage-identities/managing-users-identities-metadata)
a
@chilly-king-10285 the problem is that i am receveing this id: 0ae043cf7b900aa9a21e9683820ce02563697eb2f5e8ec7e3eef32e11289b84478be349334f6ba1300de1cfcd1096a47e110f6f90b2ceab743d2b8f8babcfeb0
c
A message from kapa.ai
I see, it seems like you're receiving a long hash-like string as an ID, which is not the expected behavior. The
schema_id
should be the identifier you set when creating the schema, such as "admin", "user", etc. This could potentially be a bug or an issue with the specific version of Ory you're using. I would recommend reaching out to the Ory community or support for further assistance. They might be able to provide more insight into why you're seeing this behavior. You can also check the Ory documentation for any updates or changes related to identity schemas and their IDs. Sources: - [Managing Users Identities Metadata](https://www.ory.sh/docs/kratos/manage-identities/managing-users-identities-metadata) - [Customize Identity Schema](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema)