MySQL bigint auto_increment primary_key is not dumped correct in db/schema.rb #19232
I have tried to create a table with an bigint as primary_key and auto_increment for a MySQL database.
My Migration was
Auto_increment and primary_key have been ignored.
The db/schema.rb looked like
A second try
The MySQL-Table was build correct
But the db/schema.rb looked like
And after a
The text was updated successfully, but these errors were encountered:
@LtdPayne @wallerjake Yes, we tested it here with the latest master and it is working:
Running the migration:
def change create_table :tests, id: false do |t| t.integer :id, limit: 8, auto_increment: true, primary_key: true t.string :name end end
results in the schema:
create_table "tests", id: :bigint, force: :cascade do |t| t.string "name", limit: 255 end
which is equivalent. You could probably move the "id: :bigint" part to the migration already, although I didn't try that.
I dug a bit deeper and there have been a lot of changes on
I suggest using
I'd not backport it. There is a lot of changes that may break something.
Yes. I think this is the best you have with Rails 4. Or use @kamipo's gem. He is the author of the original patch and a bunch of other improvements on the mysql adapter.
With Rails(4.2.5) and mysql2(0.4.3), I am not able to set
The generated schema entry is
And generated table definition is
Though I could fix the issue using activerecord-mysql-awesome gem but I am bit hesitant to use that because I don't have any idea what implications would have with future versions of rails and mysql2 gems.
Also it adds