Sha256: 196c435c60bf37de15b2ee443267a938eaeb3b2d50d8b3b8bc76b6f9d40bb053

Contents?: true

Size: 1.01 KB

Versions: 25

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
gem 'activerecord', '= 2.2.2'

require File.dirname(__FILE__) + '/../lib/taps/schema'

cmd = ARGV.shift.strip rescue ''
database_url = ARGV.shift.strip rescue ''

def show_usage_and_exit
	puts <<EOTXT
	schema dump <database_url>
	schema indexes <database_url>
	schema reset_db_sequences <database_url>
	schema load <database_url> <schema_file>
	schema load_indexes <database_url> <indexes_file>
EOTXT
	exit(1)
end

if cmd == 'dump'
	puts Taps::Schema.dump_without_indexes(database_url)
elsif cmd == 'indexes'
	puts Taps::Schema.indexes(database_url)
elsif cmd == 'load_indexes'
	filename = ARGV.shift.strip rescue ''
	indexes = File.read(filename) rescue show_usage_and_exit
	Taps::Schema.load_indexes(database_url, indexes)
elsif cmd == 'load'
	filename = ARGV.shift.strip rescue ''
	schema = File.read(filename) rescue show_usage_and_exit
	Taps::Schema.load(database_url, schema)
elsif cmd == 'reset_db_sequences'
	Taps::Schema.reset_db_sequences(database_url)
else
	show_usage_and_exit
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
ricardochimal-taps-0.2.0 bin/schema
ricardochimal-taps-0.2.1 bin/schema
ricardochimal-taps-0.2.12 bin/schema
ricardochimal-taps-0.2.13 bin/schema
ricardochimal-taps-0.2.2 bin/schema
ricardochimal-taps-0.2.3 bin/schema
ricardochimal-taps-0.2.4 bin/schema
ricardochimal-taps-0.2.5 bin/schema
ricardochimal-taps-0.2.6 bin/schema
ricardochimal-taps-0.2.7 bin/schema
ricardochimal-taps-0.2.8 bin/schema
ricardochimal-taps-0.2.9 bin/schema
taps-0.2.1 bin/schema
taps-0.2.11 bin/schema
taps-0.2.10 bin/schema
taps-0.2.13 bin/schema
taps-0.2.12 bin/schema
taps-0.2.8 bin/schema
taps-0.2.5 bin/schema
taps-0.2.3 bin/schema