Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.
This repository was archived by the owner on May 13, 2022. It is now read-only.

Failure to dump schema.rb when model is using enums #181

@zedalaye

Description

@zedalaye

I started using enums to track Order statuses

My migration looks like :

  def up
    create_enum :order_status, 'created', 'processing', 'sent', 'delivered', 'cancelled'

    create_table :orders do |t|
      ...
      t.column :status, :order_status, null: false
      ...
    end

    create_table :order_trackings do |t|
      t.references :order,   index: true, on_update: :cascade, on_delete: :cascade

      t.column :old_status, :order_status
      t.column :new_status, :order_status, null: false

      t.datetime :created_at
    end
  end

And this is what is dumped into my schema.rb instead of Orders and OrderTrackings tables dumps :

# Could not dump table "orders" because of following StandardError
#   Unknown type 'order_status' for column 'status'
...
# Could not dump table "order_trackings" because of following StandardError
#   Unknown type 'order_status' for column 'old_status'

Did I made somehting wrong ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions