Update db.rake#4
Conversation
If handle errors(e.g. PG::DuplicateTable) like this in case if the tables already exist we can update whole database 'fias' but not just initialize
|
It's unpredictably. If you want to create few tables - you can specify TABLES option for a rake. |
|
I want to update whole database using your tasks. Maybe if we handle just 'PG::DuplicateTable' exception, we are not lose control over the code behavior? |
|
|
If there is a working, but old FIAS database which updated irregularly, I think it would be easier to do a full refresh to actualize it. I checked - it can be done successfully by using your tasks, in case of bypass the exception 'PG::DuplicateTable' |
|
Am I correct that you are updating just data, not the table structure? |
|
Yes, just updating date. It can be solved by another ways, like using ActiveRecord::Base.connection.tables.include?("table_name") method to check existence of the table before trying to create it. Or i wrote method, that deletes all existing tables which tied to fias models in local DB - and call it before start full updating. |
If handle errors(e.g. PG::DuplicateTable) like this in case if the tables already exist we can update whole database 'fias' but not just initialize