taps 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/bin/schema +7 -0
- data/lib/taps/adapter_hacks.rb +1 -1
- data/lib/taps/adapter_hacks/mysql_invalid_primary_key.rb +17 -0
- data/lib/taps/schema.rb +2 -1
- metadata +7 -6
data/VERSION.yml
CHANGED
data/bin/schema
CHANGED
@@ -10,6 +10,7 @@ database_url = ARGV.shift.strip rescue ''
|
|
10
10
|
|
11
11
|
def show_usage_and_exit
|
12
12
|
puts <<EOTXT
|
13
|
+
schema console <database_url>
|
13
14
|
schema dump <database_url>
|
14
15
|
schema indexes <database_url>
|
15
16
|
schema reset_db_sequences <database_url>
|
@@ -33,6 +34,12 @@ elsif cmd == 'load'
|
|
33
34
|
Taps::Schema.load(database_url, schema)
|
34
35
|
elsif cmd == 'reset_db_sequences'
|
35
36
|
Taps::Schema.reset_db_sequences(database_url)
|
37
|
+
elsif cmd == 'console'
|
38
|
+
Taps::Schema.connection(database_url)
|
39
|
+
$db = ActiveRecord::Base.connection
|
40
|
+
require 'irb'
|
41
|
+
require 'irb/completion'
|
42
|
+
IRB.start
|
36
43
|
else
|
37
44
|
show_usage_and_exit
|
38
45
|
end
|
data/lib/taps/adapter_hacks.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters
|
3
|
+
class MysqlAdapter < AbstractAdapter
|
4
|
+
alias_method :orig_pk_and_sequence_for, :pk_and_sequence_for
|
5
|
+
# mysql accepts varchar as a primary key but most others do not.
|
6
|
+
# only say that a field is a primary key if mysql says so
|
7
|
+
# and the field is a kind of integer
|
8
|
+
def pk_and_sequence_for(table)
|
9
|
+
keys = []
|
10
|
+
execute("describe #{quote_table_name(table)}").each_hash do |h|
|
11
|
+
keys << h["Field"] if h["Key"] == "PRI" and !(h["Type"] =~ /int/).nil?
|
12
|
+
end
|
13
|
+
keys.length == 1 ? [keys.first, nil] : nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/taps/schema.rb
CHANGED
@@ -34,8 +34,9 @@ module Schema
|
|
34
34
|
|
35
35
|
def connection(database_url)
|
36
36
|
config = create_config(database_url)
|
37
|
+
c = ActiveRecord::Base.establish_connection(config)
|
37
38
|
Taps::AdapterHacks.load(config['adapter'])
|
38
|
-
|
39
|
+
c
|
39
40
|
end
|
40
41
|
|
41
42
|
def dump(database_url)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Chimal, Jr.
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-04-
|
13
|
+
date: 2009-04-10 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -90,15 +90,16 @@ files:
|
|
90
90
|
- spec/utils_spec.rb
|
91
91
|
- lib/taps/progress_bar.rb
|
92
92
|
- lib/taps/client_session.rb
|
93
|
-
- lib/taps/
|
94
|
-
- lib/taps/
|
93
|
+
- lib/taps/utils.rb
|
94
|
+
- lib/taps/db_session.rb
|
95
95
|
- lib/taps/adapter_hacks/non_rails_schema_dump.rb
|
96
|
+
- lib/taps/adapter_hacks/mysql_invalid_primary_key.rb
|
97
|
+
- lib/taps/adapter_hacks/invalid_text_limit.rb
|
96
98
|
- lib/taps/schema.rb
|
97
99
|
- lib/taps/config.rb
|
98
100
|
- lib/taps/cli.rb
|
99
|
-
- lib/taps/db_session.rb
|
100
101
|
- lib/taps/server.rb
|
101
|
-
- lib/taps/
|
102
|
+
- lib/taps/adapter_hacks.rb
|
102
103
|
- README.rdoc
|
103
104
|
- LICENSE
|
104
105
|
- VERSION.yml
|