Giter VIP home page Giter VIP logo

migration_comments's Introduction

MigrationComments

Comments for your migrations

Tested on:

ActiveRecord 5.0

Using Ruby 2.2 and higher

ActiveRecord 4.2

using Ruby 2.1 and higher

Status: <img src=“https://travis-ci.org/pinnymz/migration_comments.svg?branch=master” alt=“Build Status” />

**IMPORTANT UPDATE**

ActiveRecord 5.0 is introducing baked-in comment support, although not all features provided by this project have yet been completely implemented. This is expected to be rectified by ActiveRecord 5.1, and as such ActiveRecord 5.0 will likely be the last version for which this gem will work (or be needed). ActiveRecord 5.0 itself will be supported by this project, but many features are overlapping and you may find that you won’t need it at all.

For those using a version of ActiveRecord prior to 4.2 or of Ruby prior to 2.1, please use the v0.3.2 version of the gem.

Why?

Migrations are wonderful. They handle all your schema changes, and in a pinch they can bring any database up to speed. However, database schemas can change rapidly while a project is maturing, and it can be difficult to know (or remember) the purpose for each table and field. As such, they deserve to be commented. These comments should be available for display wherever those fields are found.

Solution!

Using MigrationComments, you can simply add comments during your migrations. Or if you already have existing data structures, just add the comments afterwards in a separate migration. And of course you can always modify and delete these comments in later migrations.

So where are these comments used? Firstly, they will be included in your schema.rb dump which is where your IDE (e.g. RubyMine, TextMate) should be learning about your model structure. This means that they’ll be available at any point in your project. Additionally, if you are using the ‘annotate’ gem, these comments will be added to the annotations that are generated within your model.rb file.

Examples

To add a comment to an existing structure…

def self.up
  set_table_comment :table_name, "A table comment"
  set_column_comment :table_name, :column_name, "A column comment"
end

Or you can use the change_table macro…

def self.up
  change_table :table_name do |t|
    t.comment "A table comment"
    t.change_comment :column_name, "A column comment"
  end
end

Creating a new table?

def self.up
  create_table :table_name, :comment => "A table comment" do |t|
    t.string :column_name, :comment => "A column comment"
  end
end

You can also remove comments…

def self.up
  remove_table_comment :table_name
  remove_column_comment :table_name, :column_name
end

Or you can combine these commands while modifying a table…

def self.up
  change_table :existing_table do |t|
    t.comment nil                                       # remove an existing table comment
    t.string :new_column, :comment => "a new column"    # add a new column with a comment
    t.change_comment :existing_column, nil              # remove a comment on an existing column
    t.integer :another_existing_column, :comment => nil # remove a comment on an existing column while modifying the column type
    t.boolean :column_with_comment                      # modify an existing column without altering the comment
  end
end

Requirements

You must be using a supported DBMS (currently PostgreSQL, MySQL, and SQLite).

If this isn’t an option for you, check out the ‘schema_comments’ gem at github.com/akm/schema_comments

Licensing

See MIT-LICENSE file for details.

migration_comments's People

Contributors

edennis avatar kenaniah avatar ma2gedev avatar mastropinguino avatar pinnymz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

migration_comments's Issues

v0.4.0 introduces a breaking API change for setting table comments

The breaking change was introduced in a9646f9#diff-24cef9304fab05a7c934b31754f74b8aL5 to accommodate the Rails 5 schema comments API.

This comment changes def comment(text) to def comment=(text), introducing a breaking change that is not mentioned in the ReadMe or elsewhere. Code samples in the Readme will also fail due to comment now being treated as an accessor in v0.4.0.

The Fix:

The Readme should be updated to reflect the changes in the API.

All instances of

t.comment "My table comment"

should be replaced with:

t.comment = "My table comment"

Comments not generated in Rails 4.1

After upgrading to Rails 4.1 (stable beta branch), it seems schema.rb is no longer being populated with comments. No errors or warnings, but it seems the Gem has no effect.

Loading annotate/annotate_models breaks ActiveRecord dynamic finders

