--Migration from 1.0 to 2.0.

create sequence s$1;
create sequence s$2;
create sequence s$3;

insert into acp_db_sgs(
	acp_db_run_key,
	acp_db_sgs_key,
	day,
	used_bytes
)
select 
	1.1,
	s$1.nextval,
	day,
	used_bytes
from 
	acpu.acp_db_sgr
where
	acp_db_run_key=1;

insert into acp_ts_sgs(
	acp_db_run_key,
	acp_ts_sgs_key,
	ts_name,
	day,
	used_bytes
)
select
	1.1,
	s$2.nextval,
	ts_name,
	day,
	used_bytes
from
	acpu.acp_ts_sgr
where
	acp_db_run_key=1;

insert into acp_us_sgs(
	ACP_DB_RUN_KEY,
	ACP_US_SGS_KEY,
	USER_NAME,
	DAY,
	USED_BYTES
)
select 
	1.1,
	s$3.nextval,
	user_name,
	day,
	used_bytes
from
	acpu.acp_us_sgr
where
	acp_db_run_key=1;

drop sequence s$1;
drop sequence s$2;
drop sequence s$3;