Plugin Developer DiscussionDiscussion for FogBugz Plugin developers |
||
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.
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.
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
* 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.
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.
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.
|
Powered by FogBugz