2019-10-24 17:06:26 -04:00
|
|
|
# Creating enums
|
|
|
|
|
|
|
|
When creating a new enum, it should use the database type `SMALLINT`.
|
|
|
|
The `SMALLINT` type size is 2 bytes, which is sufficient for an enum.
|
|
|
|
This would help to save space in the database.
|
|
|
|
|
|
|
|
To use this type, add `limit: 2` to the migration that creates the column.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
2020-02-18 13:09:07 -05:00
|
|
|
```ruby
|
2019-10-24 17:06:26 -04:00
|
|
|
def change
|
|
|
|
add_column :ci_job_artifacts, :file_format, :integer, limit: 2
|
|
|
|
end
|
|
|
|
```
|