Missing table field: Unknown column 'ca_objects.access' .... missing migrations?

I'm getting an error about a missing table field in ca_objects: 'access'.

I assume there is a missing migration. Any idea how I should go about fixing this, and checking for other missing migrations?

Thanks

Bruce

Unknown column 'ca_objects.access' in 'where clause' in /xxxxxxxxxl/pa2/app/lib/Db/mysqli.php line 316:

  1. In Db_mysqli->execute(Object DbStatement, Object DbStatement, 'SELECT DISTINCT ca_object_representations.media, ca_storage_locations.location_id FROM ca_storage_locations INNER JOIN ca_objects_x_storage_locations ON ca_objects_x_storage_locations.location_id = ca_storage_locations.location_id INNER JOIN ca_objects as ca_objectsx ON ca_objects.object_id = ca_objects_x_storage_locations.object_id INNER JOIN ca_objects_x_object_representations ON ca_objects_x_object_representations.object_id = ca_objects.object_id INNER JOIN ca_object_representations ON ca_object_representations.representation_id = ca_objects_x_object_representations.representation_id WHERE ca_objects_x_object_representations.is_primary = 1 AND ca_objects.access IN (1) AND ca_object_representations.access IN (1) AND ca_storage_locations.location_id IN (?) ', Array(1), ) in DbStatement line 151


Comments

  • edited August 22

    OK, I figured it out...this has to do with an old modification I made to /app/helpers/themeHelper.php to allow browsing on object_lots.

  • The field is there. The query is wrong. Where is this being generated?

  • OK, so here is what's going on.

    In PAW2, /app/helpers/themeHelpers.php ~ line 870'sh

    The Original SQL:

    $vs_sql = "SELECT DISTINCT ca_object_representations.media, {$vs_table}.{$vs_pk}

    FROM {$vs_table}

    INNER JOIN {$vs_linking_table} ON {$vs_linking_table}.{$vs_pk} = {$vs_table}.{$vs_pk}

    INNER JOIN ca_objects ON ca_objects.object_id = {$vs_linking_table}.object_id

    INNER JOIN ca_objects_x_object_representations ON ca_objects_x_object_representations.object_id = ca_objects.object_id

    INNER JOIN ca_object_representations ON ca_object_representations.representation_id = ca_objects_x_object_representations.representation_id

    WHERE

    ca_objects_x_object_representations.is_primary = 1 {$vs_access_wheres} {$vs_rel_type_where} {$vs_type_where} {$vs_id_sql}";


    Will throw an error when browsing Object_lots: Not unique table/alias: 'ca_objects' in /xxxxxxx/pa2/app/lib/Db/mysqli.php line 316:


    I modified the SQL adding "as ca_objectsx".

    $vs_sql = "SELECT DISTINCT ca_object_representations.media, {$vs_table}.{$vs_pk}

    FROM {$vs_table}

    INNER JOIN {$vs_linking_table} ON {$vs_linking_table}.{$vs_pk} = {$vs_table}.{$vs_pk}

    INNER JOIN ca_objects as ca_objectsx ON ca_objects.object_id = {$vs_linking_table}.object_id

    INNER JOIN ca_objects_x_object_representations ON ca_objects_x_object_representations.object_id = ca_objects.object_id

    INNER JOIN ca_object_representations ON ca_object_representations.representation_id = ca_objects_x_object_representations.representation_id

    WHERE

    ca_objects_x_object_representations.is_primary = 1 {$vs_access_wheres} {$vs_rel_type_where} {$vs_type_where} {$vs_id_sql}

    ";

    My error was forgetting to change ca_objects.access to ca_objectsx.access ~L139:

    $vs_access_wheres = " AND ca_objectsx.access IN (".join(",", $pa_access_values).") AND ca_object_representations.access IN (".join(",", $pa_access_values).")";


    It seems to be working now, but I guess themeHelpers.php should get fixed.

    What is the current process for opening up an issue? https://collectiveaccess.atlassian.net/ seems to only be for PROV. or should I post issues on github?

    Thank you

    Bruce

  • Use GitHub issues please.

Sign In or Register to comment.