]> git.mxchange.org Git - friendica.git/blobdiff - database.sql
[Database version 1394] Add 2fa_trusted_browser table
[friendica.git] / database.sql
index 987a2d7e20bb1f7083f26b1dc46aa0756c5f58a0..4a8a9d6fc886e7d1cf154a6d3e05ec423295ebf1 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2021.03-dev (Red Hot Poker)
--- DB_UPDATE_VERSION 1393
+-- DB_UPDATE_VERSION 1394
 -- ------------------------------------------
 
 
@@ -283,10 +283,24 @@ CREATE TABLE IF NOT EXISTS `2fa_recovery_codes` (
        `code` varchar(50) NOT NULL COMMENT 'Recovery code string',
        `generated` datetime NOT NULL COMMENT 'Datetime the code was generated',
        `used` datetime COMMENT 'Datetime the code was used',
-        PRIMARY KEY(`uid`,`code`),
+       PRIMARY KEY(`uid`,`code`),
        FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication recovery codes';
 
+--
+-- TABLE 2fa_trusted_browser
+--
+CREATE TABLE IF NOT EXISTS `2fa_trusted_browser` (
+    `cookie_hash` varchar(80) NOT NULL COMMENT 'Trusted cookie hash',
+    `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
+    `user_agent` text COMMENT 'User agent string',
+    `created` datetime NOT NULL COMMENT 'Datetime the trusted browser was recorded',
+    `last_used` datetime COMMENT 'Datetime the trusted browser was last used',
+    PRIMARY KEY(`cookie_hash`),
+    INDEX `uid` (`uid`),
+    FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication trusted browsers';
+
 --
 -- TABLE addon
 --
@@ -1494,11 +1508,9 @@ CREATE VIEW `post-view` AS SELECT
        `item`.`id` AS `id`,
        `item`.`id` AS `item_id`,
        `item`.`uid` AS `uid`,
-       `item`.`uid` AS `internal-uid`,
        `item`.`parent` AS `parent`,
        `item`.`uri` AS `uri`,
        `item`.`uri-id` AS `uri-id`,
-       `item`.`uri-id` AS `internal-uri-id`,
        `item`.`parent-uri` AS `parent-uri`,
        `item`.`parent-uri-id` AS `parent-uri-id`,
        `item`.`thr-parent` AS `thr-parent`,
@@ -1530,9 +1542,6 @@ CREATE VIEW `post-view` AS SELECT
        `item`.`network` AS `network`,
        `item`.`vid` AS `vid`,
        `item`.`psid` AS `psid`,
-       `item`.`attach` AS `attach`,
-       (SELECT COUNT(*) FROM `post-category` WHERE `post-category`.`uri-id` = `item`.`uri-id`) AS `internal-file-count`,
-       NULL AS `file`,
        IF (`item`.`vid` IS NULL, '', `verb`.`name`) AS `verb`,
        `item-content`.`title` AS `title`,
        `item-content`.`content-warning` AS `content-warning`,
@@ -1653,11 +1662,9 @@ CREATE VIEW `post-thread-view` AS SELECT
        `thread`.`iid` AS `iid`,
        `item`.`id` AS `item_id`,
        `thread`.`uid` AS `uid`,
-       `item`.`uid` AS `internal-uid`,
        `item`.`parent` AS `parent`,
        `item`.`uri` AS `uri`,
        `item`.`uri-id` AS `uri-id`,
-       `item`.`uri-id` AS `internal-uri-id`,
        `item`.`parent-uri` AS `parent-uri`,
        `item`.`parent-uri-id` AS `parent-uri-id`,
        `item`.`thr-parent` AS `thr-parent`,
@@ -1690,9 +1697,6 @@ CREATE VIEW `post-thread-view` AS SELECT
        `thread`.`network` AS `network`,
        `item`.`vid` AS `vid`,
        `item`.`psid` AS `psid`,
-       `item`.`attach` AS `attach`,
-       (SELECT COUNT(*) FROM `post-category` WHERE `post-category`.`uri-id` = `item`.`uri-id`) AS `internal-file-count`,
-       NULL AS `file`,
        IF (`item`.`vid` IS NULL, '', `verb`.`name`) AS `verb`,
        `item-content`.`title` AS `title`,
        `item-content`.`content-warning` AS `content-warning`,