Closed apercas closed 6 years ago
Look how vectorial overviews seems to be renamed: https://github.com/splashblot/dronedb/blob/tileo/app/models/table.rb#L1078
I have seen that overviews contains reference to original table by table name and the references doesn't seems to update on table rename. Use \d+
from psql
over a overview to see the reference.
Postgis forums suggesting ALTER TABLE
s queries: http://postgis.17.x6.nabble.com/Renaming-Raster-Table-td5011324.html
Hide
logic deployed to beta.
Rough and dirty code for the rename:
#hotfix for rasters
if table_name.include? "_raster"
i = 1
#new_table_name.slice! "_raster"
#new_table_name = new_table_name + "_raster"
while i < 2
puts 'RUNNING: `ALTER TABLE o_'+i.to_s+'_'+table_name+' RENAME TO o_'+i.to_s+'_' +new_table_name
@database.execute %{
SELECT DropOverviewConstraints('public', 'o_#{i}_#{table_name}', 'the_raster_webmercator');
}
@database.execute %{
ALTER TABLE #{table_name} RENAME TO #{new_table_name};
ALTER TABLE o_#{i}_#{table_name} RENAME TO o_#{i}_#{new_table_name};
}
@database.execute %{
SELECT AddOverviewConstraints('public','o_#{i}_#{new_table_name}','the_raster_webmercator','public','#{new_table_name}','the_raster_webmercator',#{i});
}
i +=1
end
end
puts table_name + ' renamed ' + new_table_name
It actually works and update the stats :') https://github.com/splashblot/dronedb/commit/855890aa48be33399dd3b4e7a3ffd9a6874117bc
Rename deployed to beta.
Rename deployed to prod.
Steps to Reproduce
Current Result
Both seem to work but their useless because when you rename a raster dataset it doesn't update the name of its overviews, and it doesn't duplicate them either
Expected result
A proper renaming and duplicating feature affecting all instances of the stack, regocijo y paz mundial