From 32f9fda33d5f5e88daa4188b637494f3b7af48ca Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <noreply@fakecake.org>
Date: Sun, 10 Mar 2019 15:45:30 +0300
Subject: add composite key on ttrss_feeds (feed_url & owner_uid)

---
 schema/ttrss_schema_mysql.sql | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'schema/ttrss_schema_mysql.sql')

diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql
index 7f7a834df..133912239 100644
--- a/schema/ttrss_schema_mysql.sql
+++ b/schema/ttrss_schema_mysql.sql
@@ -133,7 +133,8 @@ create table ttrss_feeds (id integer not null auto_increment primary key,
 	feed_language varchar(100) not null default '',
 	foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
 	foreign key (cat_id) references ttrss_feed_categories(id) ON DELETE SET NULL,
-	foreign key (parent_feed) references ttrss_feeds(id) ON DELETE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
+	foreign key (parent_feed) references ttrss_feeds(id) ON DELETE SET NULL,
+	unique(feed_url(255), owner_uid)) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
 
 insert into ttrss_feeds (owner_uid, title, feed_url) values
 	(1, 'Tiny Tiny RSS: Forum', 'http://tt-rss.org/forum/rss.php');
@@ -286,7 +287,7 @@ create table ttrss_tags (id integer primary key auto_increment,
 
 create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
 
-insert into ttrss_version values (136);
+insert into ttrss_version values (137);
 
 create table ttrss_enclosures (id integer primary key auto_increment,
 	content_url text not null,
-- 
cgit v1.2.3-54-g00ecf

