29 |
primary key (catalog_id, entry_id) |
primary key (catalog_id, entry_id) |
30 |
); |
); |
31 |
|
|
|
-- Pg General Bits entries |
|
|
create table entries_pgbits ( |
|
|
issue int not null, -- unique index |
|
|
primary key(id) |
|
|
) inherits (entries) ; |
|
|
|
|
32 |
-- Items for each Entry |
-- Items for each Entry |
33 |
create table items ( |
create table items ( |
34 |
id serial, |
id serial, |
35 |
title text, |
title text, |
36 |
entry_id int references entries(id), |
entry_id int references entries(id), |
|
|
|
37 |
i_type text not null, |
i_type text not null, |
38 |
date timestamp not null default now(), |
date timestamp not null default now(), |
39 |
primary key(id) |
primary key(id) |
64 |
primary key (entry_id, tag_id) |
primary key (entry_id, tag_id) |
65 |
); |
); |
66 |
|
|
67 |
|
-- Pg General Bits |
68 |
|
create table entries_pgbits ( |
69 |
|
issue int not null, -- unique index |
70 |
|
primary key(id) |
71 |
|
) inherits (entries) ; |
72 |
|
|
73 |
|
create table items_pgbits ( |
74 |
|
mytitle text not null, |
75 |
|
ititle text not null, |
76 |
|
ikey text, |
77 |
|
html text, |
78 |
|
contributors text, |
79 |
|
primary key(id) |
80 |
|
) inherits (items) ; |
81 |
|
|
82 |
|
-- some views |
83 |
|
|
84 |
|
create view pgbits_articles as select |
85 |
|
issue, |
86 |
|
date(entries_pgbits.date) as issue_date, |
87 |
|
ititle, |
88 |
|
mytitle, |
89 |
|
date(items_pgbits.date) as date |
90 |
|
from items_pgbits |
91 |
|
join entries_pgbits on entry_id = entries_pgbits.id ; |
92 |
|
|