Commit 1b197d34 authored by cosine's avatar cosine

- Added two more fields for vacation balance:

  - vacation_balance_backup_last_year: Just a backup
  - vacation_balance_year: Date of update of vacation balance
parent 3adca72c
......@@ -109,7 +109,12 @@ create table im_employees (
references im_categories,
vacation_days_per_year numeric(12,2),
vacation_balance numeric(12,2),
personnel_number text
-- From when is the vacation_balance? Should be 1st of Jan of year
vacation_balance_year date
default date_trunc('year', now()),
-- Just a backup of the previous balance
vacation_balance_backup_previous_year numeric(12,2)
default 0.0
);
create index im_employees_referred_idx on im_employees(referred_by);
......
-- upgrade-5.0.3.0.0-5.0.3.0.1.sql
SELECT acs_log__debug('/packages/intranet-hr/sql/postgresql/upgrade/upgrade-5.0.3.0.0-5.0.3.0.1.sql','');
-- Add new vacation balance fields
--
create or replace function inline_0 ()
returns integer as $body$
DECLARE
v_count integer;
BEGIN
-- Check if colum exists in the database
select count(*) into v_count from user_tab_columns where lower(table_name) = 'im_employees' and lower(column_name) = 'vacation_balance_year';
IF v_count > 0 THEN return 1; END IF;
alter table im_employees add vacation_balance_year date default date_trunc('year', now());
alter table im_employees add vacation_balance_backup_previous_year numeric(12,2) default 0.0;
return 0;
END;$body$ language 'plpgsql';
SELECT inline_0 ();
DROP FUNCTION inline_0 ();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment