Skip to content

Instantly share code, notes, and snippets.

@ozten
Created August 15, 2012 18:57
Show Gist options
  • Select an option

  • Save ozten/3362561 to your computer and use it in GitHub Desktop.

Select an option

Save ozten/3362561 to your computer and use it in GitHub Desktop.
A quick `node tmp.js` for printing out the schema
// If you change these schemas, please notify <[email protected]>
const schemas = [
"CREATE TABLE IF NOT EXISTS user (" +
"id BIGINT AUTO_INCREMENT PRIMARY KEY," +
"passwd CHAR(64)," +
"lastPasswordReset TIMESTAMP DEFAULT 0 NOT NULL" +
") ENGINE=InnoDB;",
"CREATE TABLE IF NOT EXISTS email (" +
"id BIGINT AUTO_INCREMENT PRIMARY KEY," +
"user BIGINT NOT NULL," +
"address VARCHAR(255) UNIQUE NOT NULL," +
"type ENUM('secondary', 'primary') DEFAULT 'secondary' NOT NULL," +
"verified BOOLEAN DEFAULT TRUE NOT NULL, " +
"FOREIGN KEY user_fkey (user) REFERENCES user(id)" +
") ENGINE=InnoDB;",
"CREATE TABLE IF NOT EXISTS staged (" +
"id BIGINT AUTO_INCREMENT PRIMARY KEY," +
"secret CHAR(48) UNIQUE NOT NULL," +
"new_acct BOOL NOT NULL," +
"existing_user BIGINT," +
"email VARCHAR(255) UNIQUE NOT NULL," +
"passwd CHAR(64)," +
"ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL," +
"FOREIGN KEY existing_user_fkey (existing_user) REFERENCES user(id)" +
") ENGINE=InnoDB;",
];
console.log(schemas);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment