mysql - where to find Drupal 7 DB schema? -
i have query in drupal 6
select term_data.tid tid, term_data.name term_data_name, term_data.vid term_data_vid, term_data.weight term_data_weight term_data term_data left join term_node term_node on term_data.tid = term_node.tid inner join node node_term_node on term_node.vid = node_term_node.vid
how can migrate 1 drupal 7 schema? have this, it's not working
select taxonomy_term_data.tid, taxonomy_term_data.vid, taxonomy_term_data.name taxonomy_term_data left join taxonomy_index on taxonomy_term_data.tid = taxonomy_index.tid inner join node on taxonomy_index.vid = node.vid
the problem taxonomy_index.vid doesn't exist.
i haven't found drupal 7 database schema documentation, idea? please
$terms = db_select('term_data', 'td') ->fields('td', array('tid', 'name', 'vid', 'weight')) ->leftjoin('term_node', 'tn', 'td.tid = tn.tid') ->join('node', 'n', 'tn.vid = n.vid') ->execute(); foreach ($terms $term) { // $term }
tip: errors difficult find when stringing together. optionally, can set each 1 row @ time , errors seem report better.
$query = db_select('term_data', 'td'); $query->fields('td', array('tid', 'name', 'vid', 'weight')); $query->leftjoin('term_node', 'tn', 'td.tid = tn.tid'); $query->join('node', 'n', 'tn.vid = n.vid'); $terms = $query->execute();
Comments
Post a Comment