Created
August 9, 2009 08:58
-
-
Save jystewart/164667 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to move data to drupal | |
require 'activerecord' | |
class ActiveRecord::Drupal < ActiveRecord::Base | |
self.abstract_class = true | |
establish_connection( | |
:adapter => "mysql", | |
:host => "localhost", | |
:username => "root", | |
:password => "", | |
:database => "nm_drupal" | |
) | |
end | |
class Vocabulary < ActiveRecord::Drupal | |
set_table_name 'vocabulary' | |
set_primary_key 'vid' | |
has_many :terms, :foreign_key => :vid | |
end | |
class Node < ActiveRecord::Drupal | |
set_table_name 'node' | |
set_primary_key 'nid' | |
end | |
class NodeRevision < ActiveRecord::Drupal | |
set_table_name 'node_revisions' | |
set_primary_key 'vid' | |
end | |
class TermNode < ActiveRecord::Drupal | |
set_table_name 'term_node' | |
end | |
class Term < ActiveRecord::Drupal | |
set_table_name 'term_data' | |
set_primary_key 'tid' | |
belongs_to :vocabulary, :foreign_key => :vid | |
end | |
class ContentTypeListing < ActiveRecord::Drupal | |
set_table_name 'content_type_listing' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment