diff options
author | Lev Lazinskiy <lev@levlaz.org> | 2017-01-22 09:39:30 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2017-01-22 12:39:30 -0500 |
commit | 8e18c39db9dbb0d91e28006b972dbe331e6500b4 (patch) | |
tree | 5a2f6bb37d355aafcf48f635b91b543d326d2686 /app/Schema | |
parent | 67aca3c664dfe4a7616781216e868f9477f4963f (diff) |
Add date_modification to comments (PR #2950)
Diffstat (limited to 'app/Schema')
-rw-r--r-- | app/Schema/Mysql.php | 10 | ||||
-rw-r--r-- | app/Schema/Postgres.php | 10 | ||||
-rw-r--r-- | app/Schema/Sql/mysql.sql | 3 | ||||
-rw-r--r-- | app/Schema/Sql/postgres.sql | 3 | ||||
-rw-r--r-- | app/Schema/Sqlite.php | 10 |
5 files changed, 31 insertions, 5 deletions
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index cc691d1f..6c1c9da6 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,15 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 118; +const VERSION = 119; + +function version_119(PDO $pdo) +{ + $pdo->exec('ALTER TABLE `comments` ADD COLUMN `date_modification` BIGINT(20)'); + $pdo->exec('UPDATE `comments` + SET `date_modification` = `date_creation` + WHERE `date_modification` IS NULL'); +} function version_118(PDO $pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 32a7a744..9c72141a 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,15 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 97; +const VERSION = 98; + +function version_98(PDO $pdo) +{ + $pdo->exec('ALTER TABLE "comments" ADD COLUMN date_modification BIGINT'); + $pdo->exec('UPDATE "comments" + SET date_modificaiton = date_creation + WHERE date_modification IS NULL'); +} function version_97(PDO $pdo) { diff --git a/app/Schema/Sql/mysql.sql b/app/Schema/Sql/mysql.sql index 0ee88d88..03b6eca2 100644 --- a/app/Schema/Sql/mysql.sql +++ b/app/Schema/Sql/mysql.sql @@ -98,6 +98,7 @@ CREATE TABLE `comments` ( `task_id` int(11) NOT NULL, `user_id` int(11) DEFAULT '0', `date_creation` bigint(20) DEFAULT NULL, + `date_modification` bigint(20) DEFAULT NULL, `comment` text, `reference` varchar(50) DEFAULT '', PRIMARY KEY (`id`), @@ -768,4 +769,4 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$R1zYk04d96KcHRpd9.r5I.5I6mgKIgUdsaISZYmaDLPIJCUO0FFJG', 'app-admin');INSERT INTO schema_version VALUES ('118'); +INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$R1zYk04d96KcHRpd9.r5I.5I6mgKIgUdsaISZYmaDLPIJCUO0FFJG', 'app-admin');INSERT INTO schema_version VALUES ('119'); diff --git a/app/Schema/Sql/postgres.sql b/app/Schema/Sql/postgres.sql index 578b0c75..f37c37d3 100644 --- a/app/Schema/Sql/postgres.sql +++ b/app/Schema/Sql/postgres.sql @@ -195,6 +195,7 @@ CREATE TABLE "comments" ( "task_id" integer NOT NULL, "user_id" integer DEFAULT 0, "date_creation" bigint NOT NULL, + "date_modification" bigint NOT NULL, "comment" "text", "reference" character varying(50) DEFAULT ''::character varying ); @@ -2613,4 +2614,4 @@ SELECT pg_catalog.setval('links_id_seq', 11, true); -- PostgreSQL database dump complete -- -INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$0.8BJyhOEBHGqfwD3nIJHuxObqTlZGJ/KRNDVHfSu7RGd42rEbSa.', 'app-admin');INSERT INTO schema_version VALUES ('97'); +INSERT INTO users (username, password, role) VALUES ('admin', '$2y$10$0.8BJyhOEBHGqfwD3nIJHuxObqTlZGJ/KRNDVHfSu7RGd42rEbSa.', 'app-admin');INSERT INTO schema_version VALUES ('98'); diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 11dcd537..d2a7899e 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -6,7 +6,15 @@ use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; use PDO; -const VERSION = 108; +const VERSION = 109; + +function version_109(PDO $pdo) +{ + $pdo->exec('ALTER TABLE comments ADD COLUMN date_modification INTEGER'); + $pdo->exec('UPDATE comments + SET date_modification = date_creation + WHERE date_modification IS NULL;'); +} function version_108(PDO $pdo) { |