Просмотр исходного кода

SQL : UNIQUE(e.id_feed, e.guid)

Préparation de GUID en prévision de
https://github.com/marienfressinaud/FreshRSS/issues/202
Alexandre Alapetite 12 лет назад
Родитель
Сommit
d2d26bf69c
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 2
      app/models/Entry.php
  2. 2 1
      public/install.php

+ 1 - 2
app/models/Entry.php

@@ -200,7 +200,7 @@ class EntryDAO extends Model_pdo {
 
 
 		$values = array (
 		$values = array (
 			$valuesTmp['id'],
 			$valuesTmp['id'],
-			substr($valuesTmp['guid'], 0, 511),
+			substr($valuesTmp['guid'], 0, 760),
 			substr($valuesTmp['title'], 0, 255),
 			substr($valuesTmp['title'], 0, 255),
 			substr($valuesTmp['author'], 0, 255),
 			substr($valuesTmp['author'], 0, 255),
 			base64_encode (gzdeflate (serialize ($valuesTmp['content']))),
 			base64_encode (gzdeflate (serialize ($valuesTmp['content']))),
@@ -260,7 +260,6 @@ class EntryDAO extends Model_pdo {
 		     . 'WHERE e.id=?';
 		     . 'WHERE e.id=?';
 		$values = array ($is_favorite ? 1 : 0, $id);
 		$values = array ($is_favorite ? 1 : 0, $id);
 		$stm = $this->bd->prepare ($sql);
 		$stm = $this->bd->prepare ($sql);
-
 		if ($stm && $stm->execute ($values)) {
 		if ($stm && $stm->execute ($values)) {
 			return $stm->rowCount();
 			return $stm->rowCount();
 		} else {
 		} else {

+ 2 - 1
public/install.php

@@ -43,7 +43,7 @@ define ('SQL_REQ_FEED', 'CREATE TABLE IF NOT EXISTS `%sfeed` (
 
 
 define ('SQL_REQ_ENTRY', 'CREATE TABLE IF NOT EXISTS `%sentry` (
 define ('SQL_REQ_ENTRY', 'CREATE TABLE IF NOT EXISTS `%sentry` (
   `id` char(6) NOT NULL,
   `id` char(6) NOT NULL,
-  `guid` varchar(511) NOT NULL,
+  `guid` varchar(760) CHARACTER SET latin1 NOT NULL,
   `title` varchar(255) NOT NULL,
   `title` varchar(255) NOT NULL,
   `author` varchar(255) NOT NULL,
   `author` varchar(255) NOT NULL,
   `content` text NOT NULL,
   `content` text NOT NULL,
@@ -55,6 +55,7 @@ define ('SQL_REQ_ENTRY', 'CREATE TABLE IF NOT EXISTS `%sentry` (
   `tags` varchar(1023) NOT NULL,
   `tags` varchar(1023) NOT NULL,
   PRIMARY KEY (`id`),
   PRIMARY KEY (`id`),
   FOREIGN KEY (`id_feed`) REFERENCES %sfeed(id) ON DELETE CASCADE ON UPDATE CASCADE,
   FOREIGN KEY (`id_feed`) REFERENCES %sfeed(id) ON DELETE CASCADE ON UPDATE CASCADE,
+  UNIQUE KEY (`id_feed`,`guid`),	-- v0.7
   INDEX (`is_favorite`),	-- v0.7
   INDEX (`is_favorite`),	-- v0.7
   INDEX (`is_read`),	-- v0.7
   INDEX (`is_read`),	-- v0.7
   INDEX (`date`)	-- v0.7	//TODO: remove after https://github.com/marienfressinaud/FreshRSS/issues/202
   INDEX (`date`)	-- v0.7	//TODO: remove after https://github.com/marienfressinaud/FreshRSS/issues/202