Home Forums Support Whitch is the best way to update the data base model?

This topic contains 11 replies, has 2 voices, and was last updated by  Hillel Coren 3 years, 5 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
  • #2261


    Hello Hillel,

    I obtain the last code from Gitub. Now how can I update my data base model to avoid a non exist tables or columns?

    Thanks 🙂



    I just try to execute the URL : http://localhost:82/invoice/public/update

    but I get to different error:

    PDOException in Connection.php line 292:
    SQLSTATE[42S22]: Column not found: 1054 Unknown column 'payment_terms.deleted_at' in 'where clause'


    QueryException in Connection.php line 624:
    SQLSTATE[42S22]: Column not found: 1054 Unknown column 'payment_terms.deleted_at' in 'where clause' (SQL: select * from <code>payment_terms</code> where <code>payment_terms</code>.<code>deleted_at</code> is null order by <code>num_days</code> asc)

    I checked the data base and I didn’t see any change on it


    Hillel Coren

    Can you run the following SQL command to see which migrations have run:

    select * from migrations



    ofcourse! here you have the result of the query

    migration batch
    2013_11_05_180133_confide_setup_users_table 1
    2013_11_28_195703_setup_countries_table 1
    2014_02_13_151500_add_cascase_drops 1
    2014_02_19_151817_add_support_for_invoice_designs 1
    2014_03_03_155556_add_phone_to_account 1
    2014_03_19_201454_add_language_support 1
    2014_03_20_200300_create_payment_libraries 1
    2014_03_23_051736_enable_forcing_jspdf 1
    2014_03_25_102200_add_sort_and_recommended_to_gate… 1
    2014_04_03_191105_add_pro_plan 1
    2014_04_17_100523_add_remember_token 1
    2014_04_17_145108_add_custom_fields 1
    2014_04_23_170909_add_products_settings 1
    2014_04_29_174315_add_advanced_settings 1
    2014_05_17_175626_add_quotes 1
    2014_06_17_131940_add_accepted_credit_cards_to_acc… 1
    2014_07_13_142654_one_click_install 1
    2014_07_17_205900_support_hiding_quantity 1
    2014_07_24_171214_add_zapier_support 1
    2014_10_01_141248_add_company_vat_number 1
    2014_10_05_141856_track_last_seen_message 1
    2014_10_06_103529_add_timesheets 1
    2014_10_06_195330_add_invoice_design_table 1
    2014_10_13_054100_add_invoice_number_settings 1
    2014_10_14_225227_add_danish_translation 1
    2014_10_22_174452_add_affiliate_price 1
    2014_10_30_184126_add_company_id_number 1
    2014_11_04_200406_allow_null_client_currency 1
    2014_12_03_154119_add_discount_type 1
    2015_02_12_102940_add_email_templates 1
    2015_02_17_131714_support_token_billing 1
    2015_02_27_081836_add_invoice_footer 1
    2015_03_03_140259_add_tokens 1
    2015_03_09_151011_add_ip_to_activity 1
    2015_03_15_174122_add_pdf_email_attachment_option 1
    2015_03_30_100000_create_password_resets_table 1
    2015_04_12_093447_add_sv_language 1
    2015_04_13_100333_add_notify_approved 1
    2015_04_16_122647_add_partial_amount_to_invoices 1
    2015_05_21_184104_add_font_size 1
    2015_05_27_121828_add_tasks 1
    2015_05_27_170808_add_custom_invoice_labels 1
    2015_06_09_134208_add_has_tasks_to_invoices 1
    2015_06_14_093410_enable_resuming_tasks 1
    2015_06_14_173025_multi_company_support 1
    2015_07_07_160257_support_locking_account 1
    2015_07_08_114333_simplify_tasks 1
    2015_07_19_081332_add_custom_design 1
    2015_07_27_183830_add_pdfmake_support 1
    2015_08_13_084041_add_formats_to_datetime_formats_… 1
    2015_09_04_080604_add_swap_postal_code 1
    2015_09_07_135935_add_account_domain 1
    2015_09_10_185135_add_reminder_emails 1
    2015_10_07_135651_add_social_login 1
    2015_10_21_075058_add_default_tax_rates 1
    2015_10_21_185724_add_invoice_number_pattern 1
    2015_10_27_180214_add_is_system_to_activities 1
    2015_10_29_133747_add_default_quote_terms 1
    2015_11_01_080417_encrypt_tokens 1
    2015_11_03_181318_improve_currency_localization 1
    2015_11_30_133206_add_email_designs 1
    2015_12_27_154513_add_reminder_settings 1
    2015_12_30_042035_add_client_view_css 1
    2016_01_06_153144_add_invoice_font_support 1



    I think the “2016_01_04_175228_create_vendors_table” update hasn’t executed.

    How can I execute it?


    Hillel Coren

    Try running php artisan migrate from the command line.


    C:\UniServerZ\www\invoice>php artisan migrate
    *     Application In Production!     *
    Do you really wish to run this command? [y/N] y
      SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL
      : alter table <code>vendors</code> add constraint vendors_account_id_foreign foreign k
      ey (<code>account_id</code>) references <code>accounts</code> (<code>id</code>) on delete cascade)
      SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint

    thats the result


    Hillel Coren

    Are there any records in the vendors table?



    no, is empty…

    I think the error is in line 37 of “2016_01_04_175228_create_vendors_table.php”


    But I dont know why. I tried to delete the vendors table and run the command again, but I get the same error :S


    Hillel Coren

    I think you’re right that it’s the source of the error but I’m not sure why it’s failing.



    I found it!!!

    the problem was at MySQL configuration.

    By default the Storage Engine was set to “InnoDB”. I changed it to MyISAM and then the command run without errors

    Do you really wish to run this command? [y/N] y
    Migrated: 2016_01_04_175228_create_vendors_table
    Migrated: 2016_01_17_155725_add_quote_to_invoice_option
    Migrated: 2016_01_18_195351_add_bank_accounts
    Migrated: 2016_01_24_112646_add_bank_subaccounts
    Migrated: 2016_01_27_173015_add_header_footer_option
    Migrated: 2016_02_01_135956_add_source_currency_to_expenses

    well, with a little bit of luck, now we know something new!! 😀


    Hillel Coren

    Thanks for sharing the solution!

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.

Posted in: