We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
rake db:schema:dump
The schema_dumper dumps a schema.rb with a space in the column name.
The schema_dumper throws a SyntaxError.
+ bundle exec rake db:migrate rake aborted! SyntaxError: (eval):1: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' {Name", limit: 255} ^ (eval):1: unterminated string meets end of file /srv/jenkins/.gem/ruby/gems/schema_plus_core-1.0.2/lib/schema_plus/core/active_record/schema_dumper.rb:78:in `eval'
In this case, the column name was First Name, but it was parsed as name = First with options = Name", limit: 255.
First Name
First
Name", limit: 255
Remove whitespace from column names.
ALTER TABLE temp_respondents RENAME "First Name" TO "First_Name";
The error is thrown on this line (https://github.com/SchemaPlus/schema_plus_core/blob/master/lib/schema_plus/core/active_record/schema_dumper.rb#L80), but the bug is in the regex above it: when the column name contains whitespace, it incorrectly only captures part of the column name.
The text was updated successfully, but these errors were encountered:
I'm having a similar problem on the same line. The following index:
Indexes: "thredded_categories_name_ci" btree (lower(name::text) text_pattern_ops)
is causing db:schema:dump to blow up:
db:schema:dump
** Execute db:schema:dump rails aborted! SyntaxError: (eval):1: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' {text_pattern_ops", name: "thredded_categories_... ^ (eval):1: syntax error, unexpected tIDENTIFIER, expecting end-of-input ...e: "thredded_categories_name_ci"} ... ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/thornett/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/schema_dumper.rb:80:in `eval' /Users/thornett/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/schema_dumper.rb:80:in `block (2 levels) in table' /Users/thornett/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/schema_dumper.rb:69:in `map' /Users/thornett/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/schema_dumper.rb:69:in `block in table'
Presumably the issue is the space in the index declaration necessitated by the text_pattern_ops operator.
text_pattern_ops
This is on Postgres 9.5.6 and Rails 5.1.6.
9.5.6
5.1.6
Sorry, something went wrong.
No branches or pull requests
Steps to reproduce
rake db:schema:dump
.Expected
The schema_dumper dumps a schema.rb with a space in the column name.
Actual
The schema_dumper throws a SyntaxError.
In this case, the column name was
First Name
, but it was parsed as name =First
with options =Name", limit: 255
.Available workarounds
Remove whitespace from column names.
Background info
The error is thrown on this line (https://github.com/SchemaPlus/schema_plus_core/blob/master/lib/schema_plus/core/active_record/schema_dumper.rb#L80), but the bug is in the regex above it: when the column name contains whitespace, it incorrectly only captures part of the column name.
The text was updated successfully, but these errors were encountered: