I want to create a table in my postgres db, with one column which is a multipolgyon. How do i do that?
What i do fails because of this:
undefined method multipolygon for #<ActiveRecord::ConnectionAdapters::PostgreSQLTableDefinition:0x4ac6f70>:
Using this Migration:
class CreateBezirkes < ActiveRecord::Migration
def change
create_table :bezirkes do |t|
t.string :NameK
t.integer :BezNr
t.string :Bez_Rz
t.string :Namek_Num
t.string :Namek_Rz
t.string :NameG
t.string :Label
t.integer :Bez
t.integer :District_Code
t.integer :StatAustria_Bez_Code
t.integer :StatAustria_Gem_Code
t.float :Flaeche
t.float :Umfang
t.timestamp :Akt_Timestamp
t.multipolygon :Koordinaten
t.integer :main_id
end
execute <<-SQL
ALTER TABLE bezirkes
ADD CONSTRAINT fk_bezirkes_mains
FOREIGN KEY (main_id)
REFERENCES mains(id)
SQL
end
end
you could use the postgis gem. It is based on Rgeo, which provides some nice spatial methods.
Otherwise just do:
note: your column names should not begin with a capital letter, according to rails conventions.