Skip to content
Snippets Groups Projects
Verified Commit f5dbeccc authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: String IDs

parent a4b158c4
No related branches found
No related tags found
3 merge requests!17Release 6.0,!15External String IDs,!11DRAFT: file system cleanup
......@@ -5,6 +5,8 @@ DROP PROCEDURE IF EXISTS retrieveGroup;
DROP PROCEDURE IF EXISTS getInfo;
DROP PROCEDURE IF EXISTS getRole;
DROP PROCEDURE IF EXISTS setPassword;
DROP PROCEDURE IF EXISTS initAutoIncrement;
DELETE FROM entities WHERE id=99;
-- new entity_ids table
......@@ -17,4 +19,10 @@ CREATE TABLE `entity_ids` (
) ENGINE=InnoDB;
-- fill all existing entities into the new entity_ids table.
INSERT INTO entity_ids (id, internal_id) SELECT id, id FROM entities WHERE id>0 AND role!="DOMAIN";
INSERT INTO entity_ids (id, internal_id) SELECT id, id FROM entities WHERE id>0 AND role!="DOMAIN" AND id!=50;
ALTER TABLE transaction_log MODIFY COLUMN `entity_id` VARCHAR(255) NOT NULL;
ALTER TABLE user_info DROP CONSTRAINT `subjects_ibfk_1`;
ALTER TABle user_info MODIFY COLUMN `entity` VARCHAR(255) DEFAULT NULL;
ALTER TABLE user_info ADD CONSTRAINT `subjects_ibfk_2` FOREIGN KEY (`entity`) REFERENCES `entity_ids` (`id`);
/*
* ** header v3.0
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2018 Research Group Biomedical Physics,
* Max-Planck-Institute for Dynamics and Self-Organization Göttingen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* ** end header
*/
DROP PROCEDURE IF EXISTS db_5_0.initAutoIncrement;
delimiter //
CREATE PROCEDURE db_5_0.initAutoIncrement()
BEGIN
SELECT @max := MAX(entity_id)+ 1 FROM transaction_log;
IF @max IS NOT NULL THEN
SET @stmtStr = CONCAT('ALTER TABLE entities AUTO_INCREMENT=',@max);
PREPARE stmt FROM @stmtStr;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
END;
//
delimiter ;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment