Results 1 to 1 of 1

Thread: Need HELP to recover cases_cstm data after dropping table in MySQL

  1. #1
    andrewdh is offline Junior Member
    Join Date
    Aug 2008
    Location
    Sydney Australia
    Posts
    5

    Default Need HELP to recover cases_cstm data after dropping table in MySQL

    LAMP Server - Sugar CE Version 5.0.0b (Build 3150) - recover dropped CASES custom field table from backup

    BEFORE I FIDDLE I would like some guidance on best approach to solve this data read problem - will ask for specific info at bottom.

    I have a backup of the custom fields table "cases_cstm" PRIOR to these actions (see attached txt of the csv export). I also have a csv file of all the records in the cases file (not attached)

    ACTIONS SO FAR - Since the cases_cstm table in MySQL was last backed up

    1. Added two new (extra) custom fields (location_c and due_date_c) to an existing custom field in cases module using studio (as attached and shown below).
    2. Updated forms and list view in studio to recognise new custom fields
    3. Updated all the existing case records (about 150) with values for these fields
    4. Exited Sugar - no users active
    5. Opened MySQL data file (using Webmin to Ubuntu server)
    6. While trying to find a way to make 'due_date_c' an index for sorting accidently "dropped" the table that is created by Sugar for custom field in MySQL (while in mysql environment as above) - oops - clicked wrong button. I gather the only table in question is "cases_cstm".
    7. I can see all the Case records in MySQL environment but Sugar will not show ANY records in Sugar Cases list view or permit addition of new records - I gather because the custom field vardefs points to the dropped table and cannot recreate it.
    8. Repair database did not solve the problem - so Sugar MUST need to have that table created before it can repair it - CORRECT?? - which is understandable


    The rest of Sugar seems to be working fine - according to our Sales department.
    I can see all the references to these fields - for example in studio, in the cases options on the list and entry screens - just cannot read any data (no errors on list) just no records retrieved.

    Only adding new records creates error - so one of my staff told me who did what I told them not to "add a new record" @#~!#$#%#!~ - I did not want to try that. At least they got a copy of the error message...

    Retrieving record by id cases:e1b9ab2e-cd81-f482-f033-4ecd937af7df found Query Failed:SELECT cases.* , cases_cstm.* FROM cases LEFT JOIN cases_cstm ON cases.id = cases_cstm.id_c WHERE cases.id = 'e1b9ab2e-cd81-f482-f033-4ecd937af7df' AND cases.deleted=0 LIMIT 0,1::MySQL error 1146:

    WHAT I NEED TO KNOW
    PS - Once we fix this HOW can I make due_date_c an index field for sorting and retrieval???

    First Choice - whatever you gurus come up with that can fix this while ideally retaining ALL the data.......

    Second Choice - Do I have enough info here and attached to just recreate the dropped table starting with the backup or are there likely to be internal links that Sugar creates in the now dropped Case Custom Fields Table which I cannot recreate easily.

    Third Choice - Can I go back a step and just read the data as it was before adding the new fields - by restoring specific Cases files from backups and if so which files - we unfortunately added and updated some case records when we did the custom fields update and I can see them in mySQL so would rather not tread on them if I do not have to.

    Attached is my full cache/modules/Cases/Casevardefs.php file and below just the three fields as copied straight from inside it for ease of reading. Also some other files including the recovered cases_cstm

    (Note two of the fields are dropdown select fields - the existing model_c and the new location_c fields).
    .
    .
    .
    'model_c' =>
    array (
    'isMultiSelect' => true,
    'required' => '0',
    'source' => 'custom_fields',
    'name' => 'model_c',
    'vname' => 'LBL_MODEL',
    'type' => 'multienum',
    'massupdate' => '0',
    'default' => '',
    'comments' => '',
    'help' => 'Select the Equipment',
    'duplicate_merge' => 'disabled',
    'duplicate_merge_dom_value' => '0',
    'audited' => 0,
    'reportable' => 0,
    'len' => 100,
    'options' => 'Model_list',
    'studio' => 'visible',
    'display_default' => 'CABFABY2',
    'id' => 'Casesmodel_c',
    'custom_module' => 'Cases',
    ),
    'location_c' =>
    array (
    'required' => '1',
    'source' => 'custom_fields',
    'name' => 'location_c',
    'vname' => 'LBL_LOCATION',
    'type' => 'enum',
    'massupdate' => '1',
    'default' => 'Customer',
    'comments' => '',
    'help' => '',
    'duplicate_merge' => 'disabled',
    'duplicate_merge_dom_value' => '0',
    'audited' => 0,
    'reportable' => 0,
    'len' => 100,
    'options' => 'Location',
    'studio' => 'visible',
    'id' => 'Caseslocation_c',
    'custom_module' => 'Cases',
    ),
    'due_date_c' =>
    array (
    'required' => '1',
    'source' => 'custom_fields',
    'name' => 'due_date_c',
    'vname' => 'LBL_DUE_DATE',
    'type' => 'date',
    'massupdate' => '0',
    'default' => NULL,
    'comments' => '',
    'help' => '',
    'duplicate_merge' => 'disabled',
    'duplicate_merge_dom_value' => '0',
    'audited' => 1,
    'reportable' => 0,
    'id' => 'Casesdue_date_c',
    'custom_module' => 'Cases',
    'default_value' => NULL,
    ),
    Attached Images Attached Images  
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Leads table error in MySQL
    By panim.park in forum Developer Help
    Replies: 3
    Last Post: 2011-09-23, 07:29 PM
  2. MYSQL Trigger on accounts_contacts table
    By jpee in forum Developer Help
    Replies: 2
    Last Post: 2011-01-04, 09:01 AM
  3. How to recover the deleted data?
    By ramji123 in forum Developer Help
    Replies: 3
    Last Post: 2008-10-10, 10:03 AM
  4. Japanese data in the database table in MySQL
    By vaishjan in forum Customer Support
    Replies: 3
    Last Post: 2006-08-01, 06:12 AM
  5. Sugar MySQL Table List
    By spriggig in forum Help
    Replies: 3
    Last Post: 2005-01-11, 09:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •