Sha256: 1d6486c2d60756af226921b668c85c0165245db992db6ff9b2620376e5871d7d

Contents?: true

Size: 1.19 KB

Versions: 17

Compression:

Stored size: 1.19 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 console <database_url>
	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)
elsif cmd == 'console'
	Taps::Schema.connection(database_url)
	$db = ActiveRecord::Base.connection
	require 'irb'
	require 'irb/completion'
	IRB.start
else
	show_usage_and_exit
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
ricardochimal-taps-0.2.14 bin/schema
ricardochimal-taps-0.2.15 bin/schema
ricardochimal-taps-0.2.16 bin/schema
ricardochimal-taps-0.2.18 bin/schema
ricardochimal-taps-0.2.19 bin/schema
taps-0.2.25 bin/schema
taps-0.2.24 bin/schema
taps-0.2.23 bin/schema
taps-0.2.22 bin/schema
taps-0.2.21 bin/schema
taps-0.2.20 bin/schema
taps-0.2.19 bin/schema
taps-0.2.15 bin/schema
taps-0.2.16 bin/schema
taps-0.2.14 bin/schema
taps-0.2.18 bin/schema
taps-0.2.17 bin/schema