ros-apartment 2.3.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE.md +21 -0
  3. data/.gitignore +15 -0
  4. data/.pryrc +3 -0
  5. data/.rspec +4 -0
  6. data/.travis.yml +65 -0
  7. data/Appraisals +71 -0
  8. data/Gemfile +10 -0
  9. data/Guardfile +24 -0
  10. data/HISTORY.md +398 -0
  11. data/README.md +576 -0
  12. data/Rakefile +128 -0
  13. data/TODO.md +51 -0
  14. data/apartment.gemspec +46 -0
  15. data/docker-compose.yml +33 -0
  16. data/gemfiles/rails_4_2.gemfile +23 -0
  17. data/gemfiles/rails_5_0.gemfile +22 -0
  18. data/gemfiles/rails_5_1.gemfile +22 -0
  19. data/gemfiles/rails_5_2.gemfile +18 -0
  20. data/gemfiles/rails_6_0.gemfile +22 -0
  21. data/gemfiles/rails_master.gemfile +22 -0
  22. data/lib/apartment.rb +118 -0
  23. data/lib/apartment/adapters/abstract_adapter.rb +269 -0
  24. data/lib/apartment/adapters/abstract_jdbc_adapter.rb +18 -0
  25. data/lib/apartment/adapters/jdbc_mysql_adapter.rb +19 -0
  26. data/lib/apartment/adapters/jdbc_postgresql_adapter.rb +56 -0
  27. data/lib/apartment/adapters/mysql2_adapter.rb +71 -0
  28. data/lib/apartment/adapters/postgis_adapter.rb +12 -0
  29. data/lib/apartment/adapters/postgresql_adapter.rb +236 -0
  30. data/lib/apartment/adapters/sqlite3_adapter.rb +56 -0
  31. data/lib/apartment/console.rb +12 -0
  32. data/lib/apartment/deprecation.rb +10 -0
  33. data/lib/apartment/elevators/domain.rb +22 -0
  34. data/lib/apartment/elevators/first_subdomain.rb +17 -0
  35. data/lib/apartment/elevators/generic.rb +32 -0
  36. data/lib/apartment/elevators/host.rb +30 -0
  37. data/lib/apartment/elevators/host_hash.rb +22 -0
  38. data/lib/apartment/elevators/subdomain.rb +62 -0
  39. data/lib/apartment/migrator.rb +51 -0
  40. data/lib/apartment/railtie.rb +67 -0
  41. data/lib/apartment/reloader.rb +21 -0
  42. data/lib/apartment/tasks/enhancements.rb +57 -0
  43. data/lib/apartment/tenant.rb +66 -0
  44. data/lib/apartment/version.rb +3 -0
  45. data/lib/generators/apartment/install/USAGE +5 -0
  46. data/lib/generators/apartment/install/install_generator.rb +10 -0
  47. data/lib/generators/apartment/install/templates/apartment.rb +109 -0
  48. data/lib/tasks/apartment.rake +145 -0
  49. data/spec/adapters/jdbc_mysql_adapter_spec.rb +19 -0
  50. data/spec/adapters/jdbc_postgresql_adapter_spec.rb +41 -0
  51. data/spec/adapters/mysql2_adapter_spec.rb +59 -0
  52. data/spec/adapters/postgresql_adapter_spec.rb +61 -0
  53. data/spec/adapters/sqlite3_adapter_spec.rb +83 -0
  54. data/spec/apartment_spec.rb +11 -0
  55. data/spec/config/database.yml.sample +49 -0
  56. data/spec/dummy/Rakefile +7 -0
  57. data/spec/dummy/app/controllers/application_controller.rb +6 -0
  58. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  59. data/spec/dummy/app/models/company.rb +3 -0
  60. data/spec/dummy/app/models/user.rb +3 -0
  61. data/spec/dummy/app/views/application/index.html.erb +1 -0
  62. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  63. data/spec/dummy/config.ru +4 -0
  64. data/spec/dummy/config/application.rb +49 -0
  65. data/spec/dummy/config/boot.rb +11 -0
  66. data/spec/dummy/config/database.yml.sample +44 -0
  67. data/spec/dummy/config/environment.rb +5 -0
  68. data/spec/dummy/config/environments/development.rb +28 -0
  69. data/spec/dummy/config/environments/production.rb +51 -0
  70. data/spec/dummy/config/environments/test.rb +34 -0
  71. data/spec/dummy/config/initializers/apartment.rb +4 -0
  72. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  73. data/spec/dummy/config/initializers/inflections.rb +10 -0
  74. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  75. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  76. data/spec/dummy/config/initializers/session_store.rb +8 -0
  77. data/spec/dummy/config/locales/en.yml +5 -0
  78. data/spec/dummy/config/routes.rb +3 -0
  79. data/spec/dummy/db/migrate/20110613152810_create_dummy_models.rb +39 -0
  80. data/spec/dummy/db/migrate/20111202022214_create_table_books.rb +14 -0
  81. data/spec/dummy/db/migrate/20180415260934_create_public_tokens.rb +13 -0
  82. data/spec/dummy/db/schema.rb +55 -0
  83. data/spec/dummy/db/seeds.rb +5 -0
  84. data/spec/dummy/db/seeds/import.rb +5 -0
  85. data/spec/dummy/public/404.html +26 -0
  86. data/spec/dummy/public/422.html +26 -0
  87. data/spec/dummy/public/500.html +26 -0
  88. data/spec/dummy/public/favicon.ico +0 -0
  89. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  90. data/spec/dummy/script/rails +6 -0
  91. data/spec/dummy_engine/.gitignore +8 -0
  92. data/spec/dummy_engine/Gemfile +15 -0
  93. data/spec/dummy_engine/Rakefile +34 -0
  94. data/spec/dummy_engine/bin/rails +12 -0
  95. data/spec/dummy_engine/config/initializers/apartment.rb +51 -0
  96. data/spec/dummy_engine/dummy_engine.gemspec +24 -0
  97. data/spec/dummy_engine/lib/dummy_engine.rb +4 -0
  98. data/spec/dummy_engine/lib/dummy_engine/engine.rb +4 -0
  99. data/spec/dummy_engine/lib/dummy_engine/version.rb +3 -0
  100. data/spec/dummy_engine/test/dummy/Rakefile +6 -0
  101. data/spec/dummy_engine/test/dummy/config.ru +4 -0
  102. data/spec/dummy_engine/test/dummy/config/application.rb +22 -0
  103. data/spec/dummy_engine/test/dummy/config/boot.rb +5 -0
  104. data/spec/dummy_engine/test/dummy/config/database.yml +25 -0
  105. data/spec/dummy_engine/test/dummy/config/environment.rb +5 -0
  106. data/spec/dummy_engine/test/dummy/config/environments/development.rb +37 -0
  107. data/spec/dummy_engine/test/dummy/config/environments/production.rb +78 -0
  108. data/spec/dummy_engine/test/dummy/config/environments/test.rb +39 -0
  109. data/spec/dummy_engine/test/dummy/config/initializers/assets.rb +8 -0
  110. data/spec/dummy_engine/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  111. data/spec/dummy_engine/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  112. data/spec/dummy_engine/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  113. data/spec/dummy_engine/test/dummy/config/initializers/inflections.rb +16 -0
  114. data/spec/dummy_engine/test/dummy/config/initializers/mime_types.rb +4 -0
  115. data/spec/dummy_engine/test/dummy/config/initializers/session_store.rb +3 -0
  116. data/spec/dummy_engine/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  117. data/spec/dummy_engine/test/dummy/config/locales/en.yml +23 -0
  118. data/spec/dummy_engine/test/dummy/config/routes.rb +56 -0
  119. data/spec/dummy_engine/test/dummy/config/secrets.yml +22 -0
  120. data/spec/examples/connection_adapter_examples.rb +42 -0
  121. data/spec/examples/generic_adapter_custom_configuration_example.rb +95 -0
  122. data/spec/examples/generic_adapter_examples.rb +163 -0
  123. data/spec/examples/schema_adapter_examples.rb +234 -0
  124. data/spec/integration/apartment_rake_integration_spec.rb +107 -0
  125. data/spec/integration/query_caching_spec.rb +81 -0
  126. data/spec/integration/use_within_an_engine_spec.rb +28 -0
  127. data/spec/schemas/v1.rb +16 -0
  128. data/spec/schemas/v2.rb +43 -0
  129. data/spec/schemas/v3.rb +49 -0
  130. data/spec/spec_helper.rb +61 -0
  131. data/spec/support/apartment_helpers.rb +43 -0
  132. data/spec/support/capybara_sessions.rb +15 -0
  133. data/spec/support/config.rb +10 -0
  134. data/spec/support/contexts.rb +52 -0
  135. data/spec/support/requirements.rb +35 -0
  136. data/spec/support/setup.rb +46 -0
  137. data/spec/tasks/apartment_rake_spec.rb +129 -0
  138. data/spec/tenant_spec.rb +190 -0
  139. data/spec/unit/config_spec.rb +112 -0
  140. data/spec/unit/elevators/domain_spec.rb +32 -0
  141. data/spec/unit/elevators/first_subdomain_spec.rb +24 -0
  142. data/spec/unit/elevators/generic_spec.rb +54 -0
  143. data/spec/unit/elevators/host_hash_spec.rb +32 -0
  144. data/spec/unit/elevators/host_spec.rb +89 -0
  145. data/spec/unit/elevators/subdomain_spec.rb +76 -0
  146. data/spec/unit/migrator_spec.rb +77 -0
  147. data/spec/unit/reloader_spec.rb +24 -0
  148. metadata +487 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e74c096e694174f974b93838c9aefec3722a87829cb10720ec8ff42cd8b279dc
