diff --git a/api/setup/setup.inc.php b/api/setup/setup.inc.php index 0758b549b4..2294ca83de 100644 --- a/api/setup/setup.inc.php +++ b/api/setup/setup.inc.php @@ -11,7 +11,7 @@ /* Basic information about this app */ $setup_info['api']['name'] = 'api'; $setup_info['api']['title'] = 'EGroupware API'; -$setup_info['api']['version'] = '20.1.001'; +$setup_info['api']['version'] = '20.1.002'; $setup_info['api']['versions']['current_header'] = '1.29'; // maintenance release in sync with changelog in doc/rpm-build/debian.changes $setup_info['api']['versions']['maintenance_release'] = '20.1.20201005'; @@ -141,3 +141,4 @@ $setup_info['groupdav']['license'] = 'GPL'; $setup_info['groupdav']['hooks']['preferences'] = 'EGroupware\\Api\\CalDAV\\Hooks::menus'; $setup_info['groupdav']['hooks']['settings'] = 'EGroupware\\Api\\CalDAV\\Hooks::settings'; + diff --git a/api/setup/tables_current.inc.php b/api/setup/tables_current.inc.php index 9c5f443216..ed0e42d763 100644 --- a/api/setup/tables_current.inc.php +++ b/api/setup/tables_current.inc.php @@ -518,11 +518,12 @@ $phpgw_baseline = array( 'shared_with' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False), 'shared_by' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False), 'shared_at' => array('type' => 'timestamp','nullable' => False,'default' => 'current_timestamp'), - 'shared_writable' => array('type' => 'bool','nullable' => False,'default' => '0') + 'shared_writable' => array('type' => 'bool','nullable' => False,'default' => '0'), + 'shared_deleted' => array('type' => 'timestamp','comment' => 'timestamp, if deleted') ), 'pk' => array('shared_id'), 'fk' => array(), 'ix' => array('contact_id','shared_with'), - 'uc' => array() + 'uc' => array(array('shared_by','shared_with','contact_id')) ) ); diff --git a/api/setup/tables_update.inc.php b/api/setup/tables_update.inc.php index 65867c8174..e83e33c123 100644 --- a/api/setup/tables_update.inc.php +++ b/api/setup/tables_update.inc.php @@ -753,3 +753,19 @@ function api_upgrade20_1() return $GLOBALS['setup_info']['api']['currentver'] = '20.1.001'; } + +/** + * Add deleted timestamp and unique index for contact sharing + * + * @return string + */ +function api_upgrade20_1_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_shared','shared_deleted',array( + 'type' => 'timestamp', + 'comment' => 'timestamp, if deleted' + )); + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_shared', array('shared_by','shared_with','contact_id'), true); + + return $GLOBALS['setup_info']['api']['currentver'] = '20.1.002'; +}