For sqlite3, you don't even need to create an empty db. Just put the desired
filename in your settings.py for the database name and run

python manage.py syncdb

and the database will be created along with all the tables based on the
models for all the installed apps. You don't actually need to run the sql
command unless you're just interested in what Django is going to do when you
run syncdb. Or you're going to manually run the SQL or modify it to alter
existing structure.

I'm not sure if I'm misunderstanding, but it sounds like you made the
changes in the database without making the changes to your models. It's all
about the models! Make the changes there then re-run syncdb. Hope this helps
some. There really aren't any lines to change, just a process to follow.

On Wed, Mar 3, 2010 at 1:47 AM, gintare <g.statk...@gmail.com> wrote:

> Hello.
>
> to summarize the question is
>
> which lines has to be changed when the database file i.e, referenc.db
> is deleted and later created manually as empty database?
>
> The problem is that i created whole project a week before.
>  Later i modified modules, added new tables and new fields (Rrest
> column was added for sure in table Areferenc_aref).
>  I deleted empty database file referenc.db, created new database file
> referenc.db manually expecting that new tables will be generated with
> additional fields for hem.
>
> Nevertheless the django finds only old columns.
>
> besides i made one check:
>
> 1) first of all i totally deleted referenc.db again. For big surprise
> command manage.py syncdb runs without mistakes.
>
> Besides python manage.py sql Areferenc  generates tables for non
> existing database.
>
> ^Cworking:/opt/pages/referenc# python manage.py sql Areferenc
>
> BEGIN;
> CREATE TABLE "Areferenc_aref" (
>    "id" integer NOT NULL PRIMARY KEY,
>    "Rfirstauthor" varchar(500) NOT NULL,
>     "Rauthors" varchar(500) NOT NULL,
>    "Rjournal" varchar(500) NOT NULL,
>    "Rrest" varchar(500) NOT NULL,
>    "Rpage" varchar(500) NOT NULL,
>    "Rissue" integer NOT NULL,
>     "Rvolume" integer NOT NULL,
>    "Ryear" integer NOT NULL,
>    "Rtitle" varchar(500) NOT NULL,
>    "Rkeyw" varchar(500) NOT NULL,
>    "Rurl" varchar(200) NOT NULL,
>     "Rindex" varchar(500) NOT NULL,
>    "Rname" varchar(500) NOT NULL,
>    "Rdoi" varchar(500) NOT NULL,
>    "Rlink" varchar(100) NOT NULL,
>    "Rmail" varchar(75) NOT NULL,
>     "Rconcl" text NOT NULL,
>    "Rexists" bool NOT NULL,
>    "Rinst" varchar(500) NOT NULL
> )
> ;
> CREATE TABLE "Areferenc_experimental" (
>    "id" integer NOT NULL PRIMARY KEY,
>     "Rexp" varchar(500) NOT NULL
> )
> ;
> CREATE TABLE "Areferenc_characterization" (
>    "id" integer NOT NULL PRIMARY KEY,
>    "Rchar" varchar(500) NOT NULL
> )
> ;
>  CREATE TABLE "Areferenc_devices" (
>    "id" integer NOT NULL PRIMARY KEY,
>    "Rdev" varchar(500) NOT NULL
> )
> ;
> CREATE TABLE "Areferenc_calculations" (
>    "id" integer NOT NULL PRIMARY KEY,
>     "Rcal" varchar(500) NOT NULL
> )
> ;
> CREATE TABLE "Areferenc_afieldorder" (
>    "id" integer NOT NULL PRIMARY KEY,
>    "Rorder" varchar(500) NOT NULL
> )
> ;
> CREATE TABLE "Areferenc_aref_Rexperimental" (
>     "id" integer NOT NULL PRIMARY KEY,
>    "aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
>    "experimental_id" integer NOT NULL REFERENCES
> "Areferenc_experimental" ("id"),
>     UNIQUE ("aref_id", "experimental_id")
> )
> ;
> CREATE TABLE "Areferenc_aref_Rcharacterization" (
>    "id" integer NOT NULL PRIMARY KEY,
>    "aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
>     "characterization_id" integer NOT NULL REFERENCES
> "Areferenc_characterization" ("id"),
>    UNIQUE ("aref_id", "characterization_id")
> )
> ;
> CREATE TABLE "Areferenc_aref_Rdevice" (
>     "id" integer NOT NULL PRIMARY KEY,
>    "aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
>    "devices_id" integer NOT NULL REFERENCES
> "Areferenc_devices" ("id"),
>     UNIQUE ("aref_id", "devices_id")
> )
> ;
> CREATE TABLE "Areferenc_aref_Rcalculation" (
>    "id" integer NOT NULL PRIMARY KEY,
>    "aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
>     "calculations_id" integer NOT NULL REFERENCES
> "Areferenc_calculations" ("id"),
>    UNIQUE ("aref_id", "calculations_id")
> )
> ;
> COMMIT
>
> 2) Secondly I created referenc.db in  ./referenc manually again.
>
> generated tables with command mentioned in step1 with the same output
> (table Areferenc_aref contains column Rrest )
>
> performed manage.py syncdb, which went fluently without mistakes.
>
> executing view i am getting error:
>
> Exception Type:
> OperationalError
>  Exception Value:
> table Areferenc_aref has no column named Rrest
>  Exception Location:
> /usr/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
> execute, line 193
>
>  :
>
>
> :
>
>
>  regards,
> gintare
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to