ActiveRecord::StatementInvalid in Rails 4.2.7.1 - mysql

On my local system, I am facing an error of Statement Invalid. Previously, I was not getting this, but I think when I reindexed my elastic search after adding the taxon_ids index, this error started to come. Please check the attached screenshot.
And version details are -
Mysql - 5.7.34-0ubuntu0.18.04.1
Rails - 4.2.7.1
Ruby - 2.3.1
Please advise on how it can be resolved.

The Error says that your Database is missing some columns. Can you run
rake db:migrate

Related

PG::UndefinedTable: ERROR: relation 'caves' does not exist

I've ran into a problem in which I'm not sure how to get out of this. Working on creating a rails view, and after populating my view and editing my controller, i've ran into an error that states PG::UndefinedTable: ERROR: relation 'caves' does not exist
Looking into what I did, I realized that I created my model as cafe but when I populated my schema tables, I accidentally created a table called caves instead of cafes.
Here's what I did to try to resolve this.
I first tried creating a migration to just rename the table from caves to cafes -- still ran into the same error
I then tried deleting the schema table all together and creating a new one all together called cafe - still ran into the same error
I then tried dropping my database all together, thinking if I just wiped the whole thing and started over (i just started on this rails project). I ran rake db:reset only to come into a new error telling me ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database "cafe_database" is being accessed by other users
By this point, I tried restarted my postgress and ran sudo service postgresql restart....but my machine doesn't recognize service
Does anybody have an idea what I can do to figure this problem out? I'm running out of ideas.
try below steps:
1. rake db:drop
2. rake db:create
3. rake db:migrate

Rails integration test: Mysql2::Error: Can't connect to MySQL server

Lately I am working on my beautiful tests, but suddenly, after a 2 days rest, I ran again my integration tests (rake test:integration) and they don't work anymore. I really didn't do anything.
What comes is the following error:
Mysql2::Error: Can't connect to MySQL server on '192.168.0.2'
The nice thing is that the server runs fine. It is just the integration test that is broken. And they use the same mysql database.
Any idea on how to solve the problem?
Luca
check your database.yml settings about test environment and then make in terminal
rake db:test:load
Check the DB using mysql workbench if you not find errors as user permissions... delete and create again DB for app. rake db:drop && rake db:setup

Migrating db of existing project

I taking over an existing rails project. I currently trying to get the db setup. I have run rake db:create and the DB was created. I need to get the tables created. I have tried db:scheme:load, db:setup and db:migrate. All give me this error:
Mysql2::Error: Table 'blah' doesn't exist: SHOW FULL FIELDS FROM blahs
Then a long stack trace with nothing very helpful.
Thanks for any help!
Check the migrations, there would be something like 'blah' (left by developer)

MySQL server has gone away: Rails on Passenger (Redmine)

I am making use of Redmine a web based software tracking tool, its perfect for my needs. However, I keep coming across this error in my production.log.
ActiveRecord::StatementInvalid
(Mysql::Error: MySQL server has gone
away: SELECT * FROM issue_relations
WHERE (issue_relations.issue_from_id
= 6) ): app/models/issue.rb:234:in after_save'
app/controllers/issues_controller.rb:196:in
edit'
When I add a ticket or update a ticket I get the below error and the above is recorded in my logs. It returns this via the browser after about 15 seconds. I have tried it several times, other areas of the app work fine.
Internal error
An error occurred on the page you were
trying to access. If you continue to
experience problems please contact
your redMine administrator for
assistance.
Back
I am using Ruby on Rails 2.3.8 on Phusion Passenger. Gem version 1.3.7. Active record 2.3.8. mysql (2.8.1 ruby x86-mingw32 x86-mswin32, 2.7.3 mswin32).
I am not a Ruby on Rails programmer and I am at loss on what else I can do to narrow this down. I had quick Google and found that as of rails 2.3 there is an option to reconnect so in my database.yml file I placed a reconnect true, but this didn't help!
Thanks all for any help
The list of usual suspects: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html (all checkable on the MySQL-side of things).
Try putting the code from this Gist in a file in {rails application}/config/initializers/active_record_connections.rb: http://gist.github.com/238999
That said, this should probably not be happening in the first place - and if requests are taking 15 seconds to load, that also suggests that something else is going on. Can you share what appears in the logs before this error?

Running rake migrate gives Mysql error schema_migrations.frm

I am running 5.1 on Ubuntu 10.04, and the remote server is running 5.0.51, is this a problem?
Mysql::Error: Incorrect information in file: './user/schema_migrations.frm': SELECT version FROM schema_migrations
I should say that trying to install it gives the error of the package (mysql-server-5.0 referenced but not available). I believe it is available in 9.10, but how can I add those repos to 10.04?
The migrations table on the remote database was corrupt. I had to rebuild it.