I'm having some trouble with a django database (postgresql backend).There was a model (a profile for users) in the project with some boilerplate stuff in it. This has sat in our project for a while, not being used. I actually got round to needing this, so I adjusted the models and created some initial migrations with South. On my dev box I dropped the entire db and syncdb'ed and migrated. This worked fine.
When I've pushed this out to production, I manually removed the old tables in postgresql and syncdb'ed and migrated. However, in my admin interface a DatabaseError is raised as some function is looking for a field on the old model. I've even dropped the entire postgresql database and syncdb'ed / migrated again and this still happens. The offendinging field is called gender (not one that I created). The migration works, and the database structure reflects my models, but for some reason the admin interface wants to find this (non-existant) gender field. This is the error:
DatabaseError: column user_profiles.gender does not exist LINE 1: ... "user_profiles"."id", "user_profiles"."user_id", "user_prof...
I understand this seems to be quite site specific, but perhaps I could get some pointers on how to debug this?
Thanks
If I understand your problem, your current code should not contain a reference to "gender" any more, since the old code was removed. Try to find a source file which still contains it:
find your-dir -name '*.py'|xargs grep gender
Or there is a pyc file, but the py file was removed. But Python still loads the pyc file....
If this does not help, please post the ascii traceback.
Related
I'm trying to migrate a WordPress site to some new hosting. The site is an older site, created probably 7+ years ago. I'm getting an error from wordpress upon bringing it to the new server that gave me a heads-up that the WP tables have no prefix. Sure enough, I login to Phpmyadmin, and there are no prefixes on the tables. I have since tried several methods to add prefixes and get the site migrated, but all are coming up short:
Direct DB dump from phpmyadmin on old server, import into new server. Triggers "tables have no prefix" error
Use updraft plus to get the backup from old server, restore to new server (triggers "tables have no prefix" fatal error)
Revised #1(above) approach - db dump/import/restore, manually add (via operations tab in each table) wp_ prefix to all tables. Site loads, but logging in as admin then yields no access to wp-admin dashboard (black bar at top after login, but no options for doing anything on the dashboard). I have tried the various tricks suggested, like adding a new temp admin user or trying to make necessary changes in usermeta table to my admin user, but that doesn't resolve it.
Tried using the All In One WP Security plugin to add new prefix. It recognizes the current no prefix, but won't successfully complete adding the prefixes to the DB. Tried another plugin and didn't even get that far.
Using Phpmyadmin, I've tried to use the built-in add prefix, and that seems to not work either.
I just looked at phpmyadmin again after trying unsuccessfully to use the built-in add prefix function, and am noticing that while all tables are InnoDB, the collation is a mix of utf8_general_ci and utf8mb4_unicode_ci . I understand that the second option is probably what I want all of them to be. I was able to add prefixes to the tables that are utf8mb4_unicode_ci, but the rest of them simply do not respond to that function in phpmyadmin.
The next thing I tried was to change all the collation to utf8mb4_unicode_ci using phpmyadmin. I used the "change all tables collations" and "change all tables columns collations". That seemed to work and then allowed me to add a prefix. However, after that, while the site was still working, I could again no longer get into the wp-admin dashboard. If I were to try the same conversion but only doing the "change all tables collations" and skipping the second option, I wonder if that might work. Just tried converting the tables without converting all the columns. The site seems to still work ok after doing that. But trying again to add prefix using the AIO WP security plugin still doesn't complete.
It would seem that adding the prefix is causing the issue. Is this something that a theme could be interfering with for some reason? What am I missing here?
Any tips for moving forward with this site? Thanks so much.
You can simply dump the database, open it with a text editor, replace all occurrences of "CREATE TABLE " with "CREATE TABLE yourprefix_" and restore the database.
It should be easy, depending on the size of the dump.
I tried adding a new table into one of my models in Web2Py. In addition I added a new field to an existing table. I tried loading a page that used those tables and it didn't work, claimed those things don't exist. Okay so I get migrations to False here.
db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'], migrate = False)
Reloaded the page, no change. Then I tried doing something like this in the tables it wouldn't understand
db.define_table(....,migrate=False,fake_migrate=True)
and I changed the DAL call to be
db = DAL(...,fake_migrate_all=True)
As the web2py manual said. Still no change. So then I said well okay I will have to dumb the whole database. So I took everything out of my database folder and I tried to reload it with a clean slate.
Now it just doesn't load at all.
According to database administration none of the tables exist although if I check again in the database folder they are all there. If I try to load the application it immediately reports that none of my called tables exist. I have all the code backed up on a repo but I can't uninstall the current app because I don't have that kind of read access on the server this is running on.
Is there anything I can do?
Edit: By the way this is happening on SQLite
Have you already tried, besides dumbs DB, clean up the database folder? If you do not do this, web2py will goes insane, cuz the files says that there are tables, but db don't. Besides, take a look in here, about fixing broken migrations and some caveats about sqllite.
I'm having a problem getting started with Google BigQuery. I'm certain I have done everything correctly to create and configure the account. But when I go to the web interface, the it seems unable to find my project. I cannot create/upload any new data and I can't even query the sample data set. All the interface returns is:
Not Found: Project [my-project-id]
However, in the same window, the project name and ID is being listed in the panel on the left...so it looks like BigQuery is aware of my project in some sense. Screen shot below:
I am at a loss of how to rectify this. Does anyone have any ideas of something I might be missing in configuration and/or setup?
Best regards,
Dan
Did you recently set the ID on your project (e.g. xs-analytical-park-g)? If so, there may be a dataset that uses the old name (which was the numeric id of the projcet) which confuses the UI. We periodically search for changed project names and apply updates, but sometimes this can take a while.
I've just checked and it looks like our data should be up-to-date with respect to the project ids, so please let me know if this problem still persists.
I've been following this tutorial http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-magento-widget-part-1 to create a Magento widget as part of an extension I'm working on.
Whilst the widget was created successfully and worked as I wanted it, I changed the code and started getting the following error
Warning: Invalid argument supplied for foreach() in app/code/core/Mage/Widget/Model/Widget/Instance.php on line 502
When I changed the code back, the error was still present. However when I copied all my module to a fresh Magento install then the error wouldn't appear.
Although my widget does not explicitly use the database does anyone know if the act of installing and uninstalling a Magento widget makes changes to the core databases tables and if it does, which tables are altered.
Thanks
The core_resource table contains a list of all modules, so adding a new module will cause a new row to be created.
If you have anything in your module's sql folder, that code will be run depending on your module's version.
Without knowing exactly what code was run and changed, it's hard to know what your specific problem is.
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-6-magento-setup-resources
So if you followed that tutorial you linked to I do not think it changed any database settings.
You can tell if a module will add tables or modify table columns by the following method.
Assume the module is called Foo_Bar and it is installed in the "community" code pool (as opposed to core or local).
Navigate to app/code/community/Foo/Bar. You will at minimum usually see etc and Block directories there.
If you see a sql directory then this module makes db changes. You also need to understand a module is versioned and may initially make a certain table and then modify it.
By way of example you can go to any core module and look for the same. For example I am running Enterprise 1.12 and went to:
app/code/core/Mage/Sendfriend/sql/sendfriend_setup
I see:
mysql4-upgrade-1.5.9.9-1.6.0.0.php
mysql4-upgrade-0.7.3-0.7.4.php
mysql4-upgrade-0.7.2-0.7.3.php
mysql4-upgrade-0.7.1-0.7.2.php
mysql4-install-0.7.0.php
install-1.6.0.0.php
Note the upgrade x-y nomenclature. That is what core_resource keeps track of.
If you are wondering where your new module's settings are saved, that is actually in core_config_data. try this:
SELECT * FROM core_config_data where path like '%foo%';
Assuming you have some setting in the admin you named "foo".
Now back to your problem. That is a common php error. You are running a foreach on something which can not be iterated. The code right before that is probably not returning an array or collection or whatever.
Ideally you should always wrap the foreach with a statement that checks that the item you are iterating over is not empty.
You can also turn off displaying errors or suppress that error using the # statement which is a bad practice...
i am using cakephp 1.3 ...it was working like charm in server ,i copied it to local and executed it....after that it shows a wierd error .It says "Missing Database Table
Error: Database table inboxes for model Inbox was not found.
Notice: If you want to customize this error message, create app/views/errors/missing_table.ctp
"
things i did after copying to local:
i used same DB with different name (yes..i changed in database.php too)
But there exist table "inbox"
I tried these ways:
1.removed inbox model and controller--nothing hapened
2.removed cache file from app/tmp/cache/models ---nothing happened
3.disabled caching from core.php
when i used another table with same name as in server its working
But nothing seems to be working after i used another database name as i am using that db name for another app ....can anyone help me on this...whats really happening with this.,its urgent..thanks in advance...
As Joseph mentioned in the comment, it may be a spelling mistake. But there could be one more reason:
On the web servers sometimes (mostly on shared hosting) you have the database name prefix. So it is possible that the real name of the database on your server is different from the database on your localhost. You can configure this in your app folder config/database.php
Best regards,
Tony.
After days of headache i sorted it out.
Even if i was using same DB with different name,it was using different encoding .I created new db with uttf_genereal_ci encoding and imported old one into it.Now its working like charm.Thanks guys for helping me on this