Merge pull request #16358 from CartoDB/bug/sc-184298/check-migration-process-for-old-plans

[sc184298] Update analysis schema when a user is promoted to organization owner
pull/16360/head^2
Shylpx 3 years ago committed by GitHub
commit 0f2aa2ab0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -59,6 +59,7 @@ Development
- Allow importing datasets with exhausted map quota [#16320](https://github.com/CartoDB/cartodb/pull/16320)
- Fix empty ArcGIS imports [#16322](https://github.com/CartoDB/cartodb/pull/16322)
- Fix data overwrite when a user is promoted to admin [#16351](https://github.com/CartoDB/cartodb/pull/16351)
- Update analysis schema when a user is promoted to organization owner [#16358](https://github.com/CartoDB/cartodb/pull/16358)
- Add setting to disable diagnosis page [#16324](https://github.com/CartoDB/cartodb/pull/16324)
- Fix wrong layer schema when creating a map from a shared dataset [#16323](https://github.com/CartoDB/cartodb/pull/16323)
- Fix auto guessing when a csv field is wrong [#16326](https://github.com/CartoDB/cartodb/pull/16326)

@ -277,6 +277,25 @@ module CartoDB
end
end
def update_analyses_schema
@user.carto_user.tables.each do |table|
table.dependent_visualizations.each do |visualization|
visualization.analyses.each do |analysis|
analysis.update_table_name(
"#{SCHEMA_PUBLIC}.#{table.name}",
"\"#{@user.database_schema}\".#{table.name}"
)
end
end
end
rescue StandardError => e
Rails.logger.error(
exception: e,
message: 'Error updating schema of user analyses while moving to own schema',
user: @user.username
)
end
def create_importer_schema
create_schema('cdb_importer')
end
@ -1193,6 +1212,7 @@ module CartoDB
create_public_db_user
set_database_search_path
update_analyses_schema
end
rescue StandardError => e
# Undo metadata changes if process fails

Loading…
Cancel
Save