Hey Oleg,

gabriel is right. Using database ids with outside systems (your
accounting system) is a bad idea and a database design no-no for all
sorts of reasons.. One issue is that you're coding only for your
current situation, but what happens when your accounting system
changes? Or when you need a partial data-restore and merge things with
data that has been entered in the meantime.. Lastly, as you noticed,
most admin generators don't allow you to update id's, so that's a
pretty good indicator that the industry as a whole thinks it's a bad
idea.

As for your Tag example, not sure I understand. Of course internally
IDs are being used and bound via foreign key constraints. That would
still be the case for your contract IDs, but to the outside world
(your accounting system), you'd simply use a different column to store
your accounting id.

Daniel



On May 23, 2:47 am, Oleg Sverdlov <oleg.sverd...@gmail.com> wrote:
> There are situations that using ID is a good thing DB-wise.
>
> For instance, take a table of Tags, with each tag being unique.  The table
> is bound with foreign keys with ON UPDATE CASCADE clause. Why would we need
> another unique field?
>
> Oleg
>
>
>
> On Sun, May 23, 2010 at 12:22 PM, pghoratiu <pghora...@gmail.com> wrote:
> > I think that you are going the wrong way to solve this.
>
> > I would leave the id as is in the database and create a separate field
> > "contract_id" that you
> > change the way you want. This number should be set only when the
> > contract is finalized.
>
> > I think that messing with the id directly will give you a lot of
> > headaches in the long run.
>
> >    gabriel
>
> > On May 23, 1:56 am, Mihai Rusoaie <mi...@rusoaie.com> wrote:
> > > Hello!
>
> > > Thanks, Gabriel! I will try that!
>
> > > Tom: we have a very twisted sales team :)
>
> > > We send the sales guys in the field with pre-filled contracts to be
> > signed.
> > > We number these contracts each morning with consecutive numbers: 1,2,3,4
> > and
> > > we insert them in the DB and associate with potential customers. When
> > they
> > > come back to the office in the evening we realise that customer with
> > > contract 2 changed his mind and do not want to sign, so the sales guy
> > > deletes it from the database. But the accounting cannot accept that a
> > > contract is missing from the numbering. And the MySQL autoincrement does
> > not
> > > count that a number is missing so the next contract will have no. 5.
> > Which
> > > has to be changed by our back-office support to "2". There would be
> > another
> > > way not to use the id for contract number; but it's easier and more
> > > intuitive...
>
> > > Hope I was clear,
>
> > > Mihai Rusoaie
> > > +40 72 RUSOAIEwww.rusoaie.com
>
> > --
> > If you want to report a vulnerability issue on symfony, please send it to
> > security at symfony-project.com
>
> > You received this message because you are subscribed to the Google
> > Groups "symfony users" group.
> > To post to this group, send email to symfony-users@googlegroups.com
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/symfony-users?hl=en
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

Reply via email to