4. Scripts

4.1. create-doloop-table

create-doloop-table prints out CREATE TABLE statements for one or more doloop tables (which track how recently IDs were updated).

Sample usage:

create-doloop-table user_loop | mysql -D test  # or a db of your choice

which would pipe into mysql something like this:

CREATE TABLE `user_loop` (
    `id` INT NOT NULL,
    `last_updated` INT DEFAULT NULL,
    `lock_until` INT DEFAULT NULL,
    PRIMARY KEY (`id`),
    INDEX (`lock_until`, `last_updated`)
) ENGINE=InnoDB

You can set the type of the id column to something other than INT with the -i option, and the storage engine to something other than InnoDB with the -e option. For example:

create-doloop-table -i 'CHAR(64) CHARSET ascii' -e MyISAM user_loop | mysql -D test