Skip to content

Instantly share code, notes, and snippets.

@arubis
Created August 15, 2018 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arubis/976e20d7df333805be513e05c3202c41 to your computer and use it in GitHub Desktop.
Save arubis/976e20d7df333805be513e05c3202c41 to your computer and use it in GitHub Desktop.
require "rails_helper"
describe "index issue" do
with_model :MidsizeNameChild do
table do |t|
t.belongs_to :midsize_name_parent,
index: { name: "shorter_index_name" }
end
model do
belongs_to :midsize_name_parent
end
end
with_model :MidsizeNameParent do
model do
has_many :midsize_name_children
end
end
let(:instance) { MidsizeNameParent.create }
describe "try to instantiate" do
it "is an example" do
instance
end
end
end
@arubis
Copy link
Author

arubis commented Aug 15, 2018

Demo working/broken usage of with_model on postgres backend. Dropping L7 (and the trailing comma on L6) will cause this to blow up due to generating an index with name >63 characters (PG9.6's limit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment