@@ -16,7 +16,7 @@ function getDbConnection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function migrate($db) {
|
function migrate($db) {
|
||||||
$db->exec("CREATE TABLE IF NOT EXISTS documents (
|
try { $db->exec("CREATE TABLE IF NOT EXISTS documents (
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
doc_type VARCHAR(50) NOT NULL,
|
doc_type VARCHAR(50) NOT NULL,
|
||||||
team_id INT NOT NULL,
|
team_id INT NOT NULL,
|
||||||
@@ -24,9 +24,9 @@ function migrate($db) {
|
|||||||
content TEXT,
|
content TEXT,
|
||||||
occurred_at DATETIME NOT NULL,
|
occurred_at DATETIME NOT NULL,
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
FOREIGN KEY (team_id) REFERENCES teams(id) ON DELETE CASCADE
|
)"); } catch (Exception $e) {}
|
||||||
)");
|
try { $db->exec("ALTER TABLE documents ADD COLUMN IF NOT EXISTS updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER created_at"); } catch (Exception $e) {}
|
||||||
$db->exec("CREATE TABLE IF NOT EXISTS network_shapes (
|
$db->exec("CREATE TABLE IF NOT EXISTS network_shapes (
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
label VARCHAR(255) NOT NULL DEFAULT '',
|
label VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
|
|||||||
+1
-2
@@ -73,8 +73,7 @@ CREATE TABLE IF NOT EXISTS documents (
|
|||||||
content TEXT,
|
content TEXT,
|
||||||
occurred_at DATETIME NOT NULL,
|
occurred_at DATETIME NOT NULL,
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
FOREIGN KEY (team_id) REFERENCES teams(id) ON DELETE CASCADE
|
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT IGNORE INTO teams (name, color) VALUES
|
INSERT IGNORE INTO teams (name, color) VALUES
|
||||||
|
|||||||
Reference in New Issue
Block a user