Plugin Developer Discussion

Discussion for FogBugz Plugin developers

Autonumbers in custom DB schema

I am wriging a IPluginDatabase plugin, but there doesn't appear to be a way to create Identity columns or Guid columns. Either would fill the need I have, and both are reasonable to expect in a db api.
Stefan Rusek Send private email
Tuesday, April 21, 2009
 
 
After looking some, I found that the SetPrimaryKey() method adds an identity column. This is not at all intuitive. From the name I expected to AddIntColumn(), then call SetPrimaryKey() passing the same name. It also makes it seem like I can't create a primary key column that is not an identity column, which makes a 1 to 1 relationship with the Bug table harder and more error prone.
Stefan Rusek Send private email
Tuesday, April 21, 2009
 
 
Hi Stefan,

We were hoping our IPluginDatabase example might be able to guide folks through this, but maybe we buried it a little too deep in the documentation?

https://developers.fogbugz.com/default.asp?W19
Dan Wilson Send private email
Tuesday, April 21, 2009
 
 
* SetPrimaryKey() is named poorly since it does way more than what the name implies. It is more like AddIdentityAndSetPrimaryKey().

* There is no way to make a GUID column.

* There is no way to make a non-identity primary key.

An example of when this third option would be useful is when adding new fields to the bug view. This is a 1 to 1 relationship, and so the table with the new fields should have the same primary key as the Bug table. This means the primary key should be ixBug and an integer, but not an autonumber. The custom field example in the documentation does this wrong.
Stefan Rusek Send private email
Wednesday, April 22, 2009
 
 
I don't think we'll add GUID column support for this release, since it doesn't seem to be supported natively in MySQL.

If we rename SetPrimaryKey to AddAutoNumberPrimaryKey, is that clear enough?

As far as non-identity primary keys, I'll open a feature request for it but we may not get to it before release.
David Fullerton Send private email
Wednesday, April 22, 2009
 
 
It solves the missleading name problem, though I would really prefer it be split into 2 different methods, since an autonumber need not be a primary key and a primary key need not be an autonumber. Non-identity primary keys are pretty fundamental database concept.
Stefan Rusek Send private email
Wednesday, April 22, 2009
 
 
I agree, but that would require adding functionality vs. just changing a name.  The latter is much more likely to fit into the schedule.
David Fullerton Send private email
Wednesday, April 22, 2009
 
 
SetPrimaryKey has been renamed to AddAutoIncrementPrimaryKey.  For version 1 of the plugin architecture, we will only support auto-increment primary keys, but I'll keep the case open to add support for more types of primary keys.
David Fullerton Send private email
Monday, May 18, 2009
 
 
Cool, thanks
Stefan Rusek Send private email
Monday, May 18, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz