Issue
I would like to create a table like with this postgresql query. How to made a rails migration with a DOUBLE PRECISION and Geography column ?
CREATE TABLE poi_trace (
poi_id BIGINT REFERENCES pois(id),
trace_id BIGINT REFERENCES traces(id),
geog GEOGRAPHY(Point, 4326),
advance_on_trace DOUBLE PRECISION,
active BOOLEAN
);
Solution
You can run custom sql in migrations
class ExampleMigration < ActiveRecord::Migration
def up
execute <<-SQL
CREATE TABLE poi_trace (
poi_id BIGINT REFERENCES pois(id),
trace_id BIGINT REFERENCES traces(id),
geog GEOGRAPHY(Point, 4326),
advance_on_trace DOUBLE PRECISION,
active BOOLEAN
);
SQL
end
def down
drop_table :poi_trace
end
end
Answered By - Eyeslandic Answer Checked By - Pedro (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.