_,err:=tx.Exec("create table pp_tmp(id integer primary key autoincrement, path text not null, parameter text not null, value text); insert into pp_tmp(path, parameter, value) select path, parameter, value from post_parameters; drop table post_parameters; alter table pp_tmp rename to post_parameters;")
_,err:=tx.Exec("create index pp_path_index on post_parameters (path);")
returnerr
},
},
&migrator.Migration{
Name:"00007",
Func:func(tx*sql.Tx)error{
_,err:=tx.Exec("alter table posts add column section text; create trigger add_section after update on posts begin update posts set section = (select substr(path, 2, len) from (select path, instr(substr(path, 2),'/')-1 as len from (select new.path as path))) where path = new.path; end;")
returnerr
},
},
&migrator.Migration{
Name:"00008",
Func:func(tx*sql.Tx)error{
_,err:=tx.Exec("create index p_section_index on posts (section);")
returnerr
},
},
&migrator.Migration{
Name:"00009",
Func:func(tx*sql.Tx)error{
_,err:=tx.Exec("create trigger add_section_insert after insert on posts begin update posts set section = (select substr(path, 2, len) from (select path, instr(substr(path, 2),'/')-1 as len from (select new.path as path))) where path = new.path; end;")