MT#9177 Restore separated table schema too.

ipeshinskaya/9177
Irina Peshinskaya 11 years ago
parent 58515ef31c
commit b91916fd07

@ -0,0 +1,17 @@
use provisioning;
alter table autoprov_devices
add column `sync_uri` varchar(255) DEFAULT NULL,
add column `sync_method` enum('GET','POST') DEFAULT 'GET',
add column `sync_params` varchar(255) DEFAULT NULL,
add column `security_handler` varchar(255) DEFAULT NULL,
drop column `bootstrap_method`;
update autoprov_devices d
inner join autoprov_sync_cisco sc on d.id=sc.device_id
set d.sync_uri= sc.sync_uri,
d.sync_method= sc.sync_method,
d.sync_params= sc.sync_params,
d.security_handler=sc.security_handler;
drop table autoprov_sync_cisco;

@ -0,0 +1,25 @@
use provisioning;
alter table autoprov_devices
add column bootstrap_method enum('http','redirect_panasonic','redirect_linksys') not null default 'http';
update autoprov_devices set bootstrap_method='http' where vendor='Cisco';
create table autoprov_sync_cisco(
`device_id` integer unsigned not null,
`sync_uri` varchar(255) DEFAULT NULL,
`sync_method` enum('GET','POST') DEFAULT 'GET',
`sync_params` varchar(255) DEFAULT NULL,
`security_handler` varchar(255) DEFAULT NULL,
CONSTRAINT `a_s_deviceid_ref` FOREIGN KEY (`device_id`) REFERENCES `autoprov_devices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);
insert into autoprov_sync_cisco(device_id,sync_uri,sync_method,sync_params)
select d.id,d.sync_uri,d.sync_method,d.sync_params from autoprov_devices d where d.bootstrap_method='http';
alter table autoprov_devices
drop column sync_uri,
drop column sync_method,
drop column sync_params,
drop column security_handler;

@ -6,7 +6,7 @@ add column `sync_uri` varchar(255) DEFAULT NULL,
add column `sync_method` enum('GET','POST') DEFAULT 'GET',
add column `sync_params` varchar(255) DEFAULT NULL,
add column `security_handler` varchar(255) DEFAULT NULL,
drop column `sync_type`;
drop column `bootstrap_method`;
update autoprov_devices d
inner join autoprov_sync s on d.id=s.device_id

@ -1,21 +1,21 @@
use provisioning;
alter table autoprov_devices
add column sync_type enum('http','zte_panasonic','zte_linksys') not null default 'http';
add column bootstrap_method enum('http','zte_panasonic','zte_linksys') not null default 'http';
update autoprov_devices set sync_type='http' where vendor='Cisco';
update autoprov_devices set bootstrap_method='http' where vendor='Cisco';
create table autoprov_sync_parameters(
`id` integer unsigned not null auto_increment primary key,
`sync_type` enum('http','zte_panasonic','zte_linksys') not null default 'http',
`bootstrap_method` enum('http','zte_panasonic','zte_linksys') not null default 'http',
`parameter_name` enum('sync_uri','sync_method','sync_params','security_handler'),
`parameter_constraint` varchar(255),
UNIQUE KEY sync_parameter (sync_type,parameter_name)
UNIQUE KEY sync_parameter (bootstrap_method,parameter_name)
);
insert into autoprov_sync_parameters(sync_type,parameter_name,parameter_constraint) values('http','sync_uri','');
insert into autoprov_sync_parameters(sync_type,parameter_name,parameter_constraint) values('http','sync_params','');
insert into autoprov_sync_parameters(sync_type,parameter_name,parameter_constraint) values('http','sync_method','/^(?:GET|POST)$/i');
insert into autoprov_sync_parameters(sync_type,parameter_name,parameter_constraint) values('http','security_handler','');
insert into autoprov_sync_parameters(bootstrap_method,parameter_name,parameter_constraint) values('http','sync_uri','');
insert into autoprov_sync_parameters(bootstrap_method,parameter_name,parameter_constraint) values('http','sync_params','');
insert into autoprov_sync_parameters(bootstrap_method,parameter_name,parameter_constraint) values('http','sync_method','/^(?:GET|POST)$/i');
insert into autoprov_sync_parameters(bootstrap_method,parameter_name,parameter_constraint) values('http','security_handler','');
create table autoprov_sync(
`id` integer unsigned not null auto_increment primary key,
@ -28,14 +28,14 @@ create table autoprov_sync(
insert into autoprov_sync(device_id,parameter_id,parameter_value)
select a.id,p.id,a.val from (
select id,'sync_uri' as name, sync_uri as val, sync_type from autoprov_devices
select id,'sync_uri' as name, sync_uri as val, bootstrap_method from autoprov_devices
union
select id,'sync_method' as name, sync_method as val, sync_type from autoprov_devices
select id,'sync_method' as name, sync_method as val, bootstrap_method from autoprov_devices
union
select id,'sync_params' as name, sync_params as val, sync_type from autoprov_devices
select id,'sync_params' as name, sync_params as val, bootstrap_method from autoprov_devices
union
select id,'security_handler' as name, security_handler as val, sync_type from autoprov_devices
) a inner join autoprov_sync_parameters p on a.name=p.parameter_name and a.sync_type=p.sync_type;
select id,'security_handler' as name, security_handler as val, bootstrap_method from autoprov_devices
) a inner join autoprov_sync_parameters p on a.name=p.parameter_name and a.bootstrap_method=p.bootstrap_method;
alter table autoprov_devices

Loading…
Cancel
Save