schema_plus 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +18 -0
- data/Gemfile +4 -0
- data/README.rdoc +2 -2
- data/gemfiles/Gemfile.rails-2.3 +6 -0
- data/gemfiles/Gemfile.rails-3.0 +5 -0
- data/gemfiles/Gemfile.rails-3.1 +5 -0
- data/lib/schema_plus.rb +1 -1
- data/lib/schema_plus/version.rb +1 -1
- data/runspecs +39 -14
- data/schema_plus.gemspec +0 -15
- data/spec/connections/mysql/connection.rb +1 -2
- data/spec/connections/mysql2/connection.rb +1 -2
- data/spec/connections/postgresql/connection.rb +1 -0
- data/spec/connections/sqlite3/connection.rb +1 -0
- metadata +18 -47
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
rvm:
|
2
|
+
- 1.8.7
|
3
|
+
- 1.9.2
|
4
|
+
gemfile:
|
5
|
+
- gemfiles/Gemfile.rails-2.3
|
6
|
+
- gemfiles/Gemfile.rails-3.0
|
7
|
+
- gemfiles/Gemfile.rails-3.1
|
8
|
+
before_script:
|
9
|
+
- "mysql -e 'create database schema_plus_unittest;' > /dev/null"
|
10
|
+
- "psql -c 'create database schema_plus_unittest;' -U postgres > /dev/null"
|
11
|
+
after_script:
|
12
|
+
- "mysql -e 'drop database schema_plus_unittest;' > /dev/null"
|
13
|
+
- "psql -c 'drop database schema_plus_unittest;' -U postgres > /dev/null"
|
14
|
+
env: 'POSTGRES_DB_USER=postgres MYSQL_DB_USER=""'
|
15
|
+
notifications:
|
16
|
+
recipients:
|
17
|
+
- michal.lomnicki@gmail.com
|
18
|
+
- ronen@barzel.org
|
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -64,7 +64,7 @@ You can also create multi-column indexes, for example:
|
|
64
64
|
|
65
65
|
t.string :country_code
|
66
66
|
t.string :area_code
|
67
|
-
t.string :local_number :index => { :
|
67
|
+
t.string :local_number :index => { :with => [:country_code, :area_code], :unique => true }
|
68
68
|
|
69
69
|
If you're using Postgresql, SchemaPlus provides support for conditions, expressions, index methods, and case-insensitive indexes; see doc at SchemaPlus::ActiveRecord::ConnectionAdapters::PostgresqlAdapter and SchemaPlus::ActiveRecord::ConnectionAdapters::IndexDefinition
|
70
70
|
|
@@ -146,7 +146,7 @@ running. Create database user "schema_plus" with permissions for database
|
|
146
146
|
$ ./runspecs --install # do this once to install gem dependencies for all versions (slow)
|
147
147
|
$ ./runspecs # as many times as you like
|
148
148
|
|
149
|
-
You can also pick a specific version of rails and ruby to use, such as:
|
149
|
+
See <tt>./runspecs --help</tt> for more options. You can also manually pick a specific version of rails and ruby to use, such as:
|
150
150
|
$ rvm use 1.9.2
|
151
151
|
$ export SCHEMA_ASSOCIATIONS_RAILS_VERSION=3.1
|
152
152
|
$ bundle update --local rails mysql2 # different versions of rails require different mysql2's
|
data/lib/schema_plus.rb
CHANGED
@@ -11,7 +11,7 @@ require 'schema_plus/active_record/connection_adapters/abstract_adapter'
|
|
11
11
|
require 'schema_plus/active_record/connection_adapters/column'
|
12
12
|
require 'schema_plus/active_record/connection_adapters/foreign_key_definition'
|
13
13
|
require 'schema_plus/active_record/connection_adapters/index_definition'
|
14
|
-
require 'schema_plus/railtie' if defined?(Rails)
|
14
|
+
require 'schema_plus/railtie' if defined?(Rails::Railtie)
|
15
15
|
|
16
16
|
module SchemaPlus
|
17
17
|
module ActiveRecord
|
data/lib/schema_plus/version.rb
CHANGED
data/runspecs
CHANGED
@@ -1,36 +1,61 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'optparse'
|
4
|
+
require 'ostruct'
|
5
|
+
|
6
|
+
PROJECT = File.basename(File.expand_path('..', __FILE__))
|
4
7
|
|
5
8
|
RUBY_VERSIONS = %W[1.8.7 1.9.2]
|
6
9
|
RAILS_VERSIONS = %W[2.3 3.0 3.1]
|
7
10
|
|
8
|
-
|
11
|
+
o = OpenStruct.new
|
12
|
+
o.ruby_versions = RUBY_VERSIONS
|
13
|
+
o.rails_versions = RAILS_VERSIONS
|
14
|
+
o.run_cmd = "rake spec"
|
15
|
+
|
9
16
|
OptionParser.new do |opts|
|
10
17
|
opts.banner = "Usage: #{$0} [options]"
|
11
18
|
|
12
19
|
opts.on("--install", "Install gem dependencies") do |v|
|
13
|
-
|
20
|
+
o.install = v
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on("--db adapter", String, "Choose which db adapter to run: postgresql, mysql, mysql2, or sqlite3. Default is all of them" ) do |adapter|
|
24
|
+
p adapter
|
25
|
+
o.run_cmd = "rake #{adapter}:spec"
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("--ruby version", String, "Choose which version(s) of ruby to run. Default is: #{o.ruby_versions.join(' ')}") do |ruby|
|
29
|
+
o.ruby_versions = ruby.split(' ')
|
14
30
|
end
|
31
|
+
|
32
|
+
opts.on("--rails version", String, "Choose which version(s) of rails to run. Default is: #{o.rails_versions.join(' ')}") do |rails|
|
33
|
+
o.rails_versions = rails.split(' ')
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on("--quick", "quick run on Postgres, ruby #{RUBY_VERSIONS.last} and rails #{RAILS_VERSIONS.last}") do
|
37
|
+
o.ruby_versions = [RUBY_VERSIONS.last]
|
38
|
+
o.rails_versions = [RAILS_VERSIONS.last]
|
39
|
+
o.run_cmd = "rake postgresql:spec"
|
40
|
+
end
|
41
|
+
|
15
42
|
end.parse!
|
16
43
|
|
17
|
-
cmds = if
|
18
|
-
|
44
|
+
cmds = if o.install
|
45
|
+
"bundle install"
|
19
46
|
else
|
20
|
-
|
47
|
+
"bundle exec #{o.run_cmd}"
|
21
48
|
end
|
22
49
|
|
23
50
|
n = 1
|
24
|
-
|
25
|
-
|
26
|
-
|
51
|
+
GEMFILES_DIR = File.expand_path('../gemfiles', __FILE__)
|
52
|
+
total = o.ruby_versions.size * o.rails_versions.size
|
53
|
+
o.ruby_versions.each do |ruby|
|
54
|
+
o.rails_versions.each do |rails|
|
27
55
|
puts "\n\n*** ruby version #{ruby} - rails version #{rails} [#{n} of #{total}]\n\n"
|
56
|
+
gemfile = File.join(GEMFILES_DIR, "Gemfile.rails-#{rails}")
|
28
57
|
n += 1
|
29
|
-
|
30
|
-
|
31
|
-
allcmds << "export SCHEMA_PLUS_RAILS_VERSION=#{rails}"
|
32
|
-
allcmds += cmds
|
33
|
-
allcmds << 'exit'
|
34
|
-
system %Q{echo '#{allcmds.join(' \n ')}' | bash -i} or abort "aborting #{$0}"
|
58
|
+
command = %Q{BUNDLE_GEMFILE="#{gemfile}" rvm #{ruby} exec #{cmds}}
|
59
|
+
system(command)
|
35
60
|
end
|
36
61
|
end
|
data/schema_plus.gemspec
CHANGED
@@ -22,20 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.add_dependency("rails")
|
24
24
|
s.add_dependency("valuable")
|
25
|
-
|
26
|
-
case ENV['SCHEMA_PLUS_RAILS_VERSION']
|
27
|
-
when '2.3'
|
28
|
-
s.add_development_dependency("rails", "~> 2.3")
|
29
|
-
s.add_development_dependency("mysql2", "~> 0.2.6")
|
30
|
-
when '3.0'
|
31
|
-
s.add_development_dependency("rails", "~> 3.0")
|
32
|
-
s.add_development_dependency("mysql2", "~> 0.2.6")
|
33
|
-
when '3.1'
|
34
|
-
s.add_development_dependency("rails", ">= 3.1.0.rc1")
|
35
|
-
s.add_development_dependency("mysql2")
|
36
|
-
else
|
37
|
-
s.add_development_dependency("mysql2")
|
38
|
-
end
|
39
25
|
|
40
26
|
s.add_development_dependency("rake", "~> 0.8.7")
|
41
27
|
s.add_development_dependency("rspec")
|
@@ -44,6 +30,5 @@ Gem::Specification.new do |s|
|
|
44
30
|
s.add_development_dependency("sqlite3")
|
45
31
|
s.add_development_dependency("simplecov")
|
46
32
|
s.add_development_dependency("simplecov-gem-adapter")
|
47
|
-
s.add_development_dependency("ruby-debug19") if RUBY_VERSION >= "1.9.2"
|
48
33
|
end
|
49
34
|
|
@@ -7,9 +7,8 @@ ActiveRecord::Base.configurations = {
|
|
7
7
|
'schema_plus' => {
|
8
8
|
:adapter => 'mysql',
|
9
9
|
:database => 'schema_plus_unittest',
|
10
|
-
:username => 'schema_plus',
|
10
|
+
:username => ENV.fetch('MYSQL_DB_USER', 'schema_plus'),
|
11
11
|
:encoding => 'utf8',
|
12
|
-
:socket => '/tmp/mysql.sock',
|
13
12
|
:min_messages => 'warning'
|
14
13
|
}
|
15
14
|
|
@@ -7,9 +7,8 @@ ActiveRecord::Base.configurations = {
|
|
7
7
|
'schema_plus' => {
|
8
8
|
:adapter => 'mysql2',
|
9
9
|
:database => 'schema_plus_unittest',
|
10
|
-
:username => 'schema_plus',
|
10
|
+
:username => ENV.fetch('MYSQL_DB_USER', 'schema_plus'),
|
11
11
|
:encoding => 'utf8',
|
12
|
-
:socket => '/tmp/mysql.sock',
|
13
12
|
:min_messages => 'warning'
|
14
13
|
}
|
15
14
|
|
@@ -6,6 +6,7 @@ ActiveRecord::Base.logger = Logger.new(File.open("postgresql.log", "w"))
|
|
6
6
|
ActiveRecord::Base.configurations = {
|
7
7
|
'schema_plus' => {
|
8
8
|
:adapter => 'postgresql',
|
9
|
+
:username => ENV['POSTGRES_DB_USER'],
|
9
10
|
:database => 'schema_plus_unittest',
|
10
11
|
:min_messages => 'warning'
|
11
12
|
}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: schema_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ronen Barzel
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-08-04 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -37,40 +37,40 @@ dependencies:
|
|
37
37
|
type: :runtime
|
38
38
|
version_requirements: *id002
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
|
-
name:
|
40
|
+
name: rake
|
41
41
|
prerelease: false
|
42
42
|
requirement: &id003 !ruby/object:Gem::Requirement
|
43
43
|
none: false
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.8.7
|
48
48
|
type: :development
|
49
49
|
version_requirements: *id003
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
|
-
name:
|
51
|
+
name: rspec
|
52
52
|
prerelease: false
|
53
53
|
requirement: &id004 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version: 0
|
58
|
+
version: "0"
|
59
59
|
type: :development
|
60
60
|
version_requirements: *id004
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: pg
|
63
63
|
prerelease: false
|
64
64
|
requirement: &id005 !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0
|
69
|
+
version: "0"
|
70
70
|
type: :development
|
71
71
|
version_requirements: *id005
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
|
-
name:
|
73
|
+
name: mysql
|
74
74
|
prerelease: false
|
75
75
|
requirement: &id006 !ruby/object:Gem::Requirement
|
76
76
|
none: false
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
type: :development
|
82
82
|
version_requirements: *id006
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: sqlite3
|
85
85
|
prerelease: false
|
86
86
|
requirement: &id007 !ruby/object:Gem::Requirement
|
87
87
|
none: false
|
@@ -92,7 +92,7 @@ dependencies:
|
|
92
92
|
type: :development
|
93
93
|
version_requirements: *id007
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: simplecov
|
96
96
|
prerelease: false
|
97
97
|
requirement: &id008 !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
@@ -103,7 +103,7 @@ dependencies:
|
|
103
103
|
type: :development
|
104
104
|
version_requirements: *id008
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
|
-
name:
|
106
|
+
name: simplecov-gem-adapter
|
107
107
|
prerelease: false
|
108
108
|
requirement: &id009 !ruby/object:Gem::Requirement
|
109
109
|
none: false
|
@@ -113,39 +113,6 @@ dependencies:
|
|
113
113
|
version: "0"
|
114
114
|
type: :development
|
115
115
|
version_requirements: *id009
|
116
|
-
- !ruby/object:Gem::Dependency
|
117
|
-
name: simplecov
|
118
|
-
prerelease: false
|
119
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: "0"
|
125
|
-
type: :development
|
126
|
-
version_requirements: *id010
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: simplecov-gem-adapter
|
129
|
-
prerelease: false
|
130
|
-
requirement: &id011 !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
|
-
requirements:
|
133
|
-
- - ">="
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version: "0"
|
136
|
-
type: :development
|
137
|
-
version_requirements: *id011
|
138
|
-
- !ruby/object:Gem::Dependency
|
139
|
-
name: ruby-debug19
|
140
|
-
prerelease: false
|
141
|
-
requirement: &id012 !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
|
-
requirements:
|
144
|
-
- - ">="
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: "0"
|
147
|
-
type: :development
|
148
|
-
version_requirements: *id012
|
149
116
|
description: "SchemaPlus is an ActiveRecord extension that provides enhanced capabilities for schema definition and querying, including: enhanced and more DRY index capabilities, support and automation for foreign key constraints, and support for views."
|
150
117
|
email:
|
151
118
|
- ronen@barzel.org
|
@@ -158,10 +125,14 @@ extra_rdoc_files: []
|
|
158
125
|
|
159
126
|
files:
|
160
127
|
- .gitignore
|
128
|
+
- .travis.yml
|
161
129
|
- Gemfile
|
162
130
|
- MIT-LICENSE
|
163
131
|
- README.rdoc
|
164
132
|
- Rakefile
|
133
|
+
- gemfiles/Gemfile.rails-2.3
|
134
|
+
- gemfiles/Gemfile.rails-3.0
|
135
|
+
- gemfiles/Gemfile.rails-3.1
|
165
136
|
- init.rb
|
166
137
|
- lib/schema_plus.rb
|
167
138
|
- lib/schema_plus/active_record/base.rb
|