'annotate/annotate_models.rb' uses a monkey patched :method_missing to get around the problem of recognizing unknown macros ('acts_as_something' and the like). This monkey patch is only meant to be loaded when running the rake task to create annotations.

Unfortunately, we are requiring the 'annotate/annotate_models.rb' file to load in order to modify the output with comments. If we remove the requirement, our modification hook will never be inserted because the environment (and all gems) are loaded by the annotation rake task before the 'annotate/annotate_models.rb' file.

We'll need to find an alternative hooking method that doesn't require including the 'method_missing' monkey patch.

Support Rails 5

It seems not working on rails-5.0.0.beta1.1.

Here is a migration:

class CreateFormulas < ActiveRecord::Migration[5.0]
  def change
    create_table :formulas, comment: 'formula of truth' do |t|
      t.string :name, comment: 'name of formula'
      t.string :code, comment: 'ident'
      t.string :equation, comment: 'equation of formula'

      t.timestamps
    end
  end
end

And after run rails db:migration, here is what I got from db/schema.rb:

create_table "formulas", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='formula of truth'", comment: "formula of truth" do |t|
  t.integer  "id"
  t.string   "name"
  t.string   "code"
  t.string   "equation"
  t.datetime "created_at", null: false
  t.datetime "updated_at", null: false
end

comment parameter for add_column

Hi,

I have a feature request: I don’t know if this should be supported (documentation doesn’t say so I assume no), but syntax like

add_column :table, :column, :string, comment: "nyaa"

should be supported. At the moment, after adding new column, it would be needed to call set_new_comment after adding the new column, resulting to duplicating some information.

Silence warnings

When running tests on a project depending on migration_comments some warnings are raised (see below).

This is because with a recent rake (>=11.0), ruby warnings are now on by default.

What do you think about fixing those warnings as well as running the test suite with ruby -w / $VERBOSE = true / t.warning = true ?

/Users/lloeki/.gem/ruby/2.3.4/gems/migration_comments-0.4.1/lib/migration_comments.rb:40: warning: assigned but unused variable - ex
/Users/lloeki/.gem/ruby/2.3.4/gems/migration_comments-0.4.1/lib/migration_comments.rb:53: warning: assigned but unused variable - ex
/Users/lloeki/.gem/ruby/2.3.4/gems/migration_comments-0.4.1/lib/migration_comments/active_record/connection_adapters/table_definition.rb:5: warning: method redefined; discarding old comment=

Incompatible with foreigner

It looks like migration_comments break foreigner AR::ConnectionAdapters extensions. Both gems extending create_table method for migrations. And if I add migration_comments gem to my Rails 4.1 project with installed foreigner, in migrations like this

create_table :profiles do |t|
  ...
  t.references :user
  t.foreign_key :users
  ...
end

foreign_key stops working without any error messages. Debugging shows that overridden in foreigner create_table method is not called.

I think the problem is in how migration_comments gem initialized. I tried to add railtie

lib/migration_comments/railtie.rb:

module MigrationComments
  class Railtie < Rails::Railtie
    initializer 'migration_comments.load_adapter' do
      ActiveSupport.on_load :active_record do
        MigrationComments.setup
      end
    end
  end
end

and move gem setup to it

lib/migration_comments.rb:

...
# MigrationComments.setup
require 'migration_comments/railtie' if defined?(Rails)

and it solved the problem. Both gems work fine.

Varchar primary key fields with name other than id changed to int(11) ai

Varchar primary key fields with name other than id get redefined in a wrong way when migration_comments is run: Such PK fields arre converted to type integer(11) with auto increment and their content is recreated accordingly as sequential numbers.
The original content is lost which makes the otherwise perfect gem unusable for legacy databases containing primary keys with names other than 'id'.

Example:

Columns:
property_key    varchar(255) PK 
value   varchar(255) 

comes out as

Columns:
property_key    int(11) PK AI
value   varchar(255) 

Tested with rails 2.3.18, migration_comments 0.3.2. This is even when id fields are not included

What if you are using Active Record > 4.2 but Ruby < 2.1 ? Weird conflict with UUIDs

