dbmate icon indicating copy to clipboard operation
dbmate copied to clipboard

schema dump includes `AUTO INCREMENT`

Open david-a opened this issue 6 years ago • 6 comments

Hi,

When I dbmate migrate the schema dump includes the current AUTO INCREMENT of each table, which is bad since if I want to import the schema as is (without going through all the migrations) to a server or another computer it will start the row count from where my local table ends.

Thanks

david-a avatar Oct 18 '18 11:10 david-a

Which database is this on? I haven't noticed this behavior on postgres, so I'm wondering if it's mysql specific.

amacneil avatar Oct 22 '18 20:10 amacneil

I do work with mysql currently, thanks.

david-a avatar Oct 31 '18 09:10 david-a

Are you able to manually produce a mysqldump (using their cli tool) without the auto increment value set?

amacneil avatar Nov 01 '18 04:11 amacneil

It seems like a known issue, but it can be resolved with the --skip-auto-increment flag source: https://stackoverflow.com/questions/15656463/mysqldump-export-structure-only-without-autoincrement

david-a avatar Nov 03 '18 17:11 david-a

I will try to solve this in my fork. I will make a PR asap.

paulovitorbal avatar Mar 21 '22 11:03 paulovitorbal

@paulovitorbal where is your PR?

iwata avatar Jul 12 '22 00:07 iwata

It seems the mentioned --skip-auto-increment doesn't actually exist for mysqldump unless you have "GUI Tools". So, I took a stab at a PR for this. Interested in any feedback.

shames0 avatar Sep 20 '22 23:09 shames0