6 ms·
I know it's off-topic, but is regex the best way to convert SQL into seeds.rb? I'm thinking of doing the same thing, but I figured I'd use Ruby or a gem. https:
by arikrak 11y ago
I know it's off-topic, but is regex the best way to convert SQL into seeds.rb? I'm thinking of doing the same thing, but I figured I'd use Ruby or a gem. https://github.com/rroblak/seed_dump https://github.com/rroblak/seed_dump
- bdcravens 11y agoThis was a data dump from a previous development effort, and the Rails app was no longer connected to that database. Moreover, it was MySQL, not Postgresql, the new target. I probably could have stood up MySQL and used that gem to achieve the same result, but honestly, while the regex is at times a bit complex, it's straight-forward, since an insert's parenthetical list of values is very close to what you pass to Model.create. Thanks for the gem recommendation though, and hopefully it'll be a better solution the next time I encounter a similar situation.
- elinchrome 11y ago"...now you have two problems" Seems off base to me too.