protected void for_each_table(db_schema conn, db_script_cmd cmd) { // filtri string[] filter = cmd.attr("filter_type").Split(new char[] { ',' } , StringSplitOptions.RemoveEmptyEntries); string[] exclude = cmd.attr("exclude").ToLower().Split(new char[] { ',' } , StringSplitOptions.RemoveEmptyEntries); bool no_enums = cmd.attr_bool("exclude_enums"); // ciclo tabelle foreach (string tbl in conn.tables()) { if (filter == null || (filter != null && (filter.Contains("data") && conn.meta_doc.type_table(tbl) == db.meta_doc.table_type.data || filter.Contains("history") && conn.meta_doc.type_table(tbl) == db.meta_doc.table_type.storico)) && (exclude == null || (exclude != null && !exclude.Contains(tbl.ToLower()))) && (!no_enums || (no_enums && !conn.meta_doc.enum_tbl(tbl)))) { foreach (db_script_cmd sub_cmd in cmd.sub_cmds) { if (sub_cmd.sub_type == db_script_cmd.cmd_sub_type.remove_idx_ins_on_table) { conn.table_idxs(tbl, true).ForEach(i => { if (i.Fields.Count == 1 && i.Fields[0].Name.ToLower() == conn.meta_doc.field_ins().ToLower()) { conn.drop_index(i.Name, tbl); } }); } else if (sub_cmd.sub_type == db_script_cmd.cmd_sub_type.delete_data) { conn.clean_table(tbl); } } } } }