I'm having difficulty replicating this issue, and it may well a problem elsewhere. However, if I use ActiveRecord 4's built-in :uuid functionality (so it can set a primary key as a uuid that generates by itself) , then that functionality breaks whenever this gem is installed.

If I use 0.3.2, then my migrations fail as for some reason no default is set for the primary uuid key column. I do not understand why. My guess is that somehow the way dependencies are set means that an older version of ActiveRecord gets used to run migrations?

If I use 0.4.1, the migrations work fine, but I run into this issue which I suspect is related to the fact that my app uses Ruby 2.0.0:

 bundle exec rake --trace --verbose assets:precompile
 ---> Running in e1302b7e04fc
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'migration_comments'.
Gem Load Error is: private method `prepend' called for ActiveRecord::SchemaDumper:Class
Backtrace for gem load error is:
/gems/gems/migration_comments-0.4.1/lib/migration_comments.rb:27:in `block in setup'
/gems/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `each'
/gems/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `setup'
/gems/gems/migration_comments-0.4.1/lib/migration_comments.rb:59:in `<top (required)>'
/usr/lib64/ruby/site_ruby/2.0.0/bundler/runtime.rb:81:in `require'
/usr/lib64/ruby/site_ruby/2.0.0/bundler/runtime.rb:81:in `block (2 levels) in require'
/usr/lib64/ruby/site_ruby/2.0.0/bundler/runtime.rb:76:in `each'
/usr/lib64/ruby/site_ruby/2.0.0/bundler/runtime.rb:76:in `block in require'

Would really love to get to the bottom of this!

Tables with no columns...

change line 35 in schema_dumper.rb to

  len = col_names.keys.map{|index| lines[index]}.map(&:length).max + 2 unless col_names.empty?

undefined method `descendants' for #<Module:0x0000aaab167ce9c8> (NoMethodError)

I update Rails from 6.0.4 to 6.1.4.
I face following error.

