Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/active_record/postgres_enum/command_recorder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module ActiveRecord
module PostgresEnum
module CommandRecorder
def create_enum(name, values)
def create_enum(name, values, _opts = nil)
record(:create_enum, [name, values])
end

Expand Down
14 changes: 13 additions & 1 deletion spec/active_record/migrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RSpec.describe ActiveRecord::PostgresEnum::CommandRecorder do
let(:connection) { ActiveRecord::Base.connection }

it "reverts create_enum" do
it "reverts create_enum with no options" do
migration = build_migration { create_enum :genre, %w[drama comedy] }

migration.migrate(:up)
Expand All @@ -17,6 +17,18 @@
expect(connection.enum_types[:genre]).to be_nil
end

it "reverts create_enum with options" do
migration = build_migration { create_enum :genre, %w[drama comedy], force: true, if_not_exists: true }

migration.migrate(:up)

expect(connection.enum_types[:genre]).to eq %w[drama comedy]

migration.migrate(:down)

expect(connection.enum_types[:genre]).to be_nil
end

it "reverts rename_enum" do
build_migration { create_enum :genre, %w[drama comedy] }.migrate(:up)

Expand Down