[web-devel] [Yesod] database tables migration problem.

Michael Snoyman michael at snoyman.com
Sun Feb 20 07:41:08 CET 2011


On Fri, Feb 18, 2011 at 1:23 PM, Katsutoshi Itoh <cutsea110 at gmail.com> wrote:
> Hi
>
> I am developping web service *incrementally* by using devel-server.
> This is very good feel.
> but, a bit problem occurred, when the program install and setup new mathine.
> This service's Model.hs has 2 tables these are cross-reference like as below.
>
> User
>    :
>    avatar  FileHeaderId Update
>    :
>
> FileHeader
>    :
>    creator UserId
>    :
>
>
> i settled like ...
>
> 1. migrate tables which has no column without id.
> 2. alter add columns.
>
> i think yesod should separate the migration to 2 steps.
> 1 is to create tables these has no columns without id.
> 2 is to add colums and so on.
>
> How about this?

I see the logic in it, and I'm not sure if there are any serious
downsides to it. I'm assuming you're using PostgreSQL, correct? I
don't know how well it would work for SQLite, since alter table
statements are pretty weak there. On the other hand, I don't think it
actually enforces foreign key constraints at all.

Michael



More information about the web-devel mailing list