root@827fdc13165b:~/sokudan# bundle exec rails c
/usr/local/bundle/ruby/2.7.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:26:in `block in setup': undefined method `descendants' for #<Module:0x0000aaab167ce9c8> (NoMethodError)
	from /usr/local/bundle/ruby/2.7.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `each'
	from /usr/local/bundle/ruby/2.7.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `setup'
	from /usr/local/bundle/ruby/2.7.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:59:in `<main>'
	from /usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	from /usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	from /usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	from /usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	from /usr/local/bundle/ruby/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `block (2 levels) in require'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `each'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `block in require'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `each'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `require'
	from /usr/local/bundle/gems/bundler-2.1.4/lib/bundler.rb:174:in `require'
	from /root/sokudan/config/application.rb:21:in `<top (required)>'
	from /usr/local/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `require'
	from /usr/local/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `preload'
	from /usr/local/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:157:in `serve'
	from /usr/local/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:145:in `block in run'
	from /usr/local/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `loop'
	from /usr/local/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `run'
	from /usr/local/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	from -e:1:in `<main>'

My environments:

  • Docker image: ruby:2.7.2

When I downgrade Rails to 6.0.4, no error occurs.

Changing column comment crashes with Postgresql

change_table :table1 do |t|
t.change_comment :column1, 'comment text'
end

crashes as table name is correcty fetched in
lib/migration_comments/active_record/connection_adapters/table.rb

def change_comment(column_name, comment_text)
@base.set_column_comment(@table_name, column_name, comment_text)
end

@table_name seems to be not initialized. What is, is @table.

I'm using PostgreSQL adapter, AR 4.2.4, 0.3.2 migration_comments

New release?

Could you please tag a new release? I am currently pointing to a SHA in order to get this fix...
#13
...on a rails 4.1 application, and it would be nice to be able to point to a version number (and do so in a .gemspec file).

Much thanks!

ColumnDefinition constant not found

With version 0.2.0 I am getting an error:
uninitialized constant ActiveRecord::ConnectionAdapters::ColumnDefinition

Are there special instructions for installing this other than adding it to the Gemfile? It is causing Rails to immediately abort, even if trying to use "rails console" - error included below. I'm using

  • Rails 3.0.11
  • Ruby 1.9.3
  • MySQL 5.5.28
  • mysql2 adapter 0.2.18

The ruby stack trace follows:

$ bundle show migration_comments
/home/dem/.gem/ruby/1.9.1/gems/migration_comments-0.2.0

$ bundle exec rails console
/usr/share/gems/gems/activesupport-3.0.11/lib/active_support/inflector/methods.rb:124:in `block in constantize': uninitialized constant ActiveRecord::ConnectionAdapters::ColumnDefinition (NameError)
    from /usr/share/gems/gems/activesupport-3.0.11/lib/active_support/inflector/methods.rb:123:in `each'
    from /usr/share/gems/gems/activesupport-3.0.11/lib/active_support/inflector/methods.rb:123:in `constantize'
    from /usr/share/gems/gems/activesupport-3.0.11/lib/active_support/core_ext/string/inflections.rb:43:in `constantize'
    from /home/dem/.gem/ruby/1.9.1/gems/migration_comments-0.2.0/lib/migration_comments.rb:21:in `block in setup'
    from /home/dem/.gem/ruby/1.9.1/gems/migration_comments-0.2.0/lib/migration_comments.rb:20:in `each'
    from /home/dem/.gem/ruby/1.9.1/gems/migration_comments-0.2.0/lib/migration_comments.rb:20:in `setup'
    from /home/dem/.gem/ruby/1.9.1/gems/migration_comments-0.2.0/lib/migration_comments.rb:60:in `<top (required)>'
    from /usr/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
    from /usr/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /usr/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
    from /usr/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
    from /usr/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
    from /usr/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
    from /usr/share/gems/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
    from __project_dir__/config/application.rb:7:in `<top (required)>'
    from /usr/share/gems/gems/railties-3.0.11/lib/rails/commands.rb:21:in `require'
    from /usr/share/gems/gems/railties-3.0.11/lib/rails/commands.rb:21:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Postgresql uuid default is not set.

When creating a table with uuid as primary key

create_table "people", id: :uuid do |t|
    t.string   "name"
    t.string   "age"
end

The default value set by rails is not set which cause error when adding a new record.

set_column_comment to MySQL bigint(20) primary_key revert to int(11)

Hi 😀

I use v0.3.2 with ActiveRecord v4.2.6.
I have tried to create table with a bigint(20) as primary_key with comment for MySQL, though If I use set_column_comment to the primary_key, its type become int(11).

In concrete, migration file is

class CreateTests < ActiveRecord::Migration
  def change
    create_table :tests, id: false do |t|
      t.column  :id, 'BIGINT PRIMARY KEY AUTO_INCREMENT'
      t.string :name
    end
    set_column_comment :tests, :id, "TestID"
  end
end

and result(structure.sql) is int(11), not bigint(20).

CREATE TABLE `tests` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'TestID',
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

When I remove set_column_comment,

class CreateTests < ActiveRecord::Migration
  def change
    create_table :tests, id: false do |t|
      t.column  :id, 'BIGINT PRIMARY KEY AUTO_INCREMENT'
      t.string :name
    end
  end
end

structure.sql is what I expected. (but I need COMMENT 'TestID')

CREATE TABLE `tests` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Fortunately, I've already found the solution. At set_column_comment method of v0.3.2, doing the same way of master goes well.
Therefore I want to make a Pull Request to fix this problem. Though, this repository has only master branch, no branch for v0.3.x. What should I do to fix this bug and release v0.3.3 for ActiveRecord prior to v4.2.

v0.4.0 connection adapters regression

After running bundle update migration_comments to update from v0.3.2 to v0.4.0, a regression occurs when attempting to run Rails. Using Rails 4.2.6 and the postgres Active Record connection adapter.

Output from rails -c:

...gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:322:in `block in replace_gem': mysql2 is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
    from ...gems/activerecord-4.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:3:in `<top (required)>'
    from ...gems/migration_comments-0.4.0/lib/migration_comments.rb:34:in `require'
    from ...gems/migration_comments-0.4.0/lib/migration_comments.rb:34:in `block in setup'
    from ...gems/migration_comments-0.4.0/lib/migration_comments.rb:32:in `each'
    from ...gems/migration_comments-0.4.0/lib/migration_comments.rb:32:in `setup'
    from ...gems/migration_comments-0.4.0/lib/migration_comments.rb:60:in `<top (required)>'
    from ...gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
    from ...gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
    from ...gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
    from ...gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
    from ...gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
    from ...gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
    from ...gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
    from ...my-rails-app/config/application.rb:15:in `<top (required)>'
    from ...gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:141:in `require'
    from ...gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!'
    from ...gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:67:in `console'
    from ...gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from ...gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:8:in `require'
    from bin/rails:8:in `<main>'

undefined method `descendants' for MigrationComments::ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation:Module (NoMethodError)

