← Back to team overview

ubuntu-touch-coreapps team mailing list archive

[RSS Reader] SQL code

 

Hi Ladies and Gentlemen,

SQL code is generated from the physical diagram, pls check below:

CREATE TABLE article (
 id  INTEGER  PRIMARY KEY AUTOINCREMENT NOT NULL,
 title  VARCHAR(99)  NULL,
 link  VARCHAR(99)  NULL,
 description  teXT  NULL,
 pubdate  INTEGER  NULL,
 status  char(1)  NULL,
 favourite  char(1)  NULL,
 image  varCHAR(99)  NULL,
 feed_id  INTEGER  NULL
);

CREATE TABLE  feed  (
 id  INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,
 source  VARCHAR(99)  NULL,
 title  VARCHAR(99)  NULL,
 link  VARCHAR(99)  NULL,
 description  TEXT  NULL,
 pubdate  INTEGER  NULL,
 image  VARCHAR(99)  NULL
);

CREATE TABLE  feed_tag  (
 id  INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,
 feed_id  INTEGER  NULL,
 tag_id  INTEGER  NULL,
FOREIGN KEY(feed_id) REFERENCES feed(id) on delete cascade
);

CREATE TABLE  tag  (
 id  INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,
 name  varCHAR(99)  NULL
);

Description:
1. table article: store every item in an RSS feed;
2. table feed: store data of RSS feeds;
3. table feed_tag: store relationship of "feed" and "tag", includes a
foreign key "feed_id", if an feed is deleted, the related row in feed_tag
will also be deleted;
4. table tag: store data of tag;


Any advices and comments are welcome :)

Follow ups