You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This comes from this PR and is important enough to keep in mind that I wanted to document it here explicitly so it's easy to find.
Notes about Roles
The role concept should not be conflated with Coach vs Coachee relationships as the latter describes relationships between users while the former describes relationships between a user and that user's organization. We need to be careful in how the two concepts evolve overtime.
**Notes about Strong Types and Previous Migrations **
Another thing to note: This PR updates the migration adding the initial admin user. The migration began failing when I updated the entity::users::Model struct to require a role attribute. The addition of the attribute caused the compiler to fail due to the migration not including role in it's struct definition. This is an important consideration when seeding data using a strongly typed language. As we move into production we want to strictly enforce a policy of not updating historical migrations as they, presumably, have been run in some environment (most importantly production). I updated our historical migration in this PR to insert the seeded records using raw SQL as it allows us to circumvent the type checks which were causing the migrations to fail. Please note that I also added a migration which runs after adding the concept of role and which updates the Admin user to promote their role to admin.
In the future we should:
Always provide some default value for columns we consider required
Use raw SQL for seeding data in migrations in order to avoid type issues when we update type requirements after the fact.
Avoid seeding data using migrations unless absolutely necessary. Prefer to build UI for adding data.
documentationImprovements or additions to documentation
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
This comes from this PR and is important enough to keep in mind that I wanted to document it here explicitly so it's easy to find.
Notes about Roles
The role concept should not be conflated with Coach vs Coachee relationships as the latter describes relationships between users while the former describes relationships between a user and that user's organization. We need to be careful in how the two concepts evolve overtime.
**Notes about Strong Types and Previous Migrations **
Another thing to note: This PR updates the migration adding the initial admin user. The migration began failing when I updated the entity::users::Model struct to require a role attribute. The addition of the attribute caused the compiler to fail due to the migration not including role in it's struct definition. This is an important consideration when seeding data using a strongly typed language. As we move into production we want to strictly enforce a policy of not updating historical migrations as they, presumably, have been run in some environment (most importantly production). I updated our historical migration in this PR to insert the seeded records using raw SQL as it allows us to circumvent the type checks which were causing the migrations to fail. Please note that I also added a migration which runs after adding the concept of role and which updates the Admin user to promote their role to admin.
In the future we should:
Always provide some default value for columns we consider required
Use raw SQL for seeding data in migrations in order to avoid type issues when we update type requirements after the fact.
Avoid seeding data using migrations unless absolutely necessary. Prefer to build UI for adding data.
Beta Was this translation helpful? Give feedback.
All reactions