private static function createAuthTable() { $createDefault = db_get_create_default(); $updateDefault = db_get_update_default(); $query = "CREATE TABLE IF NOT EXISTS blogAuth(" . "authId CHAR(64) NOT NULL, " . "userId CHAR(32) NOT NULL, " . "created TIMESTAMP(6) DEFAULT {$createDefault}, " . "updated TIMESTAMP(6) DEFAULT {$updateDefault}, " . "expiration CHAR(16), " . "PRIMARY KEY(authId, updated) " . ")"; if (!mysql_query($query)) { print $query . "<br/>"; print "Error: " . mysql_error() . "<br/>"; } }
private static function createCommentTable() { $createDefault = db_get_create_default(); $updateDefault = db_get_update_default(); $query = "CREATE TABLE IF NOT EXISTS blogComment(" . "tripId CHAR(32) NOT NULL, " . "commentId CHAR(32) NOT NULL, " . "created TIMESTAMP(6) DEFAULT {$createDefault}, " . "updated TIMESTAMP(6) DEFAULT {$updateDefault}, " . "userId CHAR(32) NOT NULL, " . "referenceId char(32), " . "commentText TEXT, " . "deleted CHAR(1), " . "hash CHAR(32), " . "PRIMARY KEY(tripId, commentId, updated), " . "KEY(tripId, referenceId, updated) " . ")"; if (!mysql_query($query)) { print $query . "<br/>"; print "Error: " . mysql_error() . "<br/>"; return false; } return true; }
private static function createMediaTable() { $createDefault = db_get_create_default(); $updateDefault = db_get_update_default(); $query = "CREATE TABLE IF NOT EXISTS blogMedia(" . "tripId CHAR(32) NOT NULL, " . "mediaId CHAR(32) NOT NULL, " . "created TIMESTAMP(6) DEFAULT {$createDefault}, " . "updated TIMESTAMP(6) DEFAULT {$updateDefault}, " . "type CHAR(16), " . "caption TEXT, " . "timestamp CHAR(32), " . "location CHAR(48), " . "width CHAR(8), " . "height CHAR(8), " . "deleted CHAR(1), " . "hash CHAR(32), " . "PRIMARY KEY(mediaId, updated) " . ")"; if (!mysql_query($query)) { print $query . "<br/>"; print "Error: " . mysql_error() . "<br/>"; return false; } return true; }
private static function createTable() { $createDefault = db_get_create_default(); $updateDefault = db_get_update_default(); $query = "CREATE TABLE IF NOT EXISTS blogTripAttribute(" . "tripId CHAR(32) NOT NULL, " . "name CHAR(32), " . "created TIMESTAMP(6) DEFAULT {$createDefault}, " . "updated TIMESTAMP(6) DEFAULT {$updateDefault}, " . "value TEXT, " . "deleted CHAR(1), " . "hash CHAR(32), " . "PRIMARY KEY(tripId, name, updated) " . ")"; if (!mysql_query($query)) { print $query . "<br/>"; print "Error: " . mysql_error() . "<br/>"; return false; } return true; }
private static function createJournalTable() { $createDefault = db_get_create_default(); $updateDefault = db_get_update_default(); $query = "CREATE TABLE IF NOT EXISTS blogJournal(" . "tripId CHAR(32) NOT NULL, " . "journalId CHAR(32) NOT NULL, " . "created TIMESTAMP(6) DEFAULT {$createDefault}, " . "updated TIMESTAMP(6) DEFAULT {$updateDefault}, " . "userId CHAR(32) NOT NULL, " . "journalDate char(10), " . "journalTitle VARCHAR(128), " . "journalText TEXT, " . "deleted CHAR(1), " . "hash CHAR(32), " . "PRIMARY KEY(journalId, updated) " . ")"; if (!mysql_query($query)) { print $query . "<br/>"; print "Error: " . mysql_error() . "<br/>"; return false; } return true; }
private static function createUserTable() { $createDefault = db_get_create_default(); $updateDefault = db_get_update_default(); $query = "CREATE TABLE IF NOT EXISTS blogUser(" . "userId CHAR(32) NOT NULL, " . "password VARCHAR(255), " . "created TIMESTAMP(6) DEFAULT {$createDefault}, " . "updated TIMESTAMP(6) DEFAULT {$updateDefault}, " . "name TEXT, " . "externalType CHAR(16), " . "externalId TEXT, " . "access CHAR(16), " . "email CHAR(64), " . "notification CHAR(1), " . "tempCode CHAR(32), " . "deleted CHAR(1), " . "hash CHAR(32), " . "PRIMARY KEY(userId, updated), " . "KEY(email)" . ")"; if (!mysql_query($query)) { print $query . "<br/>"; print "Error: " . mysql_error() . "<br/>"; return false; } return true; }