4
+ data.tar.gz: 0b65c080374f5162585da3d85fafecddb51c5fbe773aadf4f8210423d64fed81
5
+ SHA512:
6
+ metadata.gz: 4644a38c447a86a7a1c759cc80bf99cfded7fef3527045696a24871698fc3e070b4252e18c9fef97a1ab57a6b15234bc6ed48aa177e041dad432b1b4498a8f3e
7
+ data.tar.gz: bc2679a0ced346ad61aa12d06bec90b9b8a879855fa35a8ce195c05eb9ed4775f2204394062dea8913e214f666b47ccc7463512f010be580021ed1868549960f
@@ -0,0 +1,21 @@
1
+ ## Steps to reproduce
2
+
3
+ ## Expected behavior
4
+
5
+ ## Actual behavior
6
+
7
+ ## System configuration
8
+
9
+ <!-- Please let us know as far as you can. -->
10
+
11
+ * Database: (Tell us what database and its version you use.)
12
+
13
+ * Apartment version:
14
+
15
+ * Apartment config (in `config/initializers/apartment.rb` or so):
16
+
17
+ * `use_schemas`: (`true` or `false`)
18
+
19
+ * Rails (or ActiveRecord) version:
20
+
21
+ * Ruby version:
@@ -0,0 +1,15 @@
1
+ *.gem
2
+ .bundle
3
+ *.lock
4
+ gemfiles/*.lock
5
+ gemfiles/vendor
6
+ pkg/*
7
+ *.log
8
+ .idea
9
+ *.sw[pno]
10
+ spec/config/database.yml
11
+ spec/dummy/config/database.yml
12
+ cookbooks
13
+ tmp
14
+ spec/dummy/db/*.sqlite3
15
+ .DS_Store
data/.pryrc ADDED
@@ -0,0 +1,3 @@
1
+ if defined?(Rails) && Rails.env
2
+ extend Rails::ConsoleMethods
3
+ end
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format documentation
3
+ --tty
4
+ --order random
@@ -0,0 +1,65 @@
1
+ os: linux
2
+
3
+ language: ruby
4
+ services:
5
+ - docker
6
+ rvm:
7
+ - jruby-9.1.17.0
8
+ - 2.1.9
9
+ - 2.2.9
10
+ - 2.3.6
11
+ - 2.4.3
12
+ - 2.5.0
13
+ - 2.6.2
14
+ - ruby-head
15
+ gemfile:
16
+ - gemfiles/rails_4_2.gemfile
17
+ - gemfiles/rails_5_0.gemfile
18
+ - gemfiles/rails_5_1.gemfile
19
+ - gemfiles/rails_5_2.gemfile
20
+ - gemfiles/rails_6_0.gemfile
21
+ - gemfiles/rails_master.gemfile
22
+ bundler_args: --without local
23
+ before_install:
24
+ - sudo /etc/init.d/mysql stop
25
+ - sudo /etc/init.d/postgresql stop
26
+ - docker-compose up -d
27
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
28
+ - gem uninstall bundler -v '>= 2' -x || true
29
+ - gem install bundler -v '< 2'
30
+ env:
31
+ RUBY_GC_MALLOC_LIMIT: 90000000
32
+ RUBY_GC_HEAP_FREE_SLOTS: 200000
33
+ jobs:
34
+ allow_failures:
35
+ - rvm: ruby-head
36
+ - gemfile: gemfiles/rails_master.gemfile
37
+ - rvm: jruby-9.1.17.0
38
+ gemfile: gemfiles/rails_5_0.gemfile
39
+ exclude:
40
+ - rvm: 2.1.9
41
+ gemfile: gemfiles/rails_5_0.gemfile
42
+ - rvm: 2.1.9
43
+ gemfile: gemfiles/rails_5_1.gemfile
44
+ - rvm: 2.1.9
45
+ gemfile: gemfiles/rails_5_2.gemfile
46
+ - rvm: 2.1.9
47
+ gemfile: gemfiles/rails_6_0.gemfile
48
+ - rvm: 2.1.9
49
+ gemfile: gemfiles/rails_master.gemfile
50
+ - rvm: 2.2.9
51
+ gemfile: gemfiles/rails_6_0.gemfile
52
+ - rvm: 2.3.6
53
+ gemfile: gemfiles/rails_6_0.gemfile
54
+ - rvm: 2.4.3
55
+ gemfile: gemfiles/rails_6_0.gemfile
56
+ - rvm: jruby-9.1.17.0
57
+ gemfile: gemfiles/rails_5_1.gemfile
58
+ - rvm: jruby-9.1.17.0
59
+ gemfile: gemfiles/rails_5_2.gemfile
60
+ - rvm: jruby-9.1.17.0
61
+ gemfile: gemfiles/rails_6_0.gemfile
62
+ - rvm: jruby-9.1.17.0
63
+ gemfile: gemfiles/rails_master.gemfile
64
+ fast_finish: true
65
+ cache: bundler
@@ -0,0 +1,71 @@
1
+ appraise "rails-4-2" do
2
+ gem "rails", "~> 4.2.0"
3
+ platforms :ruby do
4
+ gem "pg", "< 1.0.0"
5
+ gem "mysql2", "~> 0.4.0"
6
+ end
7
+ platforms :jruby do
8
+ gem 'activerecord-jdbc-adapter', '~> 1.3'
9
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3'
10
+ gem 'activerecord-jdbcmysql-adapter', '~> 1.3'
11
+ end
12
+ end
13
+
14
+ appraise "rails-5-0" do
15
+ gem "rails", "~> 5.0.0"
16
+ platforms :ruby do
17
+ gem "pg", "< 1.0.0"
18
+ end
19
+ platforms :jruby do
20
+ gem 'activerecord-jdbc-adapter', '~> 50.0'
21
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 50.0'
22
+ gem 'activerecord-jdbcmysql-adapter', '~> 50.0'
23
+ end
24
+ end
25
+
26
+ appraise "rails-5-1" do
27
+ gem "rails", "~> 5.1.0"
28
+ platforms :ruby do
29
+ gem "pg", "< 1.0.0"
30
+ end
31
+ platforms :jruby do
32
+ gem 'activerecord-jdbc-adapter', '~> 51.0'
33
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 51.0'
34
+ gem 'activerecord-jdbcmysql-adapter', '~> 51.0'
35
+ end
36
+ end
37
+
38
+ appraise "rails-5-2" do
39
+ gem "rails", "~> 5.2.0"
40
+ platforms :jruby do
41
+ gem 'activerecord-jdbc-adapter', '~> 52.0'
42
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 52.0'
43
+ gem 'activerecord-jdbcmysql-adapter', '~> 52.0'
44
+ end
45
+ end
46
+
47
+
48
+ appraise "rails-6-0" do
49
+ gem "rails", "~> 6.0.0.rc1"
50
+ platforms :ruby do
51
+ gem 'sqlite3', '~> 1.4'
52
+ end
53
+ platforms :jruby do
54
+ gem 'activerecord-jdbc-adapter', '~> 60.0.rc1'
55
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 60.0.rc1'
56
+ gem 'activerecord-jdbcmysql-adapter', '~> 60.0.rc1'
57
+ end
58
+ end
59
+
60
+
61
+ appraise "rails-master" do
62
+ gem "rails", git: 'https://github.com/rails/rails.git'
63
+ platforms :ruby do
64
+ gem 'sqlite3', '~> 1.4'
65
+ end
66
+ platforms :jruby do
67
+ gem 'activerecord-jdbc-adapter', '~> 52.0'
68
+ gem 'activerecord-jdbcpostgresql-adapter', '~> 52.0'
69
+ gem 'activerecord-jdbcmysql-adapter', '~> 52.0'
70
+ end
71
+ end
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'rails', '>= 3.1.2'
6
+
7
+ group :local do
8
+ gem 'pry'
9
+ gem 'guard-rspec', '~> 4.2'
10
+ end
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/apartment/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
7
+ watch(%r{^lib/apartment/(.+)\.rb$}) { |m| "spec/integration/#{m[1]}_spec.rb" }
8
+ watch('spec/spec_helper.rb') { "spec" }
9
+
10
+ # # Rails example
11
+ # watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
12
+ # watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
13
+ # watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
14
+ # watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
15
+ # watch('config/routes.rb') { "spec/routing" }
16
+ # watch('app/controllers/application_controller.rb') { "spec/controllers" }
17
+
18
+ # # Capybara features specs
19
+ # watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
20
+
21
+ # # Turnip features and steps
22
+ # watch(%r{^spec/acceptance/(.+)\.feature$})
23
+ # watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
24
+ end
@@ -0,0 +1,398 @@
1
+ # 2.2.1
2
+ * June 19, 2019
3
+
4
+ ## Added
5
+ - #566: IGNORE_EMPTY_TENANTS environment variable to ignore empty tenants
6
+ warning. [Pysis868]
7
+
8
+ ## Fixed
9
+ - #586: Ignore `CREATE SCHEMA public` statement in pg dump [artemave]
10
+ - #549: Fix Postgres schema creation with dump SQL [ancorcruz]
11
+
12
+ # 2.2.0
13
+ * April 14, 2018
14
+
15
+ ## Added
16
+ - #523: Add Rails 5.2 support [IngusSkaistkalns]
17
+ - #504: Test against Ruby 2.5.0 [ahorek]
18
+ - #528: Test against Rails 5.2 [meganemura]
19
+
20
+ ## Removed
21
+ - #504: Remove Rails 4.0/4.1 support [ahorek]
22
+ - #545: Stop supporting for JRuby + Rails 5.0 [meganemura]
23
+
24
+ ## Fixed
25
+ - #537: Fix PostgresqlSchemaFromSqlAdapter for newer PostgreSQL [shterrett]
26
+ - #532: Issue is reported by [aldrinmartoq]
27
+ - #519: Fix exception when main database doesn't exist [mayeco]
28
+
29
+ ## Changed
30
+ - #514: Fix typo [menorval]
31
+
32
+ # 2.1.0
33
+ * December 15, 2017
34
+
35
+ - Add `parallel_migration_threads` configuration option for running migrations
36
+ in parallel [ryanbrunner]
37
+ - Drop Ruby 2.0.0 support [meganemura]
38
+ - ignore_private when parsing subdomains with PublicSuffix [michiomochi]
39
+ - Ignore row_security statements in psql dumps for backward compatibility
40
+ [meganemura]
41
+ - "Host" elevator [shrmnk]
42
+ - Enhance db:drop task to act on all tenants [kuzukuzu]
43
+
44
+ # 2.0.0
45
+ * July 26, 2017
46
+
47
+ - Raise FileNotFound rather than abort when loading files [meganemura]
48
+ - Add 5.1 support with fixes for deprecations [meganemura]
49
+ - Fix tests for 5.x and a host of dev-friendly improvements [meganemura]
50
+ - Keep query cache config after switching databases [fernandomm]
51
+ - Pass constants not strings to middleware stack (Rails 5) [tzabaman]
52
+ - Remove deprecations from 1.0.0 [caironoleto]
53
+ - Replace `tld_length` configuration option with PublicSuffix gem for the
54
+ subdomain elevator [humancopy]
55
+ - Pass full config to create_database to allow :encoding/:collation/etc
56
+ [kakipo]
57
+ - Don't retain a connection during initialization [mikecmpbll]
58
+ - Fix database name escaping in drop_command [mikecmpbll]
59
+ - Skip initialization for assets:clean and assets:precompile tasks
60
+ [frank-west-iii]
61
+
62
+ # 1.2.0
63
+ * July 28, 2016
64
+
65
+ - Official Rails 5 support
66
+
67
+ # 1.1.0
68
+ * May 26, 2016
69
+
70
+ - Reset tenant after each request
71
+ - [Support callbacks](https://github.com/influitive/apartment/commit/ff9c9d092a781026502f5997c0bbedcb5748bc83) on switch [cbeer]
72
+ - Preliminary support for [separate database hosts](https://github.com/influitive/apartment/commit/abdffbf8cd9fba87243f16c86390da13e318ee1f) [apneadiving]
73
+
74
+ # 1.0.2
75
+ * July 2, 2015
76
+
77
+ - Fix pg_dump env vars - pull/208 [MitinPavel]
78
+ - Allow custom seed data file - pull/234 [typeoneerror]
79
+
80
+ # 1.0.1
81
+ * April 28, 2015
82
+
83
+ - Fix `Apartment::Deprecation` which was rescuing all exceptions
84
+
85
+ # 1.0.0
86
+ * Feb 3, 2015
87
+
88
+ - [BREAKING CHANGE] `Apartment::Tenant.process` is deprecated in favour of `Apartment::Tenant.switch`
89
+ - [BREAKING CHANGE] `Apartment::Tenant.switch` without a block is deprecated in favour of `Apartment::Tenant.switch!`
90
+ - Raise proper `TenantNotFound`, `TenantExists` exceptions
91
+ - Deprecate old `SchemaNotFound`, `DatabaseNotFound` exceptions
92
+
93
+ # 0.26.1
94
+ * Jan 13, 2015
95
+
96
+ - Fixed [schema quoting bug](https://github.com/influitive/apartment/issues/198#issuecomment-69782651) [jonsgreen]
97
+
98
+ # 0.26.0
99
+ * Jan 5, 2015
100
+
101
+ - Rails 4.2 support
102
+
103
+ # 0.25.2
104
+ * Sept 8, 2014
105
+
106
+ - Heroku fix on `assets:precompile` - pull/169 [rabbitt]
107
+
108
+ # 0.25.1
109
+ * July 17, 2014
110
+
111
+ - Fixed a few vestiges of Apartment::Database
112
+
113
+ # 0.25.0
114
+ * July 3, 2014
115
+
116
+ - [BREAKING CHANGE] - `Apartment::Database` is not deprecated in favour of
117
+ `Apartment::Tenant`
118
+ - ActiveRecord (and Rails) 4.1 now supported
119
+ - A new sql based adapter that dumps the schema using sql
120
+
121
+ # 0.24.3
122
+ * March 5, 2014
123
+
124
+ - Rake enhancements weren't removed from the generator template
125
+
126
+ # 0.24.2
127
+ * February 24, 2014
128
+
129
+ - Better warnings if `apartment:migrate` is run
130
+
131
+ # 0.24.1
132
+ * February 21, 2014
133
+
134
+ - requiring `apartment/tasks/enhancements` in an initializer doesn't work
135
+ - One can disable tenant migrations using `Apartment.db_migrate_tenants = false` in the Rakefile
136
+
137
+ # 0.24
138
+ * February 21, 2014 (In honour of the Women's Gold Medal in Hockey at Sochi)
139
+
140
+ - [BREAKING CHANGE] `apartment:migrate` task no longer depends on `db:migrate`
141
+ - Instead, you can `require 'apartment/tasks/enhancements'` in your Apartment initializer
142
+ - This will enhance `rake db:migrate` to also run `apartment:migrate`
143
+ - You can now forget about ever running `apartment:migrate` again
144
+ - Numerous deprecations for things referencing the word 'database'
145
+ - This is an ongoing effort to completely replace 'database' with 'tenant' as a better abstraction
146
+ - Note the obvious `Apartment::Database` still exists but will hopefully become `Apartment::Tenant` soon
147
+
148
+ # 0.23.2
149
+ * January 9, 2014
150
+
151
+ - Increased visibility of #parse_database_name warning
152
+
153
+ # 0.23.1
154
+ * January 8, 2014
155
+
156
+ - Schema adapters now initialize with default and persistent schemas
157
+ - Deprecated Apartment::Elevators#parse_database_name
158
+
159
+ # 0.23.0
160
+ * August 21, 2013
161
+
162
+ - Subdomain Elevator now allows for exclusions
163
+ - Delayed::Job has been completely removed
164
+
165
+ # 0.22.1
166
+ * August 21, 2013
167
+
168
+ - Fix bug where if your ruby process importing the database schema is run
169
+ from a directory other than the app root, Apartment wouldn't know what
170
+ schema_migrations to insert into the database (Rails only)
171
+
172
+ # 0.22.0
173
+ * June 9, 2013
174
+
175
+ - Numerous bug fixes:
176
+ - Mysql reset could connect to wrong database [eric88]
177
+ - Postgresql schema names weren't quoted properly [gdott9]
178
+ - Fixed error message on SchemaNotFound in `process`
179
+ - HostHash elevator allows mapping host based on hash contents [gdott9]
180
+ - Official Sidekiq support with the [apartment-sidekiq gem](https://github.com/influitive/apartment-sidekiq)
181
+
182
+
183
+ # 0.21.1
184
+ * May 31, 2013
185
+
186
+ - Clearing the AR::QueryCache after switching databases.
187
+ - Fixes issue with stale model being loaded for schema adapters
188
+
189
+ # 0.21.0
190
+ * April 24, 2013
191
+
192
+ - JDBC support!! [PetrolMan]
193
+
194
+ # 0.20.0
195
+ * Feb 6, 2013
196
+
197
+ - Mysql now has a 'schema like' option to perform like Postgresql (default)
198
+ - This should be significantly more performant than using connections
199
+ - Psych is now supported for Delayed::Job yaml parsing
200
+
201
+ # 0.19.2
202
+ * Jan 30, 2013
203
+
204
+ - Database schema file can now be set manually or skipped altogether
205
+
206
+ # 0.19.1
207
+ * Jan 30, 2013
208
+
209
+ - Allow schema.rb import file to be specified in config or skip schema.rb import altogether
210
+
211
+ # 0.19.0
212
+ * Dec 29, 2012
213
+
214
+ - Apartment is now threadsafe
215
+ - New postgis adapter [zonpantli]
216
+ - Removed ActionDispatch dependency for use with Rack apps (regression)
217
+
218
+ # 0.18.0
219
+ * Nov 27, 2012
220
+
221
+ - Added `append_environment` config option [virtualstaticvoid]
222
+ - Cleaned up the readme and generator documentation
223
+ - Added `connection_class` config option [smashtank]
224
+ - Fixed a [bug](https://github.com/influitive/apartment/issues/17#issuecomment-10758327) in pg adapter when missing schema
225
+
226
+ # 0.17.1
227
+ * Oct 30, 2012
228
+
229
+ - Fixed a bug where switching to an unknown db in mysql2 would crash the app [Frodotus]
230
+
231
+ # 0.17.0
232
+ * Sept 26, 2012
233
+
234
+ - Apartment has [a new home!](https://github.com/influitive/apartment)
235
+ - Support Sidekiq hooks to switch dbs [maedhr]
236
+ - Allow VERSION to be used on apartment:migrate [Bhavin Kamani]
237
+
238
+ # 0.16.0
239
+ * June 1, 2012
240
+
241
+ - Apartment now supports a default_schema to be set, rather than relying on ActiveRecord's default schema_search_path
242
+ - Additional schemas can always be maintained in the schema_search_path by configuring persistent_schemas [ryanbrunner]
243
+ - This means Hstore is officially supported!!
244
+ - There is now a full domain based elevator to switch dbs based on the whole domain [lcowell]
245
+ - There is now a generic elevator that takes a Proc to switch dbs based on the return value of that proc.
246
+
247
+ # 0.15.0
248
+ * March 18, 2012
249
+
250
+ - Remove Rails dependency, Apartment can now be used with any Rack based framework using ActiveRecord
251
+
252
+ # 0.14.4
253
+ * March 8, 2012
254
+
255
+ - Delayed::Job Hooks now return to the previous database, rather than resetting
256
+
257
+ # 0.14.3
258
+ * Feb 21, 2012
259
+
260
+ - Fix yaml serialization of non DJ models
261
+
262
+ # 0.14.2
263
+ * Feb 21, 2012
264
+
265
+ - Fix Delayed::Job yaml encoding with Rails > 3.0.x
266
+
267
+ # 0.14.1
268
+ * Dec 13, 2011
269
+
270
+ - Fix ActionDispatch::Callbacks deprecation warnings
271
+
272
+ # 0.14.0
273
+ * Dec 13, 2011
274
+
275
+ - Rails 3.1 Support
276
+
277
+ # 0.13.1
278
+ * Nov 8, 2011
279
+
280
+ - Reset prepared statement cache for rails 3.1.1 before switching dbs when using postgresql schemas
281
+ - Only necessary until the next release which will be more schema aware
282
+
283
+ # 0.13.0
284
+ * Oct 25, 2011
285
+
286
+ - `process` will now rescue with reset if the previous schema/db is no longer available
287
+ - `create` now takes an optional block which allows you to process within the newly created db
288
+ - Fixed Rails version >= 3.0.10 and < 3.1 because there have been significant testing problems with 3.1, next version will hopefully fix this
289
+
290
+ # 0.12.0
291
+ * Oct 4, 2011
292
+
293
+ - Added a `drop` method for removing databases/schemas
294
+ - Refactored abstract adapter to further remove duplication in concrete implementations
295
+ - Excluded models now take string references so they are properly reloaded in development
296
+ - Better silencing of `schema.rb` loading using `verbose` flag
297
+
298
+ # 0.11.1
299
+ * Sep 22, 2011
300
+
301
+ - Better use of Railties for initializing apartment
302
+ - The following changes were necessary as I haven't figured out how to properly hook into Rails reloading
303
+ - Added reloader middleware in development to init Apartment on each request
304
+ - Override `reload!` in console to also init Apartment
305
+
306
+ # 0.11.0
307
+ * Sep 20, 2011
308
+
309
+ - Excluded models no longer use a different connection when using postgresql schemas. Instead their table_name is prefixed with `public.`
310
+
311
+ # 0.10.3
312
+ * Sep 20, 2011
313
+
314
+ - Fix improper raising of exceptions on create and reset
315
+
316
+ # 0.10.2
317
+ * Sep 15, 2011
318
+
319
+ - Remove all the annoying logging for loading db schema and seeding on create
320
+
321
+ # 0.10.1
322
+ * Aug 11, 2011
323
+
324
+ - Fixed bug in DJ where new objects (that hadn't been pulled from the db) didn't have the proper database assigned
325
+
326
+ # 0.10.0
327
+ * July 29, 2011
328
+
329
+ - Added better support for Delayed Job
330
+ - New config option that enables Delayed Job wrappers
331
+ - Note that DJ support uses a work-around in order to get queues stored in the public schema, not sure why it doesn't work out of the box, will look into it, until then, see documentation on queue'ng jobs
332
+
333
+ # 0.9.2
334
+ * July 4, 2011
335
+
336
+ - Migrations now run associated rails migration fully, fixes schema.rb not being reloaded after migrations
337
+
338
+ # 0.9.1
339
+ * June 24, 2011
340
+
341
+ - Hooks now take the payload object as an argument to fetch the proper db for DJ hooks
342
+
343
+ # 0.9.0
344
+ * June 23, 2011
345
+
346
+ - Added module to provide delayed job hooks
347
+
348
+ # 0.8.0
349
+ * June 23, 2011
350
+
351
+ - Added #current_database which will return the current database (or schema) name
352
+
353
+ # 0.7.0
354
+ * June 22, 2011
355
+
356
+ - Added apartment:seed rake task for seeding all dbs
357
+
358
+ # 0.6.0
359
+ * June 21, 2011
360
+
361
+ - Added #process to connect to new db, perform operations, then ensure a reset
362
+
363
+ # 0.5.1
364
+ * June 21, 2011
365
+
366
+ - Fixed db migrate up/down/rollback
367
+ - added db:redo
368
+
369
+ # 0.5.0
370
+ * June 20, 2011
371
+
372
+ - Added the concept of an "Elevator", a rack based strategy for db switching
373
+ - Added the Subdomain Elevator middleware to enabled db switching based on subdomain
374
+
375
+ # 0.4.0
376
+ * June 14, 2011
377
+
378
+ - Added `configure` method on Apartment instead of using yml file, allows for dynamic setting of db names to migrate for rake task
379
+ - Added `seed_after_create` config option to import seed data to new db on create
380
+
381
+ # 0.3.0
382
+ * June 10, 2011
383
+
384
+ - Added full support for database migration
385
+ - Added in method to establish new connection for excluded models on startup rather than on each switch
386
+
387
+ # 0.2.0
388
+ * June 6, 2011 *
389
+
390
+ - Refactor to use more rails/active_support functionality
391
+ - Refactor config to lazily load apartment.yml if exists
392
+ - Remove OStruct and just use hashes for fetching methods
393
+ - Added schema load on create instead of migrating from scratch
394
+
395
+ # 0.1.3
396
+ * March 30, 2011 *
397
+
398
+ - Original pass from Ryan