Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [helm-dev] database creation scripts

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

Re: [helm-dev] database creation scripts

Author David Pellegrini <davidp at collab dot net>
Full name David Pellegrini <davidp at collab dot net>
Date 2000-09-13 21:32:39 PDT
Message Jason Elliot Robbins wrote:
> One difficulty that some one might be able to help me with is the
> following: how to do you populate a join table from a .sql file?
>
> The main tables like Role and Permission have autonumbered IDs, so a
> sql statement to add a Role could look like:
> insert into Role values ( null, 'Web Site Administrator');
> that way each component can define its own, and we do not need to
> agree on a numbering scheme ahead of time. But how do you populate
> RolePermission from a sql file if you dont know the numbers that go
> into the table? I would guess subselects, but mysql does not have
> those.

If you are starting with empty tables, you can specify the ID's in your insert statements, then use those ID's when inserting into the join tables. MySQL allows you to specify the ID if you want. If you don't specify and ID, it assigns one by adding 1 to the highest ID currently in the table.

-davidp

« Previous message in topic | 3 of 3 | Next message in topic »

Messages

Show all messages in topic

database creation scripts edk Ed Korthof 2000-09-13 18:59:31 PDT
     Re: [helm-dev] database creation scripts jrobbins9 Jason Robbins 2000-09-13 19:47:03 PDT
         Re: [helm-dev] database creation scripts David Pellegrini <davidp at collab dot net> David Pellegrini <davidp at collab dot net> 2000-09-13 21:32:39 PDT
Messages per page: