Sha256: 8c67628c979ad361fe0d7b166f1f6e8208b49ffa8af34a1b76d5c09f8c68bfdf

Contents?: true

Size: 858 Bytes

Versions: 52

Compression:

Stored size: 858 Bytes

Contents

CREATE OR REPLACE FUNCTION renalware.hd_diary_archive_elapsed_master_slots()
RETURNS void
  AS $$
  BEGIN

INSERT into hd_diary_slots
(
    diary_id,
    station_id,
    day_of_week,
    diurnal_period_code_id,
    patient_id,
    created_by_id,
    updated_by_id,
    created_at,
    updated_at,
    deleted_at
)
(
    select
        weekly_diary_id,
        station_id,
        day_of_week,
        diurnal_period_code_id,
        patient_id,
        master_slot_created_by_id,
        master_slot_updated_by_id,
        master_slot_created_at,
        master_slot_updated_at,
        deleted_at
    from renalware.hd_diary_matrix -- a SQL view
    where
        weekly_slot_id is null
        and master_slot_id is not null
        and master_slot_created_at <= slot_date
        and slot_date >= now() - interval '3 months'
);

END;
$$ LANGUAGE plpgsql;

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
renalware-core-2.1.1 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.1.0 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.167 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.166 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.165 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.164 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.163 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.162 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.161 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.160 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.159 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.158 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.157 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.156 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.155 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.153 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.152 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.151 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.149 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql
renalware-core-2.0.148 db/functions/hd_diary_archive_elapsed_master_slots_v01.sql