Skip to content

Comments

Follow rails/rails#39365#2019

Merged
yahonda merged 2 commits intorsim:masterfrom
koic:follow_rails_39365
May 25, 2020
Merged

Follow rails/rails#39365#2019
yahonda merged 2 commits intorsim:masterfrom
koic:follow_rails_39365

Conversation

@koic
Copy link
Collaborator

@koic koic commented May 24, 2020

Follow up to rails/rails#39365.

This PR consists of the following two commits.

  1. Default engine ENGINE=InnoDB is no longer dumped to make schema more agnostic (rails/rails@3c6be5e)
  2. Separate primary key column options from table options (rails/rails@859681e)

The latter changes create_table format in the dumped schema file.

koic added a commit to koic/oracle-enhanced that referenced this pull request May 24, 2020
RuboCop Performance 1.6.0 has been released.
https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.6.0

This PR suppresss new RuboCop's offenses.

```consle
% bundle exec rubocop
(snip)

Offenses:

lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:45:39:
C: Performance/StartWith: Use String#start_with? instead of a regex
match anchored to the beginning of the string.
            if (name == "EXPLAIN") && sql =~ /^EXPLAIN/
                                      ^^^^^^^^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/lob.rb:21:15: C:
Performance/EndWith: Use String#end_with? instead of a regex match
anchored to the end of the string.
              column.sql_type_metadata.sql_type =~ /LOB$/
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:327:46:
C: Performance/StartWith: Use String#start_with? instead of a regex
match anchored to the beginning of the string.
            database = "/#{database}" unless database.match?(/^\//)
                                             ^^^^^^^^^^^^^^^^^^^^^^
spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb:183:58:
C: Performance/StartWith: Use String#start_with? instead of a regex
match anchored to the beginning of the string.
      params[:database] = "/#{params[:database]}" unless params[:database].match?(/^\//)
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

70 files inspected, 4 offenses detected
```

rsim#2019
@koic
Copy link
Collaborator Author

koic commented May 24, 2020

CI has been failed. RuboCop offenses will be solved by #2020 and the following undefined method 'table_options' error will be solved by merging this PR.

Traceback (most recent call last):
	12: from guides/bug_report_templates/active_record_gem.rb:45:in `<main>'
	11: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/rails-42914820d91d/activerecord/lib/active_record/schema.rb:46:in `define'
	10: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/rails-42914820d91d/activerecord/lib/active_record/schema.rb:50:in `define'
	 9: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/rails-42914820d91d/activerecord/lib/active_record/schema.rb:50:in `instance_eval'
	 8: from guides/bug_report_templates/active_record_gem.rb:46:in `block in <main>'
	 7: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/rails-42914820d91d/activerecord/lib/active_record/migration.rb:900:in `method_missing'
	 6: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/rails-42914820d91d/activerecord/lib/active_record/migration.rb:879:in `say_with_time'
	 5: from /home/travis/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/benchmark.rb:293:in `measure'
	 4: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/rails-42914820d91d/activerecord/lib/active_record/migration.rb:879:in `block in say_with_time'
	 3: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/rails-42914820d91d/activerecord/lib/active_record/migration.rb:911:in `block in method_missing'
	 2: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/oracle-enhanced-b254b83fc538/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb:235:in `create_table'
	 1: from /home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/rails-42914820d91d/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb:13:in `accept'
/home/travis/.rvm/gems/ruby-2.7.1/bundler/gems/oracle-enhanced-b254b83fc538/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb:38:in `visit_TableDefinition': undefined method `table_options' for #<ActiveRecord::ConnectionAdapters::OracleEnhanced::SchemaCreation:0x000055fa98a20a60> (NoMethodError)
The command "ruby guides/bug_report_templates/active_record_gem.rb" exited with 1.

https://travis-ci.org/github/rsim/oracle-enhanced/jobs/690567001#L577-L591

@koic koic force-pushed the follow_rails_39365 branch from 733ebca to b1fae81 Compare May 25, 2020 00:58
@yahonda
Copy link
Collaborator

yahonda commented May 25, 2020

The second part of CI depends on the master branch of Oracle enhanced adapter, then once this pull request merged, the next CI should be green.

@yahonda yahonda merged commit 49ba348 into rsim:master May 25, 2020
@yahonda
Copy link
Collaborator

yahonda commented May 25, 2020

Thanks for the recent active contributions.

@koic koic deleted the follow_rails_39365 branch May 25, 2020 11:48
yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Sep 10, 2020
This pull request restores Schema Dumper behavior changed by rsim#2019
because rails/rails#39365 does not intend to dump the default primary key configuration.

Related to rails/rails#39365
Follow up rsim#2019
yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Sep 10, 2020
This pull request restores Schema Dumper behavior changed by rsim#2019
because rails/rails#39365 does not intend to dump the default primary key configuration.

Related to rails/rails#39365
Follow up rsim#2019
yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Sep 11, 2020
This pull request restores Schema Dumper behavior changed by rsim#2019
because rails/rails#39365 does not intend to dump the default primary key configuration.

To avoid hash creation every time, it has been frozen and saved as a
constant.

Related to rails/rails#39365
Follow up rsim#2019
Refer http://code.jeremyevans.net/presentations/rubykaigi2019/index.html#58
yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Sep 11, 2020
This pull request restores Schema Dumper behavior changed by rsim#2019
because rails/rails#39365 does not intend to dump the default primary key configuration.

To avoid hash creation every time, it has been frozen and saved as a
constant.

Related to rails/rails#39365
Follow up rsim#2019
Refer http://code.jeremyevans.net/presentations/rubykaigi2019/index.html#58
koic added a commit that referenced this pull request Sep 11, 2020
Restore Schema Dumper behavior changed by #2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants