Permalink
Browse files

request each table's schema individually

  • Loading branch information...
1 parent c1de7a1 commit 794bd08ff4cdeb5873785585bfd67bdc095f6dbd @ricardochimal ricardochimal committed Apr 9, 2010
Showing with 8 additions and 18 deletions.
  1. +6 −12 lib/taps/operation.rb
  2. +2 −6 lib/taps/server.rb
View
@@ -234,13 +234,15 @@ def run
def pull_schema
puts "Receiving schema"
- schema_data = session_resource['pull/schema'].get(http_headers).to_s
- output = Taps::Utils.load_schema(database_url, schema_data)
- puts output if output
+ tables.each do |table_name, count|
+ schema_data = session_resource['pull/schema'].post({:table_name => table_name}, http_headers).to_s
+ output = Taps::Utils.load_schema(database_url, schema_data)
+ puts output if output
+ end
end
def pull_data
- puts "Receiving data (new)"
+ puts "Receiving data"
puts "#{tables.size} tables, #{format_number(record_count)} records"
@@ -336,14 +338,6 @@ def fetch_remote_tables_info
data
end
- def pull_schema
- puts "Receiving schema"
-
- schema_data = session_resource['pull/schema'].get(http_headers).to_s
- output = Taps::Utils.load_schema(database_url, schema_data)
- puts output if output
- end
-
def pull_indexes
puts "Receiving indexes"
View
@@ -66,7 +66,6 @@ class Server < Sinatra::Base
session = DbSession.filter(:key => params[:key]).first
halt 404 unless session
- schema_app = File.dirname(__FILE__) + '/../../bin/schema'
Taps::Utils.schema_bin(:reset_db_sequences, session.database_url)
end
@@ -86,20 +85,17 @@ class Server < Sinatra::Base
Taps::Utils.load_indexes(session.database_url, index_data)
end
- get '/sessions/:key/pull/schema' do
+ post '/sessions/:key/pull/schema' do
session = DbSession.filter(:key => params[:key]).first
halt 404 unless session
- schema_app = File.dirname(__FILE__) + '/../../bin/schema'
- Taps::Utils.schema_bin(:dump, session.database_url)
+ Taps::Utils.schema_bin(:dump_table, session.database_url, params[:table_name])
end
get '/sessions/:key/pull/indexes' do
session = DbSession.filter(:key => params[:key]).first
halt 404 unless session
- schema_app = File.dirname(__FILE__) + '/../../bin/schema'
-
content_type 'application/json'
Taps::Utils.schema_bin(:indexes_individual, session.database_url)
end

0 comments on commit 794bd08

Please sign in to comment.