-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add migrations for new permissions structure #21945
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting the following error at the moment (same with other DB vendors):
[Error: INSERT INTO "_knex_temp_alter254" SELECT * FROM "directus_permissions"; - SQLITE_CONSTRAINT: NOT NULL constraint failed: _knex_temp_alter254.policy] {
errno: 19,
code: 'SQLITE_CONSTRAINT'
}
@paescuj Oh no here come the database specific bugs :| |
Oh yeah, how we love those 😅 It happens for permissions assigned to the "Public" role (a.k.a.
Not sure how we want to handle the "Public" role in the new policy system, so depending on that we either need to transform null values to something else in the migration or need to remove the NOT NULL constraint.
Example permission causing the issue (before ALTER statement): {
id: 30,
role: null,
collection: 'test',
action: 'create',
permissions: null,
validation: '{"_and":[{"id":{"_eq":"1"}}]}',
presets: '{"id":1}',
fields: 'id',
policy: null
} |
Co-authored-by: Daniel Biegler <DanielBiegler@users.noreply.github.com>
Co-authored-by: Daniel Biegler <DanielBiegler@users.noreply.github.com>
Please use Rebase and merge instead of Squash and merge below ⭐ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running the migration I'm stuck when trying to open the app. Still gotta figure out why exactly but thought to comment here just in case. Will update when I find more.
api dev: [20:50:24.361] ERROR: select `ip_access` from `directus_roles` where `id` is null limit 1 - SQLITE_ERROR: no such column: ip_access
api dev: err: {
api dev: "type": "Error",
api dev: "message": "select `ip_access` from `directus_roles` where `id` is null limit 1 - SQLITE_ERROR: no such column: ip_access",
api dev: "stack":
api dev: Error: select `ip_access` from `directus_roles` where `id` is null limit 1 - SQLITE_ERROR: no such column: ip_access
api dev: "errno": 1,
api dev: "code": "SQLITE_ERROR",
api dev: "extensions": {
api dev: "stack":
api dev: Error: select `ip_access` from `directus_roles` where `id` is null limit 1 - SQLITE_ERROR: no such column: ip_access
api dev: }
api dev: }
@DanielBiegler That's fully expected! This PR is only the migrations for the database, but doesn't update anything else yet in the API or app 🙂 That's also why we're rebasing this into the Just doing it in smaller PRs on top of auditus to make the review cycle easier as we can review each step of the way in isolation, which should hopefully mean that the final review of the whole project branch is going to go way smoother as every individual piece has already been reviewed 🚀 |
Oh whoops sry @rijkvanzanten . I assumed it would work because I saw the merge commits from auditus into this branch by you and Pascal and thought those would include some fixes but alrighty then. 🤔 |
All good! Those updates are all to keep |
Scope
What's changed:
directus_policies
table that's a 1-1 copy of the formerdirectus_roles
directus_roles
directus_permissions
to:type
columnPotential Risks / Drawbacks
Review Notes / Questions