aboutsummaryrefslogtreecommitdiff
path: root/db/migrate/20201009025353_add_default_to_resource_feature.rb
blob: 06cad6c34eb7ebe4c26adf6f53f1e8dad5ee2d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class AddDefaultToResourceFeature < ActiveRecord::Migration[6.0]
  def up
    change_column_default :resources, :feature,
                          {
                            "geometry": {
                                          "type": "Point",
                                          "coordinates": [0,0]
                                        },
                            "properties": {
                                            "name":"",
                                            "description":"",
                                            "address":"",
                                            "postal_code":"",
                                            "city":"",
                                            "email":"",
                                            "phone_number":"",
                                            "website":"",
                                            "categories":[],
                                            "source":"incommon",
                                            "entry_number":nil,
                                            "srid":4326
                                         }
                          }
    add_index :resources, :feature, using: :gin
  end
  def down
    change_column_default :resources, :feature, nil
    remove_index :resources, :feature
  end
end