Skip to content

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

@philsmy

Description

@philsmy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions