Skip to content

Add space_type as a enum in Space table

Isabelle Lafont requested to merge il/feat/733/new-space_type-field into develop

In order to prevent to remove or add additional space_type, the explicit hash syntax has been used like recommended by rails doc.

https://api.rubyonrails.org/v5.2.5/classes/ActiveRecord/Enum.html

👇

Note that when an array is used, the implicit mapping from the values to database integers is derived from the order the values appear in the array. In the example, :active is mapped to 0 as it's the first element, and :archived is mapped to 1. In general, the i-th element is mapped to i-1 in the database.

Therefore, once a value is added to the enum array, its position in the array must be maintained, and new values should only be added to the end of the array. To remove unused values, the explicit hash syntax should be used.

Closes issue 733

Merge request reports