Better import for Drupal QA

This commit is contained in:
Robin Ward
2014-10-02 13:15:50 -04:00
parent 2f8e28c918
commit 28cbebe5ed
2 changed files with 29 additions and 4 deletions

View File

@ -17,6 +17,10 @@ class ImportScripts::Drupal < ImportScripts::Base
)
end
def categories_query
@client.query("SELECT tid, name, description FROM taxonomy_term_data WHERE vid = 1")
end
def execute
create_users(@client.query("SELECT uid id, name, mail email, created FROM users;")) do |row|
{id: row['id'], username: row['name'], email: row['email'], created_at: Time.zone.at(row['created'])}
@ -27,7 +31,7 @@ class ImportScripts::Drupal < ImportScripts::Base
# * Drupal allows duplicate category names, so you may need to exclude some categories or rename them here.
# * Table name may be term_data.
# * May need to select a vid other than 1.
create_categories(@client.query("SELECT tid, name, description FROM taxonomy_term_data WHERE vid = 1;")) do |c|
create_categories(categories_query) do |c|
{id: c['tid'], name: c['name'], description: c['description']}
end