Ticket #657 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

node model does not match current migrations

Reported by: richard@… Owned by: nickblack1@…
Priority: major Milestone:
Component: api Version:
Keywords: Cc: tom@…

Description

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.

Change History

comment:1 Changed 6 years ago by tom@…

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.

comment:2 Changed 6 years ago by richard@…

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?)

comment:3 Changed 6 years ago by tom@…

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.

comment:4 Changed 6 years ago by tom@…

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.

comment:5 Changed 6 years ago by richard@…

  • Summary changed from tags_as_hash missing to amf_controller needs node_tags support

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

comment:6 Changed 6 years ago by tom@…

  • Owner changed from steve@… to nickblack1@…
  • Component changed from potlatch (flash editor) to api
  • Summary changed from amf_controller needs node_tags support to node model does not match current migrations

comment:7 Changed 5 years ago by tom@…

  • Status changed from new to closed
  • Resolution set to fixed

This long since resolved.

Note: See TracTickets for help on using tickets.