ros-apartment 2.11.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +256 -53
- data/.ruby-version +1 -1
- data/Appraisals +22 -30
- data/CHANGELOG.md +5 -3
- data/README.md +4 -5
- data/Rakefile +3 -17
- data/lib/apartment/active_record/connection_handling.rb +18 -7
- data/lib/apartment/active_record/postgresql_adapter.rb +4 -0
- data/lib/apartment/active_record/schema_migration.rb +1 -1
- data/lib/apartment/log_subscriber.rb +21 -9
- data/lib/apartment/migrator.rb +3 -21
- data/lib/apartment/railtie.rb +6 -1
- data/lib/apartment/version.rb +1 -1
- data/lib/apartment.rb +6 -16
- data/ros-apartment.gemspec +14 -11
- metadata +29 -41
- data/.circleci/config.yml +0 -78
- data/.github/ISSUE_TEMPLATE.md +0 -21
- data/.github/workflows/changelog.yml +0 -63
- data/.github/workflows/reviewdog.yml +0 -22
- data/.story_branch.yml +0 -5
- data/HISTORY.md +0 -496
- data/TODO.md +0 -50
- data/docker-compose.yml +0 -33
- data/gemfiles/rails_5_2.gemfile +0 -13
- data/gemfiles/rails_6_0.gemfile +0 -17
- data/gemfiles/rails_6_1.gemfile +0 -17
- data/gemfiles/rails_7_0.gemfile +0 -17
- data/gemfiles/rails_master.gemfile +0 -17
data/HISTORY.md
DELETED
@@ -1,496 +0,0 @@
|
|
1
|
-
# v2.7.1
|
2
|
-
|
3
|
-
**Implemented enhancements:**
|
4
|
-
|
5
|
-
- N/a
|
6
|
-
|
7
|
-
**Fixed bugs:**
|
8
|
-
|
9
|
-
- [Resolves #82] Enhanced db:create breaks plugin compatibility - <https://github.com/rails-on-services/apartment/pull/83>
|
10
|
-
|
11
|
-
**Closed issues:**
|
12
|
-
|
13
|
-
- Update rake version in development
|
14
|
-
- Renamed gemspec to match gem name
|
15
|
-
|
16
|
-
# v2.7.0
|
17
|
-
|
18
|
-
**Implemented enhancements:**
|
19
|
-
|
20
|
-
- [Resolves #70] Rake tasks define methods on main - <https://github.com/rails-on-services/apartment/pull/75>
|
21
|
-
- Add database and schema to active record log. Configurable, defaults to false to keep current behavior - <https://github.com/rails-on-services/apartment/pull/55>
|
22
|
-
|
23
|
-
**Fixed bugs:**
|
24
|
-
|
25
|
-
- [Fixes #61] Fix database create in mysql - <https://github.com/rails-on-services/apartment/pull/76>
|
26
|
-
|
27
|
-
**Closed issues:**
|
28
|
-
|
29
|
-
- Remove deprecated tld_length config option: tld_length was removed in influitive#309, this configuration option doesn't have any effect now. - <https://github.com/rails-on-services/apartment/pull/72>
|
30
|
-
- Using [diffend.io proxy](https://diffend.io) to safely check required gems
|
31
|
-
- Added [story branch](https://github.com/story-branch/story_branch) to the configuration
|
32
|
-
- Using travis-ci to run rubocop as well, replacing github actions: github actions do not work in fork's PRs
|
33
|
-
|
34
|
-
# v2.6.1
|
35
|
-
|
36
|
-
**Implemented enhancements:**
|
37
|
-
- N/a
|
38
|
-
|
39
|
-
**Fixed bugs:**
|
40
|
-
- [Resolves influitive#607] Avoid early connection
|
41
|
-
- <https://github.com/rails-on-services/apartment/pull/39>
|
42
|
-
- <https://github.com/rails-on-services/apartment/pull/53>
|
43
|
-
- <https://github.com/rails-on-services/apartment/pull/51>
|
44
|
-
- [Resolves #52] Rake db:setup tries to seed non existent tenant - <https://github.com/rails-on-services/apartment/pull/54>
|
45
|
-
- [Resolves #56] DB rollback uses second last migration - <https://github.com/rails-on-services/apartment/pull/57>
|
46
|
-
|
47
|
-
#**Closed issues:**
|
48
|
-
- N/a
|
49
|
-
|
50
|
-
# v2.6.0
|
51
|
-
|
52
|
-
**Implemented enhancements:**
|
53
|
-
- [Resolves #26] Support configuration for skip checking of schema existence before switching
|
54
|
-
- [Resolves #41] Add tenant info to console boot
|
55
|
-
|
56
|
-
**Fixed bugs:**
|
57
|
-
- [Resolves #37] Custom Console deprecation warning
|
58
|
-
- [Resolves #42] After switch callback not working with nil argument
|
59
|
-
|
60
|
-
#**Closed issues:**
|
61
|
-
- Updated github actions configuration to run on PRs as well
|
62
|
-
|
63
|
-
# v2.5.0
|
64
|
-
|
65
|
-
**Implemented enhancements:**
|
66
|
-
- [Resolves #6] Adds support for rails 6.1
|
67
|
-
- [Resolves #27] Adds support to not rely on set search path, but instead prepends the schema name to the table name when using postgresql with schemas.
|
68
|
-
- [Resolves #35] Cache keys are now tenant dependent
|
69
|
-
|
70
|
-
**Fixed bugs:**
|
71
|
-
- [Resolves #27] Manually switching connection between read and write forgets the schema
|
72
|
-
|
73
|
-
#**Closed issues:**
|
74
|
-
- [Resolves #31] Add latest ruby versions to test matrix
|
75
|
-
|
76
|
-
# v2.4.0
|
77
|
-
|
78
|
-
**Implemented enhancements:**
|
79
|
-
- [Resolves #14] Add console info about tenants and fast switches #17
|
80
|
-
- Skip init if we're running webpacker:compile #18
|
81
|
-
|
82
|
-
**Fixed bugs:**
|
83
|
-
- Don't crash when no database connection is present #16
|
84
|
-
- Rescuing ActiveRecord::NoDatabaseError when dropping tenants #19
|
85
|
-
|
86
|
-
#**Closed issues:**
|
87
|
-
- Rakefile should use mysql port from configuration #5
|
88
|
-
- [Resolves #9] Cleanup rubocop todo #8
|
89
|
-
- Cleanup travis matrix #23
|
90
|
-
|
91
|
-
# v2.3.0
|
92
|
-
* January 3, 2020
|
93
|
-
|
94
|
-
**Implemented enhancements:**
|
95
|
-
- Basic support for rails 6
|
96
|
-
- Released different gem name, with same API as apartment
|
97
|
-
|
98
|
-
# v2.2.1
|
99
|
-
* June 19, 2019
|
100
|
-
|
101
|
-
**Implemented enhancements:**
|
102
|
-
- #566: IGNORE_EMPTY_TENANTS environment variable to ignore empty tenants
|
103
|
-
warning. [Pysis868]
|
104
|
-
|
105
|
-
**Fixed bugs:**
|
106
|
-
- #586: Ignore `CREATE SCHEMA public` statement in pg dump [artemave]
|
107
|
-
- #549: Fix Postgres schema creation with dump SQL [ancorcruz]
|
108
|
-
|
109
|
-
# v2.2.0
|
110
|
-
* April 14, 2018
|
111
|
-
|
112
|
-
**Implemented enhancements:**
|
113
|
-
- #523: Add Rails 5.2 support [IngusSkaistkalns]
|
114
|
-
- #504: Test against Ruby 2.5.0 [ahorek]
|
115
|
-
- #528: Test against Rails 5.2 [meganemura]
|
116
|
-
|
117
|
-
**Removed:**
|
118
|
-
- #504: Remove Rails 4.0/4.1 support [ahorek]
|
119
|
-
- #545: Stop supporting for JRuby + Rails 5.0 [meganemura]
|
120
|
-
|
121
|
-
**Fixed bugs:**
|
122
|
-
- #537: Fix PostgresqlSchemaFromSqlAdapter for newer PostgreSQL [shterrett]
|
123
|
-
- #532: Issue is reported by [aldrinmartoq]
|
124
|
-
- #519: Fix exception when main database doesn't exist [mayeco]
|
125
|
-
|
126
|
-
**Closed issues:**
|
127
|
-
|
128
|
-
- #514: Fix typo [menorval]
|
129
|
-
|
130
|
-
# v2.1.0
|
131
|
-
* December 15, 2017
|
132
|
-
|
133
|
-
- Add `parallel_migration_threads` configuration option for running migrations
|
134
|
-
in parallel [ryanbrunner]
|
135
|
-
- Drop Ruby 2.0.0 support [meganemura]
|
136
|
-
- ignore_private when parsing subdomains with PublicSuffix [michiomochi]
|
137
|
-
- Ignore row_security statements in psql dumps for backward compatibility
|
138
|
-
[meganemura]
|
139
|
-
- "Host" elevator [shrmnk]
|
140
|
-
- Enhance db:drop task to act on all tenants [kuzukuzu]
|
141
|
-
|
142
|
-
# v2.0.0
|
143
|
-
* July 26, 2017
|
144
|
-
|
145
|
-
- Raise FileNotFound rather than abort when loading files [meganemura]
|
146
|
-
- Add 5.1 support with fixes for deprecations [meganemura]
|
147
|
-
- Fix tests for 5.x and a host of dev-friendly improvements [meganemura]
|
148
|
-
- Keep query cache config after switching databases [fernandomm]
|
149
|
-
- Pass constants not strings to middleware stack (Rails 5) [tzabaman]
|
150
|
-
- Remove deprecations from 1.0.0 [caironoleto]
|
151
|
-
- Replace `tld_length` configuration option with PublicSuffix gem for the
|
152
|
-
subdomain elevator [humancopy]
|
153
|
-
- Pass full config to create_database to allow :encoding/:collation/etc
|
154
|
-
[kakipo]
|
155
|
-
- Don't retain a connection during initialization [mikecmpbll]
|
156
|
-
- Fix database name escaping in drop_command [mikecmpbll]
|
157
|
-
- Skip initialization for assets:clean and assets:precompile tasks
|
158
|
-
[frank-west-iii]
|
159
|
-
|
160
|
-
# v1.2.0
|
161
|
-
* July 28, 2016
|
162
|
-
|
163
|
-
- Official Rails 5 support
|
164
|
-
|
165
|
-
# v1.1.0
|
166
|
-
* May 26, 2016
|
167
|
-
|
168
|
-
- Reset tenant after each request
|
169
|
-
- [Support callbacks](https://github.com/influitive/apartment/commit/ff9c9d092a781026502f5997c0bbedcb5748bc83) on switch [cbeer]
|
170
|
-
- Preliminary support for [separate database hosts](https://github.com/influitive/apartment/commit/abdffbf8cd9fba87243f16c86390da13e318ee1f) [apneadiving]
|
171
|
-
|
172
|
-
# v1.0.2
|
173
|
-
* July 2, 2015
|
174
|
-
|
175
|
-
- Fix pg_dump env vars - pull/208 [MitinPavel]
|
176
|
-
- Allow custom seed data file - pull/234 [typeoneerror]
|
177
|
-
|
178
|
-
# v1.0.1
|
179
|
-
* April 28, 2015
|
180
|
-
|
181
|
-
- Fix `Apartment::Deprecation` which was rescuing all exceptions
|
182
|
-
|
183
|
-
# v1.0.0
|
184
|
-
* Feb 3, 2015
|
185
|
-
|
186
|
-
- [BREAKING CHANGE] `Apartment::Tenant.process` is deprecated in favour of `Apartment::Tenant.switch`
|
187
|
-
- [BREAKING CHANGE] `Apartment::Tenant.switch` without a block is deprecated in favour of `Apartment::Tenant.switch!`
|
188
|
-
- Raise proper `TenantNotFound`, `TenantExists` exceptions
|
189
|
-
- Deprecate old `SchemaNotFound`, `DatabaseNotFound` exceptions
|
190
|
-
|
191
|
-
# v0.26.1
|
192
|
-
* Jan 13, 2015
|
193
|
-
|
194
|
-
- Fixed [schema quoting bug](https://github.com/influitive/apartment/issues/198#issuecomment-69782651) [jonsgreen]
|
195
|
-
|
196
|
-
# v0.26.0
|
197
|
-
* Jan 5, 2015
|
198
|
-
|
199
|
-
- Rails 4.2 support
|
200
|
-
|
201
|
-
# v0.25.2
|
202
|
-
* Sept 8, 2014
|
203
|
-
|
204
|
-
- Heroku fix on `assets:precompile` - pull/169 [rabbitt]
|
205
|
-
|
206
|
-
# v0.25.1
|
207
|
-
* July 17, 2014
|
208
|
-
|
209
|
-
- Fixed a few vestiges of Apartment::Database
|
210
|
-
|
211
|
-
# v0.25.0
|
212
|
-
* July 3, 2014
|
213
|
-
|
214
|
-
- [BREAKING CHANGE] - `Apartment::Database` is not deprecated in favour of
|
215
|
-
`Apartment::Tenant`
|
216
|
-
- ActiveRecord (and Rails) 4.1 now supported
|
217
|
-
- A new sql based adapter that dumps the schema using sql
|
218
|
-
|
219
|
-
# v0.24.3
|
220
|
-
* March 5, 2014
|
221
|
-
|
222
|
-
- Rake enhancements weren't removed from the generator template
|
223
|
-
|
224
|
-
# v0.24.2
|
225
|
-
* February 24, 2014
|
226
|
-
|
227
|
-
- Better warnings if `apartment:migrate` is run
|
228
|
-
|
229
|
-
# v0.24.1
|
230
|
-
* February 21, 2014
|
231
|
-
|
232
|
-
- requiring `apartment/tasks/enhancements` in an initializer doesn't work
|
233
|
-
- One can disable tenant migrations using `Apartment.db_migrate_tenants = false` in the Rakefile
|
234
|
-
|
235
|
-
# v0.24
|
236
|
-
* February 21, 2014 (In honour of the Women's Gold Medal in Hockey at Sochi)
|
237
|
-
|
238
|
-
- [BREAKING CHANGE] `apartment:migrate` task no longer depends on `db:migrate`
|
239
|
-
- Instead, you can `require 'apartment/tasks/enhancements'` in your Apartment initializer
|
240
|
-
- This will enhance `rake db:migrate` to also run `apartment:migrate`
|
241
|
-
- You can now forget about ever running `apartment:migrate` again
|
242
|
-
- Numerous deprecations for things referencing the word 'database'
|
243
|
-
- This is an ongoing effort to completely replace 'database' with 'tenant' as a better abstraction
|
244
|
-
- Note the obvious `Apartment::Database` still exists but will hopefully become `Apartment::Tenant` soon
|
245
|
-
|
246
|
-
# v0.23.2
|
247
|
-
* January 9, 2014
|
248
|
-
|
249
|
-
- Increased visibility of #parse_database_name warning
|
250
|
-
|
251
|
-
# v0.23.1
|
252
|
-
* January 8, 2014
|
253
|
-
|
254
|
-
- Schema adapters now initialize with default and persistent schemas
|
255
|
-
- Deprecated Apartment::Elevators#parse_database_name
|
256
|
-
|
257
|
-
# v0.23.0
|
258
|
-
* August 21, 2013
|
259
|
-
|
260
|
-
- Subdomain Elevator now allows for exclusions
|
261
|
-
- Delayed::Job has been completely removed
|
262
|
-
|
263
|
-
# v0.22.1
|
264
|
-
* August 21, 2013
|
265
|
-
|
266
|
-
- Fix bug where if your ruby process importing the database schema is run
|
267
|
-
from a directory other than the app root, Apartment wouldn't know what
|
268
|
-
schema_migrations to insert into the database (Rails only)
|
269
|
-
|
270
|
-
# v0.22.0
|
271
|
-
* June 9, 2013
|
272
|
-
|
273
|
-
- Numerous bug fixes:
|
274
|
-
- Mysql reset could connect to wrong database [eric88]
|
275
|
-
- Postgresql schema names weren't quoted properly [gdott9]
|
276
|
-
- Fixed error message on SchemaNotFound in `process`
|
277
|
-
- HostHash elevator allows mapping host based on hash contents [gdott9]
|
278
|
-
- Official Sidekiq support with the [apartment-sidekiq gem](https://github.com/influitive/apartment-sidekiq)
|
279
|
-
|
280
|
-
|
281
|
-
# v0.21.1
|
282
|
-
* May 31, 2013
|
283
|
-
|
284
|
-
- Clearing the AR::QueryCache after switching databases.
|
285
|
-
- Fixes issue with stale model being loaded for schema adapters
|
286
|
-
|
287
|
-
# v0.21.0
|
288
|
-
* April 24, 2013
|
289
|
-
|
290
|
-
- JDBC support!! [PetrolMan]
|
291
|
-
|
292
|
-
# v0.20.0
|
293
|
-
* Feb 6, 2013
|
294
|
-
|
295
|
-
- Mysql now has a 'schema like' option to perform like Postgresql (default)
|
296
|
-
- This should be significantly more performant than using connections
|
297
|
-
- Psych is now supported for Delayed::Job yaml parsing
|
298
|
-
|
299
|
-
# v0.19.2
|
300
|
-
* Jan 30, 2013
|
301
|
-
|
302
|
-
- Database schema file can now be set manually or skipped altogether
|
303
|
-
|
304
|
-
# v0.19.1
|
305
|
-
* Jan 30, 2013
|
306
|
-
|
307
|
-
- Allow schema.rb import file to be specified in config or skip schema.rb import altogether
|
308
|
-
|
309
|
-
# v0.19.0
|
310
|
-
* Dec 29, 2012
|
311
|
-
|
312
|
-
- Apartment is now threadsafe
|
313
|
-
- New postgis adapter [zonpantli]
|
314
|
-
- Removed ActionDispatch dependency for use with Rack apps (regression)
|
315
|
-
|
316
|
-
# v0.18.0
|
317
|
-
* Nov 27, 2012
|
318
|
-
|
319
|
-
- Added `append_environment` config option [virtualstaticvoid]
|
320
|
-
- Cleaned up the readme and generator documentation
|
321
|
-
- Added `connection_class` config option [smashtank]
|
322
|
-
- Fixed a [bug](https://github.com/influitive/apartment/issues/17#issuecomment-10758327) in pg adapter when missing schema
|
323
|
-
|
324
|
-
# v0.17.1
|
325
|
-
* Oct 30, 2012
|
326
|
-
|
327
|
-
- Fixed a bug where switching to an unknown db in mysql2 would crash the app [Frodotus]
|
328
|
-
|
329
|
-
# v0.17.0
|
330
|
-
* Sept 26, 2012
|
331
|
-
|
332
|
-
- Apartment has [a new home!](https://github.com/influitive/apartment)
|
333
|
-
- Support Sidekiq hooks to switch dbs [maedhr]
|
334
|
-
- Allow VERSION to be used on apartment:migrate [Bhavin Kamani]
|
335
|
-
|
336
|
-
# v0.16.0
|
337
|
-
* June 1, 2012
|
338
|
-
|
339
|
-
- Apartment now supports a default_schema to be set, rather than relying on ActiveRecord's default schema_search_path
|
340
|
-
- Additional schemas can always be maintained in the schema_search_path by configuring persistent_schemas [ryanbrunner]
|
341
|
-
- This means Hstore is officially supported!!
|
342
|
-
- There is now a full domain based elevator to switch dbs based on the whole domain [lcowell]
|
343
|
-
- There is now a generic elevator that takes a Proc to switch dbs based on the return value of that proc.
|
344
|
-
|
345
|
-
# v0.15.0
|
346
|
-
* March 18, 2012
|
347
|
-
|
348
|
-
- Remove Rails dependency, Apartment can now be used with any Rack based framework using ActiveRecord
|
349
|
-
|
350
|
-
# v0.14.4
|
351
|
-
* March 8, 2012
|
352
|
-
|
353
|
-
- Delayed::Job Hooks now return to the previous database, rather than resetting
|
354
|
-
|
355
|
-
# v0.14.3
|
356
|
-
* Feb 21, 2012
|
357
|
-
|
358
|
-
- Fix yaml serialization of non DJ models
|
359
|
-
|
360
|
-
# v0.14.2
|
361
|
-
* Feb 21, 2012
|
362
|
-
|
363
|
-
- Fix Delayed::Job yaml encoding with Rails > 3.0.x
|
364
|
-
|
365
|
-
# v0.14.1
|
366
|
-
* Dec 13, 2011
|
367
|
-
|
368
|
-
- Fix ActionDispatch::Callbacks deprecation warnings
|
369
|
-
|
370
|
-
# v0.14.0
|
371
|
-
* Dec 13, 2011
|
372
|
-
|
373
|
-
- Rails 3.1 Support
|
374
|
-
|
375
|
-
# v0.13.1
|
376
|
-
* Nov 8, 2011
|
377
|
-
|
378
|
-
- Reset prepared statement cache for rails 3.1.1 before switching dbs when using postgresql schemas
|
379
|
-
- Only necessary until the next release which will be more schema aware
|
380
|
-
|
381
|
-
# v0.13.0
|
382
|
-
* Oct 25, 2011
|
383
|
-
|
384
|
-
- `process` will now rescue with reset if the previous schema/db is no longer available
|
385
|
-
- `create` now takes an optional block which allows you to process within the newly created db
|
386
|
-
- 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
|
387
|
-
|
388
|
-
# v0.12.0
|
389
|
-
* Oct 4, 2011
|
390
|
-
|
391
|
-
- Added a `drop` method for removing databases/schemas
|
392
|
-
- Refactored abstract adapter to further remove duplication in concrete implementations
|
393
|
-
- Excluded models now take string references so they are properly reloaded in development
|
394
|
-
- Better silencing of `schema.rb` loading using `verbose` flag
|
395
|
-
|
396
|
-
# v0.11.1
|
397
|
-
* Sep 22, 2011
|
398
|
-
|
399
|
-
- Better use of Railties for initializing apartment
|
400
|
-
- The following changes were necessary as I haven't figured out how to properly hook into Rails reloading
|
401
|
-
- Added reloader middleware in development to init Apartment on each request
|
402
|
-
- Override `reload!` in console to also init Apartment
|
403
|
-
|
404
|
-
# v0.11.0
|
405
|
-
* Sep 20, 2011
|
406
|
-
|
407
|
-
- Excluded models no longer use a different connection when using postgresql schemas. Instead their table_name is prefixed with `public.`
|
408
|
-
|
409
|
-
# v0.10.3
|
410
|
-
* Sep 20, 2011
|
411
|
-
|
412
|
-
- Fix improper raising of exceptions on create and reset
|
413
|
-
|
414
|
-
# v0.10.2
|
415
|
-
* Sep 15, 2011
|
416
|
-
|
417
|
-
- Remove all the annoying logging for loading db schema and seeding on create
|
418
|
-
|
419
|
-
# v0.10.1
|
420
|
-
* Aug 11, 2011
|
421
|
-
|
422
|
-
- Fixed bug in DJ where new objects (that hadn't been pulled from the db) didn't have the proper database assigned
|
423
|
-
|
424
|
-
# v0.10.0
|
425
|
-
* July 29, 2011
|
426
|
-
|
427
|
-
- Added better support for Delayed Job
|
428
|
-
- New config option that enables Delayed Job wrappers
|
429
|
-
- 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
|
430
|
-
|
431
|
-
# v0.9.2
|
432
|
-
* July 4, 2011
|
433
|
-
|
434
|
-
- Migrations now run associated rails migration fully, fixes schema.rb not being reloaded after migrations
|
435
|
-
|
436
|
-
# v0.9.1
|
437
|
-
* June 24, 2011
|
438
|
-
|
439
|
-
- Hooks now take the payload object as an argument to fetch the proper db for DJ hooks
|
440
|
-
|
441
|
-
# v0.9.0
|
442
|
-
* June 23, 2011
|
443
|
-
|
444
|
-
- Added module to provide delayed job hooks
|
445
|
-
|
446
|
-
# v0.8.0
|
447
|
-
* June 23, 2011
|
448
|
-
|
449
|
-
- Added #current_database which will return the current database (or schema) name
|
450
|
-
|
451
|
-
# v0.7.0
|
452
|
-
* June 22, 2011
|
453
|
-
|
454
|
-
- Added apartment:seed rake task for seeding all dbs
|
455
|
-
|
456
|
-
# v0.6.0
|
457
|
-
* June 21, 2011
|
458
|
-
|
459
|
-
- Added #process to connect to new db, perform operations, then ensure a reset
|
460
|
-
|
461
|
-
# v0.5.1
|
462
|
-
* June 21, 2011
|
463
|
-
|
464
|
-
- Fixed db migrate up/down/rollback
|
465
|
-
- added db:redo
|
466
|
-
|
467
|
-
# v0.5.0
|
468
|
-
* June 20, 2011
|
469
|
-
|
470
|
-
- Added the concept of an "Elevator", a rack based strategy for db switching
|
471
|
-
- Added the Subdomain Elevator middleware to enabled db switching based on subdomain
|
472
|
-
|
473
|
-
# v0.4.0
|
474
|
-
* June 14, 2011
|
475
|
-
|
476
|
-
- Added `configure` method on Apartment instead of using yml file, allows for dynamic setting of db names to migrate for rake task
|
477
|
-
- Added `seed_after_create` config option to import seed data to new db on create
|
478
|
-
|
479
|
-
# v0.3.0
|
480
|
-
* June 10, 2011
|
481
|
-
|
482
|
-
- Added full support for database migration
|
483
|
-
- Added in method to establish new connection for excluded models on startup rather than on each switch
|
484
|
-
|
485
|
-
# v0.2.0
|
486
|
-
* June 6, 2011 *
|
487
|
-
|
488
|
-
- Refactor to use more rails/active_support functionality
|
489
|
-
- Refactor config to lazily load apartment.yml if exists
|
490
|
-
- Remove OStruct and just use hashes for fetching methods
|
491
|
-
- Added schema load on create instead of migrating from scratch
|
492
|
-
|
493
|
-
# v0.1.3
|
494
|
-
* March 30, 2011 *
|
495
|
-
|
496
|
-
- Original pass from Ryan
|
data/TODO.md
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# Apartment TODOs
|
2
|
-
|
3
|
-
### Below is a list of tasks in the approximate order to be completed of for Apartment
|
4
|
-
### Any help along the way is greatly appreciated (on any items, not particularly in order)
|
5
|
-
|
6
|
-
1. Apartment was originally written (and TDD'd) with just Postgresql in mind. Different adapters were added at a later date.
|
7
|
-
As such, the test suite is a bit of a mess. There's no formal structure for fully integration testing all adapters to ensure
|
8
|
-
proper quality and prevent regressions.
|
9
|
-
|
10
|
-
There's also a test order dependency as some tests run assuming a db connection and if that test randomly ran before a previous
|
11
|
-
one that makes the connection, it would fail.
|
12
|
-
|
13
|
-
I'm proposing the first thing to be done is to write up a standard, high livel integration test case that can be applied to all adapters
|
14
|
-
and makes no assumptions about implementation. It should ensure that each adapter conforms to the Apartment Interface and CRUD's properly.
|
15
|
-
It would be nice if a user can 'register' an adapter such that it would automatically be tested (nice to have). Otherwise one could just use
|
16
|
-
a shared behaviour to run through all of this.
|
17
|
-
|
18
|
-
Then, I'd like to see all of the implementation specific tests just in their own test file for each adapter (ie the postgresql schema adapter checks a lot of things with `schema_search_path`)
|
19
|
-
|
20
|
-
This should ensure that going forward nothing breaks, and we should *ideally* be able to randomize the test order
|
21
|
-
|
22
|
-
2. <del>`Apartment::Database` is the wrong abstraction. When dealing with a multi-tenanted system, users shouldn't thing about 'Databases', they should
|
23
|
-
think about Tenants. I proprose that we deprecate the `Apartment::Database` constant in favour of `Apartment::Tenant` for a nicer abstraction. See
|
24
|
-
http://myronmars.to/n/dev-blog/2011/09/deprecating-constants-and-classes-in-ruby for ideas on how to achieve this.</del>
|
25
|
-
|
26
|
-
4. Apartment::Database.process should be deprecated in favour of just passing a block to `switch`
|
27
|
-
5. Apartment::Database.switch should be renamed to switch! to indicate that using it on its own has side effects
|
28
|
-
|
29
|
-
6. Migrations right now can be a bit of a pain. Apartment currently migrates a single tenant completely up to date, then goes onto the next. If one of these
|
30
|
-
migrations fails on a tenant, the previous one does NOT get reverted and leaves you in an awkward state. Ideally we'd want to wrap all of the migrations in
|
31
|
-
a transaction so if one fails, the whole thing reverts. Once we can ensure an all-or-nothing approach to migrations, we can optimize the migration strategy
|
32
|
-
to not even iterate over the tenants if there are no migrations to run on public.
|
33
|
-
|
34
|
-
7. Apartment has be come one of the most popular/robust Multi-tenant gems for Rails, but it still doesn't work for everyone's use case. It's fairly limited in implementation to either schema based (ie postgresql schemas) or connection based. I'd like to abstract out these implementation details such that one could write a pluggable strategy for Apartment and choose it based on a config selection (something like `config.strategy = :schema`). The next implementation I'd like to see is a scoped based approach that uses a `tenant_id` scoping on all records for multi-tenancy. This is probably the most popular multi-tenant approach and is db independent and really the simplest mechanism for a type of multi-tenancy.
|
35
|
-
|
36
|
-
8. Right now excluded tables still live in all tenanted environments. This is basically because it doesn't matter if they're there, we always query from the public.
|
37
|
-
It's a bit of an annoyance though and confuses lots of people. I'd love to see only tenanted tables in the tenants and only excluded tables in the public tenant.
|
38
|
-
This will be hard because Rails uses public to generate schema.rb. One idea is to have an `excluded` schema that holds all the excluded models and the public can
|
39
|
-
maintain everything.
|
40
|
-
|
41
|
-
9. This one is pretty lofty, but I'd also like to abstract out the fact that Apartment uses ActiveRecord. With the new DataMapper coming out soon and other popular
|
42
|
-
DBMS's (ie. mongo, couch etc...), it'd be nice if Apartment could be the de-facto interface for multi-tenancy on these systems.
|
43
|
-
|
44
|
-
|
45
|
-
===================
|
46
|
-
|
47
|
-
Quick TODOs
|
48
|
-
|
49
|
-
2. deprecation.rb rescues everything, we have a hard dependency on ActiveSupport so this is unnecessary
|
50
|
-
3.
|
data/docker-compose.yml
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
version: '2.3'
|
2
|
-
services:
|
3
|
-
postgresql:
|
4
|
-
image: postgres:9.5.12
|
5
|
-
environment:
|
6
|
-
POSTGRES_PASSWORD: ""
|
7
|
-
ports:
|
8
|
-
- "5432:5432"
|
9
|
-
healthcheck:
|
10
|
-
test: pg_isready -U postgres
|
11
|
-
start_period: 10s
|
12
|
-
interval: 10s
|
13
|
-
timeout: 30s
|
14
|
-
retries: 3
|
15
|
-
mysql:
|
16
|
-
image: mysql:5.7
|
17
|
-
environment:
|
18
|
-
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
19
|
-
ports:
|
20
|
-
- "3306:3306"
|
21
|
-
healthcheck:
|
22
|
-
test: mysqladmin -h 127.0.0.1 -uroot ping
|
23
|
-
start_period: 15s
|
24
|
-
interval: 10s
|
25
|
-
timeout: 30s
|
26
|
-
retries: 3
|
27
|
-
healthcheck:
|
28
|
-
image: busybox
|
29
|
-
depends_on:
|
30
|
-
postgresql:
|
31
|
-
condition: service_healthy
|
32
|
-
mysql:
|
33
|
-
condition: service_healthy
|
data/gemfiles/rails_5_2.gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "http://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "~> 5.2.0"
|
6
|
-
|
7
|
-
platforms :jruby do
|
8
|
-
gem "activerecord-jdbc-adapter", "~> 52.0"
|
9
|
-
gem "activerecord-jdbcpostgresql-adapter", "~> 52.0"
|
10
|
-
gem "activerecord-jdbcmysql-adapter", "~> 52.0"
|
11
|
-
end
|
12
|
-
|
13
|
-
gemspec path: "../"
|
data/gemfiles/rails_6_0.gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "http://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "~> 6.0.0"
|
6
|
-
|
7
|
-
platforms :ruby do
|
8
|
-
gem "sqlite3", "~> 1.4"
|
9
|
-
end
|
10
|
-
|
11
|
-
platforms :jruby do
|
12
|
-
gem "activerecord-jdbc-adapter", "~> 60.0"
|
13
|
-
gem "activerecord-jdbcpostgresql-adapter", "~> 60.0"
|
14
|
-
gem "activerecord-jdbcmysql-adapter", "~> 60.0"
|
15
|
-
end
|
16
|
-
|
17
|
-
gemspec path: "../"
|
data/gemfiles/rails_6_1.gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "http://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "~> 6.1.0"
|
6
|
-
|
7
|
-
platforms :ruby do
|
8
|
-
gem "sqlite3", "~> 1.4"
|
9
|
-
end
|
10
|
-
|
11
|
-
platforms :jruby do
|
12
|
-
gem "activerecord-jdbc-adapter", "~> 61.0"
|
13
|
-
gem "activerecord-jdbcpostgresql-adapter", "~> 61.0"
|
14
|
-
gem "activerecord-jdbcmysql-adapter", "~> 61.0"
|
15
|
-
end
|
16
|
-
|
17
|
-
gemspec path: "../"
|
data/gemfiles/rails_7_0.gemfile
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "http://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "~> 7.0.0"
|
6
|
-
|
7
|
-
platforms :ruby do
|
8
|
-
gem "sqlite3", "~> 1.4"
|
9
|
-
end
|
10
|
-
|
11
|
-
platforms :jruby do
|
12
|
-
gem "activerecord-jdbc-adapter", "~> 61.0"
|
13
|
-
gem "activerecord-jdbcpostgresql-adapter", "~> 61.0"
|
14
|
-
gem "activerecord-jdbcmysql-adapter", "~> 61.0"
|
15
|
-
end
|
16
|
-
|
17
|
-
gemspec path: "../"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "http://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", git: "https://github.com/rails/rails.git"
|
6
|
-
|
7
|
-
platforms :ruby do
|
8
|
-
gem "sqlite3", "~> 1.4"
|
9
|
-
end
|
10
|
-
|
11
|
-
platforms :jruby do
|
12
|
-
gem "activerecord-jdbc-adapter", "~> 61.0"
|
13
|
-
gem "activerecord-jdbcpostgresql-adapter", "~> 61.0"
|
14
|
-
gem "activerecord-jdbcmysql-adapter", "~> 61.0"
|
15
|
-
end
|
16
|
-
|
17
|
-
gemspec path: "../"
|