Software Engineering for Internet Applications

Adding News

create table content_raw (
        content_id              integer primary key,
        -- 'news' or 'article' or 'comment' or...
        content_type            varchar(100) not null,
        refers_to               references content,
        creation_user           not null references users,
        creation_date           not null date,
        release_time            date,
        expiration_time         date,
        language                char(2) references language_codes,
        mime_type               varchar(100) not null,
        one_line_summary        varchar(200) not null,
        body                    clob,
        editorial_status        varchar(30) 
          check (editorial_status in ('submitted','rejected','approved','expired'))
);

create view news_current_and_approved
        as
        select *
        from content_raw 
        where content_type = 'news'
        and (release_time is null or sysdate >= release_time)
        and (expiration_time is null or sysdate  <= expiration_time)
        and editorial_status = 'approved';

José M. Vidal .

13 of 30