프로젝트

일반

사용자정보

Nerv ICDE » 20210107 패치.sql

이용우, 2021/01/06 22:28

 
1
ALTER TABLE `method` CHANGE COLUMN `type` `type` VARCHAR(50) NOT NULL DEFAULT '' COLLATE 'utf8_general_ci' AFTER `name`;
2

    
3

    
4
ALTER TABLE `data_field` CHANGE COLUMN `seq` `seq` VARCHAR(50) NOT NULL AFTER `arraysize`;
5
update data_field set seq = UNIX_TIMESTAMP(CONVERT_TZ(seq, '+00:00', @@session.time_zone));
6
ALTER TABLE `data_field` CHANGE COLUMN `seq` `seq` int NOT NULL AFTER `arraysize`;
7
set @seqmin = 0;
8
select min(seq) into @seqmin from data_field;
9
update data_field set seq = seq - @seqmin;
10

    
11
ALTER TABLE `data_field` CHANGE COLUMN `seq` `seq` INT(11) NOT NULL AUTO_INCREMENT AFTER `arraysize`, ADD INDEX `seq` (`seq`);
12

    
13
DROP PROCEDURE IF EXISTS `metadataViewEditMetafieldSeq`;
14
DELIMITER //
15
CREATE PROCEDURE `metadataViewEditMetafieldSeq`(IN `domain_idkey` int, IN `domaintype` varchar(50), IN `metadatakey` varchar(100), IN `metadatakey1` varchar(100), IN `metadatakey2` varchar(100))
16
BEGIN
17
        declare t1 bigint;
18
        declare t2 bigint;
19

    
20
        declare data_auto_id_key int default null;
21
        
22
        if loginTest() and domainManageTest(domain_idkey) then
23
                select 1 as test;
24
                select data.data_auto_id into data_auto_id_key from data where data.domain_id=domain_idkey and data.name=metadatakey;
25
                
26
                  select seq into t1 from data_field where data_field.data_auto_id=data_auto_id_key and member_name=metadatakey1;
27
                  select seq into t2 from data_field where data_field.data_auto_id=data_auto_id_key and member_name=metadatakey2;
28
                update data_field set seq = t2 where data_field.data_auto_id=data_auto_id_key and member_name=metadatakey1;
29
                update data_field set seq = t1 where data_field.data_auto_id=data_auto_id_key and member_name=metadatakey2;
30
        else
31
                select 0 as test;
32
        end if;
33

    
34
END//
35
DELIMITER ;
(1-1/8)