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
{{ message }}
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
God, the database structure is a mess. Our relations are broken, etc.
Who's idea was it to use the codename of milestones as IDs?
Ow...
This issue isn't only about cleaning up our database structure and migrations. We'll also provide factories for all relevant models and seeders for anyone who wants to set up a local copy of ChangeWindows.
The new rules
For this project, a few rules have been set up. Some of these are common sense, some of these are Laravel guidelines and some of these are unique to ChangeWindows itself. These are just the rules that the current database wouldn't pass.
Every database table that isn't a pivot table has a unique numerical auto-incrimenting id, no exceptions. A pivot table uses a combination off the 2 or more foreign keys that make each line unique.
Every table has Laravel's auto-generated created_at and updated_at fields.
Any relation-field has the _id-suffix.
Pivot tables are named in a parent_child-pattern, not alphabetically as is enforced by Laravel. E.g. a platform has channels, thus its pivot table is named platform_channels and not channel_platforms as Laravel defaults towards.
All relations are defined with their constraints.
No fields should be added behind Laravel's created_at and updated_at fields, with the exception of Laravel's deleted_at field in case support for soft deleting is required.
Any table that has url-facing data has a slug field whom's value is set as the route key name to generate readable urls. E.g. platforms should have a slug, releases however shouldn't.
The only exception to these rules is the Buildfeed-table.
What this issue fixes
Right from the start, this means that a lot of things need to be fixed. The items that start with a (6) are new since version 6. Here is a list of all the fixes that Horizon applies:
Renames the ability_roles table to role_abilities.
Adds proper constraint from role_abilities to roles.
Adds proper constraint from role_abilities to abilities.
Renames abilities.label to abilities.description to properly reflect the function of the field.
Renames roles.label to roles.description to properly reflect the function of the field.
Removes the roles.rank-field which is a leftover of ChangeWindows 5.1.
Reorganizes the entire users-table field order.
Adds a users.slug field to store the slug for a user account based on name.
Adds proper constraint from roles to users.
(6) Renames the channel_platforms table to platform_channels.
Adds milestones.canonical_version which contains an XXYY-formatted version number for any milestone.
Renames milestones.osname to milestones.product_name to improve clearity of what the fields contains.
Renames milestones.preview to milestones.start_preview to better reflect the order of this field.
Renames milestones.public to milestones.start_public to better reflect the order of this field.
Renames milestones.mainEol to milestones.start_extended to better reflect the order of this field.
Renames milestones.mainXol to milestones.start_lts to better reflect the order of this field.
Renames milestones.ltsEol to milestones.end_lts to better reflect the order of this field.
Adds a milestones.slug field to store the slug for a milestone based on codename.
Renames releases-table to flights.
Renames releases.milestone to flights.milestone_id and changes type to bigint(20) to follow foreign key convention.
Renames releases.ring to flights.channel_id to follow foreign key convention.
Renames releases.platform to flights.platform_id to follow foreign key convention.
Adds flights.user_id to track user.
Removes the role_user-table.
Removes the patreons-table.
Removes the changelogs-table.
Removes the vnext-table.
The text was updated successfully, but these errors were encountered:
God, the database structure is a mess. Our relations are broken, etc.
Who's idea was it to use the codename of milestones as IDs?
Ow...
This issue isn't only about cleaning up our database structure and migrations. We'll also provide factories for all relevant models and seeders for anyone who wants to set up a local copy of ChangeWindows.
The new rules
For this project, a few rules have been set up. Some of these are common sense, some of these are Laravel guidelines and some of these are unique to ChangeWindows itself. These are just the rules that the current database wouldn't pass.
_id
-suffix.parent_child
-pattern, not alphabetically as is enforced by Laravel. E.g. a platform has channels, thus its pivot table is namedplatform_channels
and notchannel_platforms
as Laravel defaults towards.created_at
andupdated_at
fields, with the exception of Laravel'sdeleted_at
field in case support for soft deleting is required.The only exception to these rules is the Buildfeed-table.
What this issue fixes
Right from the start, this means that a lot of things need to be fixed. The items that start with a (6) are new since version 6. Here is a list of all the fixes that Horizon applies:
ability_roles
table torole_abilities
.role_abilities
to roles.role_abilities
to abilities.abilities.label
toabilities.description
to properly reflect the function of the field.roles.label
toroles.description
to properly reflect the function of the field.roles.rank
-field which is a leftover of ChangeWindows 5.1.users
-table field order.users.slug
field to store the slug for a user account based onname
.channel_platforms
table toplatform_channels
.milestones.canonical_version
which contains anXXYY
-formatted version number for any milestone.milestones.osname
tomilestones.product_name
to improve clearity of what the fields contains.milestones.preview
tomilestones.start_preview
to better reflect the order of this field.milestones.public
tomilestones.start_public
to better reflect the order of this field.milestones.mainEol
tomilestones.start_extended
to better reflect the order of this field.milestones.mainXol
tomilestones.start_lts
to better reflect the order of this field.milestones.ltsEol
tomilestones.end_lts
to better reflect the order of this field.milestones.slug
field to store the slug for a milestone based oncodename
.releases
-table toflights
.releases.milestone
toflights.milestone_id
and changes type tobigint(20)
to follow foreign key convention.releases.ring
toflights.channel_id
to follow foreign key convention.releases.platform
toflights.platform_id
to follow foreign key convention.flights.user_id
to track user.role_user
-table.patreons
-table.changelogs
-table.vnext
-table.The text was updated successfully, but these errors were encountered: