Skip to content

Commit

Permalink
Fix for table deleted right after creation #5264
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafa de la Torre committed Sep 3, 2015
1 parent c987713 commit b3919ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/models/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,12 @@ def cartodbfy
end
end

# There might be a rewrite during cartodbfy. Get the OID and store it in Table metadata.
# This is needed in order to prevent ghost tables from dropping the table and metadata associated (vizs).
oid = owner.in_database.fetch(%Q{SELECT '#{qualified_table_name}'::regclass::oid}).first[:oid].to_i
self.table_id = oid
self.save

elapsed = Time.now - start
if @data_import
CartoDB::Importer2::CartodbfyTime::instance(@data_import.id).add(elapsed)
Expand Down

0 comments on commit b3919ff

Please sign in to comment.