Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

node model does not match current migrations #657

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 6 comments
Closed

node model does not match current migrations #657

openstreetmap-trac opened this issue Jul 23, 2021 · 6 comments

Comments

@openstreetmap-trac
Copy link

Reporter: richard[at]systemeD.net
[Submitted to the original trac issue database at 7.47am, Tuesday, 29th January 2008]

amf_controller is throwing an error:

[2008-01-29 09:36:38.318405 #427] NoMethodError (undefined method tags' for #<Node:0x252b654>): /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/attribute_methods.rb:205:in method_missing'
/app/models/node.rb:153:in tags_as_hash' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/associations/association_proxy.rb:124:in send'
yadda yadda

Currently the (unrewritten) putway (L352/353, 364/365, and calls to readwayquery and readwayquery_old), putpoi (L467/468, 471/472), getway_old (call to readwayquery_old), readwayquery (L550-560) and readwayquery_old (L568-621) contain SQL referring to the tags column in nodes.

The independent references in putway and putpoi are easily patched pending the rewrite into Rails. readwayquery and readwayquery_old currently get the nodes as part of a single query with a join to way_nodes (or current_way_nodes), so I guess are going to be harder.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 10.16am, Tuesday, 29th January 2008]

It's only failing because your node model is missing the (autogenerated) tags method. Have you run Nick's migrations by any chance? That would (at least try to) extract the node tags into a separate table, but none of the corresponding rails code is written so you would get a failure like this I think.

@openstreetmap-trac
Copy link
Author

Author: richard[at]systemeD.net
[Added to the original trac issue at 10.20am, Tuesday, 29th January 2008]

Have you run Nick's migrations by any chance?

Indeed... do I presume I shouldn't have, then? (and if so, how do I recreate a db without the latest migrations running?)

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 10.29am, Tuesday, 29th January 2008]

Running the migrations was a bad idea, yes ;-) The repository is not in an entirely consistent state after last week's efforts... Unfortunately one of the migrations is not reversible (or at least doesn't have code to properly reverse it) but also isn't marked as irreversible.

You could do "rake db:migrate VERSION=10" which might work, although you would loose any node tags which you had in the database.

Otherwise you will need to drop the database and recreate it from scratch - just connect as root and do "drop database openstreetmap" and then follow the instructions for creating a database.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 10.38am, Tuesday, 29th January 2008]

Oh, and don't forget that, if you recreate, you want to add VERSION=10 when running the migrations so you don't get Nick's bits.

@openstreetmap-trac
Copy link
Author

Author: richard[at]systemeD.net
[Added to the original trac issue at 10.46am, Tuesday, 29th January 2008]

Thanks - that seems to work. Have updated the wiki page temporarily too. :)

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 11.58am, Sunday, 3rd May 2009]

This long since resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant