bd on 26 Feb 2003 00:36:01 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [spoon-discuss] Now presenting... the ruleset.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 25 February 2003 07:11 pm, David E. Smith wrote:
> On Tue, 25 Feb 2003, bd wrote:
> > Dave, what fields are in your rules table?
>
> #
> # Table structure for table `nomicrules`
> #
>
> CREATE TABLE nomicrules (
>   rulekey int(11) NOT NULL auto_increment,
>   rulenum int(11) NOT NULL default '0',
>   rulerev int(11) NOT NULL default '0',
>   ruletext mediumtext NOT NULL,
>   ruletitle varchar(250) NOT NULL default '',
>   itemtype enum('rule','motion','cfj','nada','soc') NOT NULL default
> 'rule', nweek mediumint(9) NOT NULL default '0',
>   owner mediumint(9) NOT NULL default '0',
>   PRIMARY KEY  (rulekey),
>   UNIQUE KEY rulekey (rulekey),
>   KEY rulenum (rulenum),
>   FULLTEXT KEY ruletext (ruletext)
> ) TYPE=MyISAM;
>
> # rulekey is a standard key/uid kinda thing. rulenum/rev are obvious.
> # come to think of it, most of these should be obvious.
> # the only tricky bit is itemtype - mostly obvious, 'cept that the 'nada'
> # type is for removed/repealed objects. (I don't delete anything from
> # the database, except for overwritten revisions, because one never knows
> # when something might be useful later on.)
>
> #
> # Table structure for table `attribs`
> #
>
> CREATE TABLE attribs (
>   rulenum mediumint(9) default NULL,
>   keyword tinytext
> ) TYPE=MyISAM;
>
> # this is why an automated 'calculate rule priorities' script will be,
> # um, painful. This is just a list of rulenumbers and text attributes
> # like 'Layer 2' or 'Chutzpah 3' or the occasional 'Deactivated'.
> # there's cruft in there, like attributes for rules that have since been
> # repealed.

Ouch. Could you move the Layers to the main rule? You could use a simple query 
to convert the data. Something like:
UPDATE nomicrules SET layer = 1 WHERE attribs.rulenum = nomicrules.rulenum AND 
attribs.tinytext = "Layer 1" FROM attribs;

I haven't used SQL for a while, but I think that'd work...

- -- 
bd
The first time, it's a KLUDGE!
The second, a trick.
Later, it's a well-established technique!
		-- Mike Broido, Intermetrics
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+XAvUx533NjVSos4RAr8UAJ9kaEZG9m7DOChUgTBvNbDeAO5lNQCgvEZ2
CyI1lo+EA7w4WwOIwFBSAC8=
=sgPx
-----END PGP SIGNATURE-----
_______________________________________________
spoon-discuss mailing list
spoon-discuss@xxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/spoon-discuss