After rails server , My current Problem is

user@user-MACPC repo % rails server
/Users/user/.gem/ruby/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:26:in `block in setup': undefined method `descendants' for MigrationComments::ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation:Module (NoMethodError)
        from /Users/user/.gem/ruby/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `each'
        from /Users/user/.gem/ruby/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `setup'
        from /Users/user/.gem/ruby/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:59:in `<top (required)>'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:60:in `require'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:55:in `each'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:55:in `block in require'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:44:in `each'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:44:in `require'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler.rb:176:in `require'
        from /Users/user/repos/project/repo/config/application.rb:7:in `<top (required)>'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:137:in `require'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:137:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:134:in `perform'
        from /Users/user/.gem/ruby/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        from /Users/user/.gem/ruby/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/user/.gem/ruby/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/command/base.rb:87:in `perform'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/command.rb:48:in `invoke'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

Other config :

user@user-MACPC project % ruby -v
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin19]
user@user-MACPC project % rails -v
Rails 7.0.1

user@user-MACPC project % gem list

*** LOCAL GEMS ***

abbrev (default: 0.1.0)
actioncable (7.0.1)
actionmailbox (7.0.1)
actionmailer (7.0.1, 4.0.8)
actionpack (7.0.1, 4.0.8)
actiontext (7.0.1)
actionview (7.0.1)
active_scaffold (3.6.0, 3.5.5)
activejob (7.0.1)
activemodel (7.0.1, 4.0.8)
activerecord (7.0.1, 4.0.8)
activerecord-deprecated_finders (1.0.4)
activerecord-session_store (2.0.0, 1.1.3)
activestorage (7.0.1)
activesupport (7.0.1, 6.1.4.4, 4.0.8)
addressable (2.8.0)
airbrussh (1.4.0)
akami (1.3.1)
arel (4.0.2)
autoprefixer-rails (10.4.2.0)
base64 (default: 0.1.0)
bcrypt (3.1.16)
benchmark (default: 0.1.1)
bigdecimal (default: 3.0.0)
bootstrap-sass (3.4.1)
builder (3.2.4, 3.1.4)
bundler (2.3.6, default: 2.2.32, 1.17.3)
capistrano (3.16.0)
capistrano-bundler (2.0.1, 1.6.0)
capistrano-passenger (0.2.1)
capistrano-rails (1.6.1, 1.1.8)
capistrano-rbenv (2.2.0)
cgi (default: 0.2.1)
coderay (1.1.3)
coffee-rails (5.0.0, 4.0.1)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
concurrent-ruby (1.1.9)
coveralls (0.8.23)
cow_proxy (0.3.3)
crack (0.4.5)
crass (1.0.6)
csv (default: 3.1.9)
date (default: 3.1.3)
dbm (default: 1.1.0)
debase (0.2.5.beta2)
debase-ruby_core_source (0.10.14)
debug (1.4.0, default: 0.2.1)
delegate (default: 0.2.0)
devise (4.8.1)
did_you_mean (default: 1.5.0)
diff-lcs (1.5.0)
digest (3.1.0, default: 3.0.0)
docile (1.4.0)
double-bag-ftps (0.1.4)
drb (default: 2.0.5)
english (default: 0.7.1)
erb (default: 2.2.0)
erubi (1.10.0)
erubis (2.7.0)
etc (default: 1.3.0)
excon (0.90.0)
execjs (2.8.1)
faraday (2.1.0, 1.9.3)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
faraday-net_http (2.0.1, 1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
fcntl (default: 1.0.1)
ffi (1.15.5)
fiddle (default: 1.0.8)
fileutils (default: 1.5.0)
find (default: 0.1.0)
formatador (1.1.0)
forwardable (default: 1.3.2)
getoptlong (default: 0.1.1)
globalid (1.0.0)
guard (2.18.0)
guard-compat (1.2.1)
guard-rspec (4.7.3)
gyoku (1.3.1)
hashdiff (1.0.1)
hashie (5.0.0, 3.6.0)
hike (1.2.3)
httpclient (2.8.3)
httpi (2.5.0)
i18n (1.9.0, 0.9.5)
ice_nine (0.11.2)
image_size (3.0.1)
io-console (default: 0.5.7)
io-nonblock (default: 0.1.0)
io-wait (0.2.1, default: 0.2.0)
ipaddr (default: 1.2.2)
irb (default: 1.3.5)
jbuilder (2.11.5, 1.5.3)
jeff (1.5.2)
jquery-rails (4.4.0, 3.1.5)
json (2.6.1, default: 2.5.1)
jwt (2.3.0)
libv8 (3.16.14.19)
listen (3.7.1)
logger (default: 1.4.3)
loofah (2.13.0)
lumberjack (1.2.8)
mail (2.7.1, 2.5.5)
marcel (1.0.2)
matrix (0.4.2, default: 0.3.1)
method_source (1.0.0)
migration_comments (0.4.1, 0.3.2)
mime-types (1.25.1)
mini_mime (1.1.2)
mini_portile2 (2.7.1)
minitest (5.15.0, 4.7.5)
multi_json (1.15.0)
multi_xml (0.5.5)
multipart-post (2.1.1)
mutex_m (default: 0.1.1)
nenv (0.3.0)
net-ftp (0.1.3, default: 0.1.2)
net-http (default: 0.1.1)
net-imap (0.2.3, 0.2.2, default: 0.1.1)
net-pop (0.1.1)
net-protocol (0.1.2, default: 0.1.1)
net-scp (3.0.0)
net-smtp (0.3.1, default: 0.2.1)
net-ssh (6.1.0)
nio4r (2.5.8)
nkf (default: 0.1.0)
nokogiri (1.13.1 x86_64-darwin)
nori (2.6.0)
notiffany (0.1.3)
oauth2 (1.4.7)
observer (default: 0.1.1)
omniauth (2.0.4, 1.4.2)
omniauth-oauth2 (1.7.2, 1.5.0)
omniauth-yconnect (0.0.4.1)
open-uri (default: 0.1.0)
open3 (default: 0.1.1)
openssl (default: 2.2.1)
optparse (default: 0.1.1)
orm_adapter (0.5.0)
ostruct (default: 0.3.1)
pathname (default: 0.1.0)
polyglot (0.3.5)
power_assert (2.0.1)
pp (default: 0.2.1)
prettyprint (default: 0.1.1)
prime (0.1.2)
pry (0.14.1)
pstore (default: 0.1.1)
psych (default: 3.3.2)
public_suffix (4.0.6)
racc (1.6.0, default: 1.5.2)
rack (2.2.3, 1.5.5)
rack-protection (2.1.0)
rack-test (1.1.0, 0.6.3)
rails (7.0.1, 4.0.8)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.4.2)
railties (7.0.1, 4.0.8)
rake (13.0.6, 10.5.0)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
rbs (2.0.0)
rdoc (6.3.3)
readline (default: 0.0.2)
readline-ext (default: 0.1.1)
ref (2.0.0)
reline (default: 0.2.5)
request_store (1.5.1)
resolv (default: 0.2.1)
resolv-replace (default: 0.1.0)
responders (3.0.1)
rexml (3.2.5)
rinda (default: 0.1.1)
rspec (3.10.0)
rspec-core (3.10.1)
rspec-expectations (3.10.2)
rspec-mocks (3.10.2)
rspec-support (3.10.3)
rss (0.2.9)
ruby-debug-ide (0.7.3)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sass (3.2.19)
sass-rails (6.0.0, 4.0.5)
sassc (2.4.0)
sassc-rails (2.1.2)
savon (2.12.1)
sdoc (2.3.0)
securerandom (default: 0.1.0)
set (default: 1.0.1)
shellany (0.0.1)
shellwords (default: 0.1.0)
simplecov (0.16.1)
simplecov-html (0.10.2)
singleton (default: 0.1.1)
socksify (1.7.1)
sprockets (4.0.2, 3.7.2, 2.12.5)
sprockets-rails (3.4.2, 2.3.3)
sshkit (1.21.2)
stringio (default: 3.0.1)
strscan (3.0.1)
sync (0.5.0)
syslog (default: 0.1.0)
tempfile (default: 0.1.1)
term-ansicolor (1.7.1)
test-unit (3.5.3)
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.0.10, 1.4.1)
time (default: 0.1.0)
timeout (0.2.0, default: 0.1.1)
tins (1.31.0)
tmpdir (default: 0.1.2)
tracer (default: 0.1.1)
treetop (1.4.15)
tsort (default: 0.1.0)
turbolinks (5.2.1)
turbolinks-source (5.2.0)
typeprof (0.21.1)
tzinfo (2.0.4, 0.3.60)
uglifier (4.2.0)
un (default: 0.1.0)
uri (default: 0.10.1)
warden (1.2.9)
wasabi (3.7.0)
weakref (default: 0.1.1)
webmock (3.14.0)
websocket-driver (0.7.5)
websocket-extensions (0.1.5)
yaml (default: 0.1.1)
zeitwerk (2.5.3)
zlib (default: 2.0.0)

