Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • T torque-postgresql
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Carlos
  • torque-postgresql
  • Wiki
  • Enum

Enum · Changes

Page history
Updated Enum (markdown) authored Aug 20, 2019 by Carlos's avatar Carlos
Hide whitespace changes
Inline Side-by-side
Enum.md
View page @ 73235534
...@@ -44,6 +44,24 @@ create_table :users do |t| ...@@ -44,6 +44,24 @@ create_table :users do |t|
end end
``` ```
#### Adding value migration Exception
Sometimes, adding values are prevented because migrations run inside of transactions, but there are some occasions that PostgreSQL doesn't allow that, check [PostgreSQL Docs](https://www.postgresql.org/docs/9.1/sql-altertype.html#AEN63251). In those cases, just add `disable_ddl_transaction!` to the migration:
```ruby
class AddEnumValue < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def up
add_enum_values :status, %i(baz qux), after: :foo
end
def down
# this migration is irreversible
end
end
```
### The type Class ### The type Class
Each enum type loaded from the database will have its own class type of value, created under the [`enum.namespace`](https://github.com/crashtech/torque-postgresql/wiki/Configuring#enum.namespace) namespace. Each enum type loaded from the database will have its own class type of value, created under the [`enum.namespace`](https://github.com/crashtech/torque-postgresql/wiki/Configuring#enum.namespace) namespace.
......
Clone repository
  • Wiki
  • Configuring

Core Extensions

  • Range

Data types

  • Enum
  • Enum Set
  • Interval
  • Date/Time Range
  • Box
  • Circle
  • Line
  • Segment

Querying

  • Arel
  • Has Many
  • Belongs to Many
  • Dynamic Attributes
  • Distinct On
  • Auxiliary Statements
  • Inherited Tables