On Feb 10, 5:07 pm, Johan Bergström <b...@bergstroem.nu> wrote:
> Hey,
>
> On Feb 10, 4:51 pm, "ludvig.ericson" <ludvig.eric...@gmail.com> wrote:
>
>
>
>
>
> > On Feb 10, 1:13 pm, Johan Bergström <b...@bergstroem.nu> wrote:
>
> > > Since Django executes my custom SQL before creating indexes, it's
> > > impossible to achieve something that hooks into initdb/syncdb. I know
> > > that it is "good custom" to create indexes after inserting data – but
> > > fixtures in Django is already executed after creating indexes, so that
> > > can't be the reason.. So, without further ado, what I would like to
> > > know is if there's a reason to why custom SQL is executed before index
> > > creation.
>
> > Isn't this doable with initial 
> > SQL?http://docs.djangoproject.com/en/dev/howto/initial-data/#initial-sql
>
> > Testing here with SQLite, it'd seem it runs the custom SQL at the very
> > last point, so you could actually add some ALTER TABLE statements, I
> > guess. Again, this is testing with SQLite, and SQLite doesn't do
> > indexing.
>
> Actually it doesn't. I think you just did a reset/sqlall instead of
> sync/initdb:
>
> # cat settings.py | grep DATABASE_E
> DATABASE_ENGINE = "sqlite3"
>
> # python manage.py syncdb
> <snip>
> Creating table testapp_message
> Creating table testapp_avatar
> Installing custom SQL for testapp.Message model
> Failed to install custom SQL for testapp.Message model: no such index:
> testapp_message_avatar_id
> Installing index testapp.Message model
> <snip>
> Installing json fixture 'initial_data' from '<snip>/fixtures'.
>
> As you most likely can tell from above, sql/message.sql contains a
> "drop index ..." operation.
>
> (nitpick: SQlite has indexes - you could of course argue their
> effectiveness :-)
>
>
>
> > Maybe I misunderstood?
>
> Perhaps I should've been more verbose :-) Thanks for your input
> though.
>
> > - Ludvig
>
> Regards,
> Johan Bergström


I took the liberty of creating a ticket with attached patch at:
http://code.djangoproject.com/ticket/10236

Thanks,
Johan Bergström

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

Reply via email to