ar-octopus 0.0.16 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -29,7 +29,7 @@ begin
29
29
  gem.authors = ["Thiago Pradi", "Mike Perham", "Amit Agarwal"]
30
30
  gem.add_development_dependency "rspec", ">= 1.2.9"
31
31
  gem.add_dependency('activerecord', '>= 3.0.0beta')
32
- gem.version = "0.0.16"
32
+ gem.version = "0.0.18"
33
33
  end
34
34
  Jeweler::GemcutterTasks.new
35
35
  rescue LoadError
@@ -91,6 +91,8 @@ namespace :db do
91
91
  require "database_connection"
92
92
  require "octopus"
93
93
  [:master, :brazil, :canada, :russia, :alone_shard, :postgresql_shard].each do |shard_symbol|
94
+ ActiveRecord::Base.using(shard_symbol).connection.initialize_schema_migrations_table()
95
+
94
96
  ActiveRecord::Base.using(shard_symbol).connection.create_table(:users) do |u|
95
97
  u.string :name
96
98
  u.integer :number
@@ -110,11 +112,7 @@ namespace :db do
110
112
  u.string :name
111
113
  u.integer :client_id
112
114
  end
113
-
114
- ActiveRecord::Base.using(shard_symbol).connection.create_table(:schema_migrations) do |u|
115
- u.string :version, :unique => true, :null => false
116
- end
117
-
115
+
118
116
  ActiveRecord::Base.using(shard_symbol).connection.create_table(:computers) do |u|
119
117
  u.string :name
120
118
  end
data/ar-octopus.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ar-octopus}
8
- s.version = "0.0.16"
8
+ s.version = "0.0.18"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Thiago Pradi", "Mike Perham", "Amit Agarwal"]
12
- s.date = %q{2010-07-02}
12
+ s.date = %q{2010-07-05}
13
13
  s.description = %q{This gem allows you to use sharded databases with ActiveRecord. this also provides a interface for replication and for running migrations with multiples shards.}
14
14
  s.email = %q{tchandy@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -1,12 +1,18 @@
1
1
  module Octopus::Migration
2
2
  def using(*args, &block)
3
+ args.each do |shard|
4
+ if !ActiveRecord::Base.using(shard).connection.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name())
5
+ ActiveRecord::Base.using(shard).connection.initialize_schema_migrations_table
6
+ end
7
+ end
8
+
3
9
  if args.size == 1
4
10
  self.connection().block = true
5
11
  self.connection().current_shard = args.first
6
12
  else
7
13
  self.connection().current_shard = args
8
14
  end
9
-
15
+
10
16
  yield if block_given?
11
17
 
12
18
  return self
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar-octopus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 16
10
- version: 0.0.16
9
+ - 18
10
+ version: 0.0.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thiago Pradi
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-07-02 00:00:00 -03:00
20
+ date: 2010-07-05 00:00:00 -03:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency