|
|
 |
-
openacs-4/.../postgresql/download-create.sql
(+11 -9)
-
| |
304 |
304 |
select content_type__register_child_type( |
| |
305 |
305 |
'cr_download_rep', |
| |
306 |
306 |
'cr_download_archive_desc', |
| |
307 |
307 |
'generic', |
| |
308 |
308 |
0, |
| |
309 |
309 |
null |
| |
310 |
310 |
); |
| |
311 |
311 |
|
| |
312 |
312 |
create view download_repository_obj as |
| |
313 |
313 |
select repository_id, |
| |
314 |
314 |
o.*, |
| |
315 |
315 |
i.parent_id, |
| |
316 |
316 |
r.title, |
| |
317 |
317 |
r.description, |
| |
318 |
318 |
r.content as help_text |
| |
319 |
319 |
from download_repository dr, acs_objects o, cr_items i, cr_revisions r |
| |
320 |
320 |
where dr.repository_id = o.object_id and |
| |
321 |
321 |
i.item_id = o.object_id and |
| |
322 |
322 |
r.revision_id = i.live_revision; |
| |
323 |
323 |
|
| |
|
324 |
|
| |
324 |
325 |
create view download_archives_obj as |
| |
325 |
326 |
select cri.parent_id as repository_id, |
| |
326 |
327 |
cri.name as archive_name, |
| |
327 |
328 |
cri.latest_revision, |
| |
328 |
329 |
cri.live_revision, |
| |
329 |
330 |
da.archive_id, |
| |
330 |
331 |
da.archive_type_id, |
| |
331 |
332 |
da.archive_desc_id, |
| |
332 |
|
desc_item.title as summary, |
| |
333 |
|
desc_item.description as description, |
| |
334 |
|
desc_item.mime_type as description_type, |
| |
335 |
|
desc_item.creation_user, |
| |
336 |
|
desc_item.creation_date, |
| |
337 |
|
desc_item.creation_ip |
| |
338 |
|
from download_archives da, cr_items cri, download_archive_descsi desc_item |
| |
339 |
|
where da.archive_desc_id = desc_item.revision_id and |
| |
|
333 |
crr.title as summary, |
| |
|
334 |
crr.description as description, |
| |
|
335 |
crr.mime_type as description_type, |
| |
|
336 |
o.creation_user, |
| |
|
337 |
o.creation_date, |
| |
|
338 |
o.creation_ip |
| |
|
339 |
from download_archives da, cr_items cri, cr_revisions crr, acs_objects o |
| |
|
340 |
where da.archive_desc_id = crr.revision_id and |
| |
|
341 |
da.archive_desc_id = o.object_id and |
| |
340 |
342 |
da.archive_id = cri.item_id; |
| |
341 |
343 |
|
| |
342 |
344 |
create view download_arch_revisions_obj as |
| |
343 |
345 |
select dar.*, |
| |
344 |
346 |
o.*, |
| |
345 |
347 |
r.item_id as archive_id, |
| |
346 |
348 |
r.title as file_name, |
| |
347 |
349 |
r.description as version_name, |
| |
348 |
350 |
r.publish_date, |
| |
349 |
351 |
r.mime_type, |
| |
350 |
352 |
r.content |
| |
351 |
353 |
from download_archive_revisions dar, acs_objects o, cr_revisions r |
| |
352 |
354 |
where dar.revision_id = o.object_id and |
| |
353 |
355 |
dar.revision_id = r.revision_id; |
| |
354 |
356 |
|
| |
355 |
357 |
create view download_downloads_repository as |
| |
356 |
358 |
select dd.*, |
| |
357 |
359 |
(select repository_id |
| |
358 |
360 |
from download_archives_obj da, cr_revisions r |
| |
359 |
361 |
where dd.revision_id = r.revision_id and |
|