Hasura CLI console: changing permissions interfere with migrations
Author: hafCreated Jan 30, 2021Updated Sep 23, 2026
Labelssupport/needs-more-info
When using the Hasura CLI console to make changes to the database, the default functionality causes migrations that are impossible to run from scratch, because metadata.yaml sets our relationships which permissions need to function, but when adding new tables and their permissions in one go; permission migrations cause errors (since metadata is not yet applied).
Right now permissions are handled both as migrations and metadata. You'll trigger a bug when you do:
- create table via hasura cli console
- create permission e.g. for 'user'
- a folder for the permissions is created, metadata.yaml is updated likewise
- reset the db
- try to run migrations, you'll get a message like
FATA[0111] apply failed: [constraint-violation] in table "billing_companies": in permission for role "user": "users_in_roles" does not exist ($.args[259].args)
File: '1612012948642_update_permission_user_public_table_billing_companies/up.yaml'Applying metadata and running migrations will work, but is a workaround; better not to save permission changes as migrations, as migrations should be possible to run atomically before applying metadata.
Source: hasura/graphql-engine