MWX/SpamFerret/tables/pattern log: Difference between revisions

From Woozle Writes Code
< MWX‎ | SpamFerret‎ | tables
Jump to navigation Jump to search
(rules; changed "code" to "isWrite")
 
(ID_Archive -> ID_Old/ID_New eliminates need for double logging; removed isWrite field)
Line 3: Line 3:
** '''adding a new pattern''':
** '''adding a new pattern''':
**# if new pattern not in archive, add an entry for it
**# if new pattern not in archive, add an entry for it
**# log event with isWrite=TRUE and ID_Archive pointing to new pattern
**# log event: ID_Old=NULL, ID_New= new pattern
**# add the pattern record to {{spamferret|table|patterns}}
**# add the pattern record to {{spamferret|table|patterns}}
** '''modifying a pattern''':
** '''modifying a pattern''':
**# if old pattern not in archive, add an entry for it
**# if old pattern not in archive, add an entry for it
**# log event with isWrite=FALSE and ID_Archive pointing to old pattern
**# if new pattern not in archive, add an entry for it
**# if new pattern not in archive, add an entry for it
**# log event with isWrite=TRUE and ID_Archive pointing to new pattern
**# log event: ID_Old= old pattern, ID_New= new pattern
**# modify the record in {{spamferret|table|patterns}}
**# modify the record in {{spamferret|table|patterns}}
** '''retiring a pattern''':
** '''retiring a pattern''':
**# if old pattern not in archive, add an entry for it
**# if old pattern not in archive, add an entry for it
**# log event with isWrite=FALSE and ID_Archive pointing to old pattern
**# log event: ID_Old= old pattern, ID_New = NULL
**# log event with isWrite=TRUE and ID_Archive = NULL
**# delete the record in {{spamferret|table|patterns}}
* '''History''':
* '''History''':
** '''2009-08-05''' Created for Special:SpamFerret
** '''2009-08-05''' Created for Special:SpamFerret
Line 21: Line 20:
   `ID`        INT    NOT NULL AUTO_INCREMENT,
   `ID`        INT    NOT NULL AUTO_INCREMENT,
   `ID_Pattern` INT    NOT NULL COMMENT "patterns.ID of pattern being altered",
   `ID_Pattern` INT    NOT NULL COMMENT "patterns.ID of pattern being altered",
   `ID_Archive` INT DEFAULT NULL COMMENT "pattern_archive.ID of archived pattern being accessed",
   `ID_Old` INT DEFAULT NULL COMMENT "pattern_archive.ID of old value of pattern being edited",
   `isWrite` TINYINT(1) NOT NULL COMMENT "type of event"
   `ID_New` INT DEFAULT NULL COMMENT "pattern_archive.ID of new value of pattern being edited",
  `Notes` VARCHAR(255) DEFAULT NULL COMMENT "human-entered notes explaining reason for change"
)ENGINE = MYISAM;</mysql>
)ENGINE = MYISAM;</mysql>

Revision as of 20:37, 5 August 2009

About

  • Rules:
    • adding a new pattern:
      1. if new pattern not in archive, add an entry for it
      2. log event: ID_Old=NULL, ID_New= new pattern
      3. add the pattern record to Template:Spamferret
    • modifying a pattern:
      1. if old pattern not in archive, add an entry for it
      2. if new pattern not in archive, add an entry for it
      3. log event: ID_Old= old pattern, ID_New= new pattern
      4. modify the record in Template:Spamferret
    • retiring a pattern:
      1. if old pattern not in archive, add an entry for it
      2. log event: ID_Old= old pattern, ID_New = NULL
      3. delete the record in Template:Spamferret
  • History:
    • 2009-08-05 Created for Special:SpamFerret

SQL

<mysql>CREATE TABLE `pattern_log` (

 `ID`         INT     NOT NULL AUTO_INCREMENT,
 `ID_Pattern` INT     NOT NULL COMMENT "patterns.ID of pattern being altered",
 `ID_Old` INT DEFAULT NULL COMMENT "pattern_archive.ID of old value of pattern being edited",
 `ID_New` INT DEFAULT NULL COMMENT "pattern_archive.ID of new value of pattern being edited",
 `Notes` VARCHAR(255) DEFAULT NULL COMMENT "human-entered notes explaining reason for change"

)ENGINE = MYISAM;</mysql>