-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override the max_index_name_size to keep local shortening algorithm. (8) #2373
Conversation
Introduce the _connection method which returns whichever is defined between @unconfigured_connection or @raw_connection.
verify! ensures that @raw_connection is defined.
Rails commit bd19d1baf1 [1] added a check of logger.level which was not supported by the MockLogger. This commit adds a mock level method. And limits the missing_method to respond only to logging calls, so any other calls will raise a NoMethodError to make future debugging easier. [1] rails/rails@bd19d1b
The SchemaMigration object no longer inherits from ActiveRecord::Base. See "Move SchemaMigration to an independent object" rails/rails@436277d Several methods were renamed, and are no longer available as class methods on SchemaMigration, but as an instance of SchemaMigration per connection. The object per connection seems to remove the need to `reset_table_name` in the tests. That method is not available on the new object.
5465ea7
to
236b8a2
Compare
236b8a2
to
131e39b
Compare
Something to consider: it appears oracle-enhanced has a practice of overriding these kinds of defaults. Following that pattern still gets |
Rails commit e6da3ebd6c6 [1] introduces ColumnDefinition validations for the keywords used in database commands. This commit adds the additional keywords supported by this gem. [1] rails/rails@e6da3eb
131e39b
to
7b36a5c
Compare
See rails/rails@07d2407 Both `table_name` and `column_name` were removed in favor of doing o.left in the visitor pattern. This is just mimicing the adjustments from upstream.
7b36a5c
to
131e39b
Compare
This extends the existing class level auto_retry functionality to optionally allow an allow_retry boolean kwarg to allow retry of specific queries. This PR preserves the requirement that `autocommit?` be enabled which is the safer choice. ``` def with_retry(allow_retry: false) # :nodoc: should_retry = (allow_retry || self.class.auto_retry?) && autocommit? ``` See issue rsim#2310
131e39b
to
8df3f95
Compare
I like this idea, but just overriding the max only works for newer oracle versions and isn't sufficient for oracle 11. |
Thanks for considering my suggestion! I think approach of aliasing the method still works with oracle 11. The method that would be aliased, max_identifier_length calls suports_long_identifier? which includes an oracle version check. For older versions of oracle It looks like in the test that breaks, the else branch of the test reflects this - when we are not testing with |
@davinlagerroos I believe I tried what you suggest here 7b36a5c I would welcome a review. Thanks! |
@andynu My bad, I missed the test output! Thanks for making it more obvious. That is definitely not a good outcome. hmm, when index_name calls However, oracle enhanced looks to be expecting to get the full activerecord Would it work to define Or you can follow your original plan. That works too, it just might cause an issue if people have an index name that is longer than the new activerecord default. OTOH I do not know how many people would have an index name that long. |
@davinlagerroos good idea! That has worked well and does a better job preserving existing behavior. I will rebase that into this PR tomorrow. andynu@6963192 |
Rails now defaults to its own index name shortening (limited to 62 bytes). This change overrides the rails max to exceed this gems shortening method in order to preserve the historical behavior. names See rails/rails@3682aa1 So the shortening of index names that was added to rails itself was almost immediately changed to use an 'idx_' prefix instead of an 'ix_' prefix. See rails/rails@59f2b06 However, now that rails does shortening. It is an opportunity to consider simplifying this library and just using that.
8df3f95
to
28d7d9c
Compare
@andynu Thanks for trying that out! I am glad it worked |
Rails now defaults to its own index name shortening (limited to 62 bytes).
This change overrides the rails max to exceed this gems shortening
method in order to preserve the historical behavior.
names
See rails/rails@3682aa1
So the shortening of index names that was added to rails itself
was almost immediately changed to use an 'idx_' prefix instead of an 'ix_'
prefix.
See rails/rails@59f2b06
However, now that rails does shortening. It is an opportunity to
consider simplifying this library and just using that.
Stacked on #2374