# Database Error When Adding Entry With Multisite Manager

I have recently set up a second site using Multisite Manager with ExpressionEngine 2.5.2. I got everything working smoothly on my local environment, however, when I try to add entries through ExpressionEngine to my production server, I get the following database errors

``````A Database Error Occurred
Error Number: 1054

Unknown column 'field_id_147' in 'field list'

INSERT INTO `exp_channel_data` (`entry_id`, `channel_id`, `site_id`, `field_id_147`, `field_id_148`, `field_id_149`, `field_id_150`, `field_id_151`, `field_id_152`, `field_id_153`, `field_id_154`, `field_id_155`, `field_id_156`, `field_id_157`, `field_id_159`, `field_id_165`, `field_id_166`, `field_id_162`, `field_id_160`, `field_id_158`, `field_id_161`, `field_ft_147`, `field_ft_148`, `field_ft_149`, `field_ft_150`, `field_ft_151`, `field_ft_152`, `field_ft_153`, `field_ft_154`, `field_ft_155`, `field_ft_156`, `field_ft_157`, `field_ft_158`, `field_ft_159`, `field_ft_165`, `field_ft_166`, `field_ft_161`, `field_ft_162`, `field_ft_160`, `field_id_1`, `field_id_2`, `field_id_3`, `field_id_4`, `field_id_5`, `field_id_6`, `field_id_7`, `field_id_8`, `field_id_9`, `field_id_10`, `field_id_11`, `field_id_12`, `field_id_13`, `field_id_14`, `field_id_15`, `field_id_16`, `field_id_17`, `field_id_18`, `field_id_19`, `field_id_20`, `field_id_21`, `field_id_22`, `field_id_23`, `field_id_24`, `field_id_25`, `field_id_26`, `field_id_27`, `field_id_28`, `field_id_29`, `field_id_30`, `field_id_31`, `field_id_32`, `field_id_33`, `field_id_34`, `field_id_35`, `field_id_36`, `field_id_37`, `field_id_38`, `field_id_39`, `field_id_40`, `field_id_41`, `field_id_42`, `field_id_43`, `field_id_44`, `field_id_45`, `field_id_46`, `field_id_47`, `field_id_48`, `field_id_49`, `field_id_50`, `field_id_51`, `field_id_52`, `field_id_53`, `field_id_54`, `field_id_55`, `field_id_56`, `field_id_57`, `field_id_58`, `field_id_59`, `field_id_60`, `field_id_61`, `field_id_62`, `field_id_64`, `field_id_65`, `field_id_66`, `field_id_67`, `field_id_68`, `field_id_69`, `field_id_70`, `field_id_71`, `field_id_72`, `field_id_73`, `field_id_74`, `field_id_75`, `field_id_76`, `field_id_77`, `field_id_78`, `field_id_79`, `field_id_80`, `field_id_81`, `field_id_82`, `field_id_83`, `field_id_84`, `field_id_85`, `field_id_86`, `field_id_87`, `field_id_88`, `field_id_89`, `field_id_90`, `field_id_91`, `field_id_92`, `field_id_93`, `field_id_94`, `field_id_95`, `field_id_96`, `field_id_97`, `field_id_98`, `field_id_99`, `field_id_100`, `field_id_101`, `field_id_102`, `field_id_103`, `field_id_104`, `field_id_105`, `field_id_106`, `field_id_107`, `field_id_108`, `field_id_110`, `field_id_111`, `field_id_112`, `field_id_113`, `field_id_114`, `field_id_115`, `field_id_116`, `field_id_117`, `field_id_118`, `field_id_119`, `field_id_120`, `field_id_121`, `field_id_122`, `field_id_123`, `field_id_124`, `field_id_125`, `field_id_126`, `field_id_127`, `field_id_128`, `field_id_129`, `field_id_130`, `field_id_131`, `field_id_132`, `field_id_133`, `field_id_134`, `field_id_135`, `field_id_136`, `field_id_137`, `field_id_138`, `field_id_163`, `field_id_164`) VALUES (140, '20', '2', '', 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '')

Filename: libraries/api/Api_channel_entries.php

Line Number: 1831
``````

If I create the column 'field_id_147' in 'field list' in my database, when i go to create an entry in ExpressionEngine, the error returns with a higher number (field_id_148, field_id_149, etc.)

Any ideas as to what's happening here or any way I can fix it?

Originally I was having a similar issue on my local environment (question posted here), but solved the issue by replacing my system folder with a working copy from another computer. I'd prefer to not do that, considering this is no longer my local environment and I run into the issue of all of my live sites being affected.

Whenever adding something to your site, you'll typically want to start with Production, and then copy your Production database down to dev. If you're installing modules, core or add-on, and those are creating new database tables or columns, you've only made those database schema changes in the environment where you clicked "Enable" - Dev in your case.

My typical workflow for any add-on to an existing site is:

1. Drop the add-on files into my site locally/in dev.
2. Push that to git.
3. Deploy to the live server.
6. Mysqldump the Production db, pull it down, and import that locally.

In the case of Multi-Site Manager, the module files already existed on Production.

Only at that point am I ready to start using the add-on or module in my dev environment.

This goes for new channel fields or channels as well. If the site's live, I add the fields I need on Production before starting dev, and grab a dump of the Production DB to use locally. It's always a one-way flow, and there are never inconsistencies.

I think your best option at this point, now that you've deployed the updated files to Production, would be to install the module using your Production CP, NOT to start creating database columns manually. Let Multi-Site Manager do its thing.

The only portion of your EE app that's portable is your add-on & template files. You can move those back and forth and they can work with anything installed. If your site is live, always consider your Production DB the master and the point of origin for installations/updates. Sometimes you need to do a dry-run in dev, which is fine. But consider that a test run, document the steps you took, and reproduce those steps on Production. Then pull your Production DB down to work with the latest data.

And back up your Production DB before following any steps prescribed here :)

• Hi Mark, I was able to solve the issue, following some general guidelines from your answer. On my production server, I deleted any fields, entries, categories, etc that were associated with my second site in my mysql database that were somehow duplicated from my primary site. I then manually added all of my new fields for my second site through the expressionengine control panel. I got my production site working smoothly (w/o touching anything that was live on my primary site), then exported my production database. I then imported it into my staging and local database & all sites are working. Jan 31, 2013 at 17:37