Create a Postgres enum that has the following values: standard, taiko, catch, mania.
Add a ruleset field on the Tournament table that is not null and type of the previously created enum. In the Typescript schema, the field doesn't have a default value, but for the migration to execute without errors we'll make ruleset nullable, then update Tournament.ruleset and set it to standard and then make the column non-nullable.
Add a reulsetConfig field on the Tournament table that is not null and type of jsonb. The default will be an empty object, and (at least for now) the type should include keys when rulset is mania and that can be a number between 4 and 7.
tRPC
Update createTournament and updateTournament to include the ruleset field and its config (add it to mutationSchemas).
For updateTournament, the ruleset and its config can only be changed by the host and if the tournament isn't public yet.
Tournament settings page
Pass the ruleset field to the frontend.
Add a <Select /> field so the user can change the ruleset.
The field must be under the general settings.
Just like other fields in that same category, warn the user that they can't change the value once it's public and disable and display to non-hosts that they can't change that option.
If the user selects mania as a ruleset, a button should be enabled that will show a form with the configuration options (the keys).
Database
ruleset
field on theTournament
table that is not null and type of the previously created enum. In the Typescript schema, the field doesn't have a default value, but for the migration to execute without errors we'll makeruleset
nullable, then updateTournament.ruleset
and set it tostandard
and then make the column non-nullable.reulsetConfig
field on theTournament
table that is not null and type ofjsonb
. The default will be an empty object, and (at least for now) the type should includekeys
when rulset is mania and that can be a number between 4 and 7.tRPC
createTournament
andupdateTournament
to include the ruleset field and its config (add it tomutationSchemas
).updateTournament
, the ruleset and its config can only be changed by the host and if the tournament isn't public yet.Tournament settings page
<Select />
field so the user can change the ruleset.