tickets_full: 171

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
171 2005-07-23 19:22:34 2007-06-07 03:15:08 2019-06-24 00:17:05.428735 Unreviewed closed Database layer (models, ORM) defect normal   invalid Bug, I think, in foreign keys and SQLite Here's a dump of what should be enough info to reproduce the bug. I have to foreign keys in the django app I'm trying to build. Django messes up somewhere and creates two columns with the same name. I'm assigning to Jason because he recently blogged about adding SQLite support. If it's mis-assigned, feel free to hand it off to someone else. {{{ paulproteus@supercore:~/django/kurrency$ echo $DJANGO_SETTINGS_MODULE kurrency.settings.main paulproteus@supercore:~/django/kurrency$ echo $PYTHONPATH /home/paulproteus/django/ paulproteus@supercore:~/django/kurrency/apps/money/models$ cat money.py from django.core import meta class Person(meta.Model): fields = ( meta.CharField('name', maxlength=200), ) class Debt(meta.Model): fields = ( meta.ForeignKey(Person, related_name='owed_from'), # the person who owes money meta.ForeignKey(Person, related_name='owed_to'), # the person to whom money is owed meta.DateTimeField('date', 'date and time the debt was recorded'), meta.IntegerField('cents', 'Number of cents for which the debt is'), meta.CharField('reason', maxlength=255), meta.BooleanField('is_paid') ) paulproteus@supercore:~/django/kurrency/apps/money/models$ django-admin.py sqlindexes money CREATE INDEX money_debts_person_id ON money_debts (person_id); CREATE INDEX money_debts_person_id ON money_debts (person_id); paulproteus@supercore:~/django/kurrency$ django-admin.py init paulproteus@supercore:~/django/kurrency$ django-admin.py install money Error: money couldn't be installed. Possible reasons: * The database isn't running or isn't configured correctly. * At least one of the database tables already exists. * The SQL was invalid. Hint: Look at the output of 'django-admin.py sqlall money'. That's the SQL this command wasn't able to run. The full error: duplicate column name: person_id paulproteus@supercore:~/django/kurrency$ django-admin.py sqlall money BEGIN; CREATE TABLE money_persons ( id integer NOT NULL PRIMARY KEY, name varchar(200) NOT NULL ); CREATE TABLE money_debts ( id integer NOT NULL PRIMARY KEY, person_id integer NOT NULL REFERENCES money_persons (id), person_id integer NOT NULL REFERENCES money_persons (id), date datetime NOT NULL, cents integer NOT NULL, reason varchar(255) NOT NULL, is_paid bool NOT NULL ); INSERT INTO packages (label, name) VALUES ('money', 'money'); INSERT INTO content_types (name, package, python_module_name) VALUES ('person', 'money', 'persons'); INSERT INTO content_types (name, package, python_module_name) VALUES ('debt', 'money', 'debts'); COMMIT; }}} jacob Asheesh Laroia <asheesh@asheesh.org>   0 0 0 0 0 0
Powered by Datasette · Query took 2.416ms