Evolutions for new projects

1 view
Skip to first unread message

Thomas Guettler

unread,
Oct 1, 2009, 10:27:56 AM10/1/09
to django-e...@googlegroups.com
Hi,

I use django-evolution for some days and I like it.

What do you do, if you have a raw SQL mutation, that you
want to use for new projects, too?

Example: Django does not store the default value in the database, but
I want it:

alter table foo alter column mybool set default true;

The simple solution would be to copy this line to
sql/foo.sql, but I want to stick to "Don't repeat yourself".

In this example it is just one line, but it could be more.

Did you understand what I ask?

What do you suggest?

Thomas

--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

Russell Keith-Magee

unread,
Oct 2, 2009, 9:58:08 AM10/2/09
to django-e...@googlegroups.com
On Thu, Oct 1, 2009 at 10:27 PM, Thomas Guettler <h...@tbz-pariv.de> wrote:
>
> Hi,
>
> I use django-evolution for some days and I like it.
>
> What do you do, if you have a raw SQL mutation, that you
> want to use for new projects, too?
>
> Example: Django does not store the default value in the database, but
> I want it:
>
> alter table foo alter column mybool set default true;
>
> The simple solution would be to copy this line to
> sql/foo.sql, but I want to stick to "Don't repeat yourself".
>
> In this example it is just one line, but it could be more.
>
> Did you understand what I ask?

I understand the problem, but I'm not sure I have a good solution for
you. Evolution looks at the model file, but doesn't really provide
support for the migration contents of custom SQL files.

You might be able to fake it by using a symbolic link - create your
sql/foo.sql file with the required content, then create a symlink to
evolution/migration.sql. This isn't ideal, but it does avoid
duplication of content.

Yours,
Russ Magee %_)

Thomas Guettler

unread,
Oct 5, 2009, 5:24:52 AM10/5/09
to django-e...@googlegroups.com

Russell Keith-Magee wrote:
> On Thu, Oct 1, 2009 at 10:27 PM, Thomas Guettler <h...@tbz-pariv.de> wrote:
>> Hi,
>>
>> I use django-evolution for some days and I like it.
>>
>> What do you do, if you have a raw SQL mutation, that you
>> want to use for new projects, too?

...


> I understand the problem, but I'm not sure I have a good solution for
> you. Evolution looks at the model file, but doesn't really provide
> support for the migration contents of custom SQL files.
>

> You might be able to fake it by using a symbolic link ...

It's OK, if there is no solution up to now.

I think I will use this solution: Migrations that need to be applied to
new projects, will have a special mark in the file (for
example a SQL comment -- SYNCDB.)

With a signal on post_syncdb I will run all SYNCDB mutations after
the first syncdb.

Reply all
Reply to author
Forward
0 new messages