Changeset 23 for trunk/ddl

Show
Ignore:
Timestamp:
08/27/09 17:58:05 (5 years ago)
Author:
robert
Message:

update/insert of a node should make the current note its owner

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ddl/cornea.sql

    r22 r23  
    11-- 
    2 -- PostgreSQL database dump 
     2-- *NOTE* This is not a PostgreSQL database dump.  
     3-- If you want to update the schema, you should edit this file manually 
    34-- 
    45 
     
    123124-- 
    124125 
    125 CREATE OR REPLACE FUNCTION make_asset(in_service_id integer, in_asset_id bigint, in_repid integer, in_storage_location integer[]) RETURNS void 
     126CREATE OR REPLACE FUNCTION make_asset(in_service_id integer, in_asset_id bigint, in_repid integer, in_storage_location smallint[]) RETURNS void 
    126127    LANGUAGE sql 
    127128    AS $$ 
    128   insert into asset(service_id,asset_id,representation_id,storage_location)  
    129       values ($1, $2, $3, $4); 
     129        -- remove any existing copies, ensures that this node becomes "owner" of the asset  
     130        delete from asset where service_id = $1 and asset_id = $2 and storage_location = $4;  
     131        insert into asset(service_id,asset_id,representation_id,storage_location) values ($1, $2, $3, $4); 
    130132$$; 
    131133