Skip to content
New issue

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

if id is string hierarchies table can't update #91

Closed
philsmy opened this issue Jan 31, 2014 · 1 comment
Closed

if id is string hierarchies table can't update #91

philsmy opened this issue Jan 31, 2014 · 1 comment

Comments

@philsmy
Copy link

philsmy commented Jan 31, 2014

We use uuid's (strings) as our primary key. When inserting a first child we get an error. It looks to me like it is expecting the descendant_id to be 0.

Trying to add a child we get this:

  (0.3ms)  BEGIN
  SQL (0.4ms)  INSERT INTO `event_paths` (`created_at`, `id`, `name`, `parent_id`, `type`, `updated_at`) VALUES ('2014-01-31 13:00:53', '8a056cfd-1eff-4e5d-9c9f-e45364215ad5', '6 Nations Qualifier', 0, 'TournamentStage', '2014-01-31 13:00:53')
   (0.2ms)  SELECT GET_LOCK('closure_tree', 0), 1391173253.393158
  SQL (0.2ms)  INSERT INTO `event_path_hierarchies` (`ancestor_id`, `descendant_id`, `generations`) VALUES ('8a056cfd-1eff-4e5d-9c9f-e45364215ad5', '8a056cfd-1eff-4e5d-9c9f-e45364215ad5', 0)
   (46.1ms)   INSERT INTO `event_path_hierarchies`
 (ancestor_id, descendant_id, generations)
 SELECT x.ancestor_id, '8a056cfd-1eff-4e5d-9c9f-e45364215ad5', x.generations + 1
 FROM `event_path_hierarchies` x
 WHERE x.descendant_id = 0

Mysql2::Error: Truncated incorrect DOUBLE value: '8a056cfd-1eff-4e5d-9c9f-e45364215ad5':             INSERT INTO `event_path_hierarchies`
              (ancestor_id, descendant_id, generations)
            SELECT x.ancestor_id, '8a056cfd-1eff-4e5d-9c9f-e45364215ad5', x.generations + 1
            FROM `event_path_hierarchies` x
            WHERE x.descendant_id = 0
@philsmy
Copy link
Author

philsmy commented Jan 31, 2014

Never mind. The issue was in the model we had not change parent_id to be a string.
Leaving this here in case others stumble too.

@philsmy philsmy closed this as completed Jan 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant