Rename tables for rails convention#328
Conversation
|
This looks good, though I'd want to split up the migration. As this stands, the whole migration will run in one database migration which feels dangerous and I don't think is necessary. If we had one migration per rename, it would run each in its own transaction. |
|
@magnusvk I think this will be the last time I separate things out... |
|
:) |
There was a problem hiding this comment.
Using DISTINCT that way, will not work in PostgreSQL (if I undestand correctly, why distinct is used there). In documentation, we have example:
SELECT DISTINCT ON (location) location, time, report
FROM weather_reports
ORDER BY location, time DESC;So when we want to show records with unique spree_product.id then we need to add ON before field name, but this is not compatible with other DBs.
There was a problem hiding this comment.
@grzlus If we add the ON keyword, then we could definitely move this to Arel, but you're right, this won't be compatible with other DBs. I think I'll just make an if statement for database type. Its not nice, but it'll do :(
There was a problem hiding this comment.
This will not be so easy: https://github.com/rails/arel/blob/master/lib/arel/visitors/to_sql.rb#L298 Only PostgreSQL has implemented visit function for distinct_on
You need to guess what DB is used and use distinct/distinct on 😞
|
Cleaning up these commits isn't going to be worth the effort to get them into core, the majority of the important functionality of #289 already got in, so just killing this. |
No description provided.