Sanitizing Database for Testing



If you have a test instance of FogBugz with a separate database, you may want to be certain that it will not interfere with anything that your production instance is using. The sanitizing script covered in this article ensures your primary database remains safe and unaffected.

This article is useful for the Level 2 agents and administrators who are experienced with scripting and databases.

CAUTION! DO NOT run this script against your active FogBugz database – this deletes data from the database without backing it up.


  • Use the sanitizer script to ensure no conflicts occur with the mailboxes.

    • It sets the correct AuthType so you can get into your test instance without a password.
    • This is useful if you want to periodically refresh the data in your test instance with the latest backup from your production instance.
  • If you are running FogBugz On-Site, there may be more to do depending on how your test installation is configured.

    Contact us, and we will be happy to make sure you have got everything you need!


    Please note the following side-effects of the configurations mentioned below:
    • DELETE FROM MailQueue: Removes all the pending mails in the queue so the system does not show an error message in the notification area.
    • UPDATE Mailbox SET fDeleted = 1: Deletes any mailbox configuration from the system to prevent the server to attempt retrieving live email cases.
    • UPDATE Setting SET sValue = 'NONE' WHERE sKey= 'sSMTPServer': Disables the send mail functionality. This further has the following side-effects:

      • The system stops sending e-mail notifications.
      • Disables the Subscription option on cases.
      • Disables the Forgot password function (user will be redirected to the homepage).
    -- Remove pending outgoing mail
    FROM MailQueue;
    -- Turn off outgoing emails to FogBugz Users
    UPDATE Person
    SET fNotify = 0,
        fEscalationReport = 0;
    -- Disable Mailboxes so you don't pull emails into test
    UPDATE Mailbox
    SET fDeleted = 1;
    -- Unsubscribe all users
    FROM Subscriptions;
    -- Don't ever send email
    UPDATE Setting
    SET sValue = 'NONE' 
    WHERE sKey= 'sSMTPServer';
    -- Use Passwords instead of e.g., LDAP
    UPDATE Setting
    SET sValue = '1'
    WHERE sKey= 'fPasswordEnable';
    UPDATE Setting
    SET sValue = '0'
    WHERE sKey= 'iAuthType';
    -- Update the base URL so internal links and redirects do not point to production (you will need to supply an appropriate value)
    UPDATE Setting
    SET sValue = '' 
    WHERE sKey = 'sUrlPrefixEmail';

    Back to top