/*ALIAS>prop_db*/

/*SQLStart>2907*/
ALTER TABLE Persons
ADD per_deathdate DATE;
/*SQLStop*/

/*SQLStart>2908*/
ALTER TABLE Persons 
ADD per_lastlbdsyncat DATE DEFAULT '17.11.1898';
/*SQLStop*/

/*SQLStart>2909*/
UPDATE Persons
SET per_lastlbdsyncat = CAST('17.11.1898' AS DATE)
WHERE per_lastlbdsyncat IS NULL;
/*SQLStop*/

/*SQLStart>2910*/
ALTER TABLE Persons 
ALTER COLUMN per_lastlbdsyncat SET NOT NULL;
/*SQLStop*/

/*SQLStart>2911*/
ALTER TABLE Persons 
ADD per_ispresentinlbd smallint DEFAULT 0;
/*SQLStop*/

/*SQLStart>2912*/
UPDATE Persons
SET per_ispresentinlbd = 0
WHERE per_ispresentinlbd IS NULL;
/*SQLStop*/

/*SQLStart>2913*/
ALTER TABLE Persons 
ALTER COLUMN per_ispresentinlbd SET NOT NULL;
/*SQLStop*/

/*SQLStart>2914*/
ALTER TABLE Persons
ADD CONSTRAINT chk_per_ispresentinlbd
CHECK (per_ispresentinlbd IN (0, 1));
/*SQLStop*/

/*SQLStart>2915*/
CREATE ASCENDING INDEX per_lbdsync_index
ON Persons (per_ispresentinlbd, per_lastlbdsyncat);
/*SQLStop*/

/*SQLStart>2916*/
UPDATE system_strings SET sys_str = '6.7.249.1' WHERE sys_id = 1401;
/*SQLStop*/
