aaaaaaaargh dates and times in sql
This commit is contained in:
parent
dd650a6a4e
commit
96e69c4f20
2 changed files with 4 additions and 2 deletions
|
@ -72,6 +72,7 @@ class MySQL extends DBEngine {
|
|||
$data = str_replace("SCORE_BOOL_Y", "'Y'", $data);
|
||||
$data = str_replace("SCORE_BOOL_N", "'N'", $data);
|
||||
$data = str_replace("SCORE_BOOL", "ENUM('Y', 'N')", $data);
|
||||
$data = str_replace("SCORE_DATETIME", "DATETIME", $data);
|
||||
$data = str_replace("SCORE_NOW", "\"1970-01-01\"", $data);
|
||||
$ctes = "TYPE=InnoDB DEFAULT CHARSET='utf8'";
|
||||
return "CREATE TABLE $name ($data) $ctes";
|
||||
|
@ -86,6 +87,7 @@ class PostgreSQL extends DBEngine {
|
|||
$data = str_replace("SCORE_BOOL_Y", "'t'", $data);
|
||||
$data = str_replace("SCORE_BOOL_N", "'f'", $data);
|
||||
$data = str_replace("SCORE_BOOL", "BOOL", $data);
|
||||
$data = str_replace("SCORE_DATETIME", "TIMESTAMP", $data);
|
||||
$data = str_replace("SCORE_NOW", "current_time", $data);
|
||||
return "CREATE TABLE $name ($data)";
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ function create_tables($dsn) { // {{{
|
|||
id SCORE_AIPK,
|
||||
name VARCHAR(32) UNIQUE NOT NULL,
|
||||
pass CHAR(32),
|
||||
joindate DATETIME NOT NULL DEFAULT SCORE_NOW,
|
||||
joindate SCORE_DATETIME NOT NULL DEFAULT SCORE_NOW,
|
||||
admin SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
email VARCHAR(128)
|
||||
"));
|
||||
|
@ -212,7 +212,7 @@ function create_tables($dsn) { // {{{
|
|||
source VARCHAR(255),
|
||||
width INTEGER NOT NULL,
|
||||
height INTEGER NOT NULL,
|
||||
posted TIMESTAMP NOT NULL DEFAULT SCORE_NOW,
|
||||
posted SCORE_DATETIME NOT NULL DEFAULT SCORE_NOW,
|
||||
locked SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
|
||||
INDEX(owner_id),
|
||||
INDEX(width),
|
||||
|
|
Reference in a new issue