Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install issues - DB #26

Open
josmas opened this issue Jun 29, 2013 · 3 comments
Open

Install issues - DB #26

josmas opened this issue Jun 29, 2013 · 3 comments

Comments

@josmas
Copy link

josmas commented Jun 29, 2013

Hi guys, on a clean install, I am having issues with migrations and loading test data.

After doing syncdb, I get the following message:

Not synced (use migrations):
 - badge
 - project
 - media
 - p2pu_user
(use ./manage.py migrate to migrate these)

After running migrations I get:

> badge:0006_adding_featured_badges
 - Migration 'badge:0006_adding_featured_badges' is marked for no-dry-run.
 ! Error found during real run of migration! Aborting.

 ! Since you have a database that does not support running
 ! schema-altering statements in transactions, we have had
 ! to leave it in an interim state between migrations.

[...]

in get
    return self.get_query_set().get(*args, **kwargs)
  File "/Users/jos/.venvs/badges/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get
    % self.model._meta.object_name)
badge.models.DoesNotExist: Badge matching query does not exist.

Skipping migrations and going directly to load test data I get:

  File "/Users/jos/.venvs/badges/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 344, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: no such table: p2pu_user_user

Finally, loading the app in the browser I get:

Request Method: GET
Request URL:    http://127.0.0.1:8000/en/
Django Version: 1.4.5
Exception Type: DatabaseError
Exception Value:    
no such table: badge_badge

There seems to be a problem with table names; will dig in a bit more, but not sure how much I can do. This is a new install, with a new virtualenv only used for this project, on mac osx 10.8.3 and python 2.7.2

Thanks!

@josmas
Copy link
Author

josmas commented Jun 29, 2013

OK, mystery solved!

It turns out that migration 0006 in badge is looking for a few hardcoded PKs to make those badges featured badges_pk_list = [36, 22, 47, 27, 8].

I guess this is used in the production system? Not sure what you guys want to do with it, but I'd say it shouldn't be part of the migrations. It won't work unless the right data is entered, right?

@dirkcuys
Copy link
Member

dirkcuys commented Jul 1, 2013

I agree. The db migrations should run successfully from a clean start.

@ercchy what do you think?

@ercchy
Copy link
Contributor

ercchy commented Jul 1, 2013

Hi guys,

yes the 0006 migration is actually providing me with some featured badges that we are presenting on the home page. Since the request was quite clear on which these badges should be I just made an migration.
Meanwhile I myself had an issue with it and was doing the code refactorization just the other day. So fix for this issue will come up today indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants