← Back to team overview

ubuntu-touch-coreapps team mailing list archive

Re: [RSS Reader] SQL code

 

Hi folks!

First of all, good job everyone!

I will check details of SQL code tomorrow, but now I wish to say that
didn't know about guid field and had used hash as unique fingerprint in
databasemodule.js.

Best,
Roman.



2013/5/3 Joey Chan <qqworini@xxxxxxxxx>

> Hi Gentlemen,
>
> As your wish, here's the new version:
>
> 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 DEFAULT '0',
>  favourite  char(1)  NULL DEFAULT '0',
>  image  VARCHAR(99)  NULL,
>  guid 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)  NOT NULL UNIQUE
> );
>
> CREATE TABLE  settings  (
>  current_database_version VARCHAR(99) NULL,
>  database_last_updated  VARCHAR(99)  NULL,
>  view_mode char(1) NULL DEFAULT '0',
>  update_interval INTEGER NULL,
>  network_mode char(1) NULL DEFAULT '0'
> );
>
>
> Changelog:
> 1. table article: add "guid", status and favourite add default value ;
> 2. table tag: change "name" to "NOT NULL UNIQUE";
> 3. table setting: new table to store all settings;
>
>
> BTW: @Svenn-Arne, I think checking 'guid' is enough, almost all RSS
> sources include guid ( RSS version 2.0 )
>
>
> 2013/5/3 Riccardo Padovani <rpadovani@xxxxxxxxxxxxx>
>
>> On Thu, May 2, 2013 at 9:10 PM, Svenn-Arne Dragly <s@xxxxxxxxxx> wrote:
>> > Wouldn't this make it impossible to rename the tag without also
>> > renaming all entries in "feed_tag"? Say for instance if you want to
>> > rename your "My hobbies" tag to "Hobbies" at some point?
>>
>> You're right, what a stupid mistake!
>> Although this, I think that
>>
>> name  varCHAR(99)  NULL
>>
>> in tag table has to be NOT NULL, because you don't create a tag with no
>> name.
>> Also, name has to be UNIQUE, because can be confusing two tags with
>> the same name.
>>
>> Regards,
>> --
>> Riccardo Padovani <rpadovani@xxxxxxxxxxxxx>
>>
>
>
> --
> Mailing list: https://launchpad.net/~ubuntu-touch-coreapps
> Post to     : ubuntu-touch-coreapps@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps
> More help   : https://help.launchpad.net/ListHelp
>
>

References