2014-06-28 5 views
5

मुझे inet कहां और कैसे परिभाषित किया जाना चाहिए? यह एक वैध postgreSQL डेटा प्रकार है।रेक निरस्त कर रहा है क्योंकि अपरिभाषित विधि 'inet'

http://www.postgresql.org/docs/8.4/static/datatype-net-types.html

rake db:migrate 
== CreateSysHosts: migrating ================================================= 
-- create_table(:sys_hosts) 
rake aborted! 
An error has occurred, this and all later migrations canceled: 

undefined method `inet' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x00000005e3e068>/opt/csdashboard/db/migrate/20140628123004_create_sys_hosts.rb:4:in `block in change' 

प्रवासन फ़ाइल:

class CreateSysHosts < ActiveRecord::Migration 
    def change 
    create_table :sys_hosts do |t| 
     t.inet :address 
     t.string :name 
     t.string :os_name 
     t.string :os_flavor 
     t.int :user_id 
     t.string :info 
     t.string :comments 

     t.timestamps 
    end 
    end 
end 
+0

आप कर सकते हैं माइग्रेशन फ़ाइल पोस्ट करें? – Pavan

+0

माइग्रेशन फ़ाइल के साथ प्रश्न अद्यतन किया गया। –

उत्तर

2

उपयोग postgres_ext मणि कि मंत्रिमंडल की तरह Postgres की बढ़ी डेटाटाइप्स का समर्थन करता है।

एक उदाहरण postgres_ext: Adding Postgres data types to Rails

postgres_ext निम्नलिखित PostgresSQL प्रकार के लिए प्रवास और schema.rb समर्थन जोड़ता है:

  • INET
  • सीआईडीआर
  • MACADDR
  • UUID
  • सरणी
+0

इसे 3.2.14 से 4.x तक अपग्रेड करने की आवश्यकता होगी? –

+0

मुझे ऐसा लगता है। या पुराने संस्करण को आजमाएं - https://rubygems.org/gems/postgres_ext/versions/1.0.0 – emaillenin

+0

अब मुझे # /opt के लिए अपरिभाषित विधि 'int' प्राप्त करें /csdashboard/db/migrate/20140628123004_create_sys_hosts.rb:9: 'परिवर्तन में ब्लॉक' –

संबंधित मुद्दे