update sql/tmagic_sql.sql