user@user-MACPC project % gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.2.32
  - RUBY VERSION: 3.0.3 (2021-11-24 patchlevel 157) [x86_64-darwin19]
  - INSTALLATION DIRECTORY: /Users/user/.gem/ruby/3.1.0
  - USER INSTALLATION DIRECTORY: /Users/user/.gem/ruby/3.0.0
  - RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /Users/user/.gem/ruby/3.1.0/bin
  - SPEC CACHE DIRECTORY: /Users/user/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/3.0.3/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-darwin-19
  - GEM PATHS:
     - /Users/user/.gem/ruby/3.1.0
     - /Users/user/.rubies/ruby-3.1.0/lib/ruby/gems/3.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/user/.gem/ruby/3.1.0/bin
     - /usr/local/opt/ruby/bin
     - /usr/local/opt/[email protected]/sbin
     - /usr/local/opt/[email protected]/bin
     - /Users/user/.pyenv/shims
     - /Users/user/.pyenv/bin
     - /Users/user/.nodebrew/current/bin
     - /opt/local/bin
     - /opt/local/sbin
     - /Users/user/.nodebrew/current/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Library/Apple/usr/bin
     - /Users/user/.gem/ruby/3.1.0/bin
     - /Users/user/.rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/bin
     - /Users/user/.rubies/ruby-3.1.0/bin
     - /usr/local/sbin
     - /usr/local/opt/[email protected]/sbin
     - /usr/local/opt/[email protected]/bin
     - /Users/user/.pyenv/shims
     - /Users/user/.pyenv/bin
     - /Users/user/.nodebrew/current/bin
     - /opt/local/bin
     - /opt/local/sbin
     - /Applications/Visual Studio Code.app/Contents/Resources/app/bin
     - /Users/user/go/bin
     - /usr/local/opt/go/libexec/bin
     - /Applications/Visual Studio Code.app/Contents/Resources/app/bin
     - /Users/user/go/bin
     - /usr/local/opt/go/libexec/bin

How to fix it. I have nothing ideas. pls.

Incompatible with schema_plus

It appears as if this gem has problems when also used with schema_plus and when both have options for the same column. I'm not sure which gem has a bug; so I also posted an issue over there.

See SchemaPlus/schema_plus#170

Also see that issue for additional details and examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.