chore(schema): +services#etablissement_{infos,geopoint}

- `etablissement_infos` est une représentation partielle en jsonb
de ce qui est renvoyé par l'API Entreprise.
(On ne conserve que l'adresse pour le moment, utilisée pour le geocodage)
- `etablissement_geopoint` est le point (x,y) issu du géocodage de
l'établissement
This commit is contained in:
Colin Darie 2022-07-25 16:25:15 +02:00
parent f8cf8aaab7
commit 7d39cc6b3e
4 changed files with 29 additions and 12 deletions

View file

@ -2,18 +2,21 @@
#
# Table name: services
#
# id :bigint not null, primary key
# adresse :text
# email :string
# horaires :text
# nom :string not null
# organisme :string
# siret :string
# telephone :string
# type_organisme :string not null
# created_at :datetime not null
# updated_at :datetime not null
# administrateur_id :bigint
# id :bigint not null, primary key
# adresse :text
# email :string
# etablissement_infos :jsonb
# etablissement_lat :decimal(10, 6)
# etablissement_lng :decimal(10, 6)
# horaires :text
# nom :string not null
# organisme :string
# siret :string
# telephone :string
# type_organisme :string not null
# created_at :datetime not null
# updated_at :datetime not null
# administrateur_id :bigint
#
class Service < ApplicationRecord
has_many :procedures

View file

@ -0,0 +1,7 @@
class AddEtablissementInfosToServices < ActiveRecord::Migration[6.1]
def change
add_column :services, :etablissement_infos, :jsonb, default: {}
add_column :services, :etablissement_lat, :decimal, precision: 10, scale: 6
add_column :services, :etablissement_lng, :decimal, precision: 10, scale: 6
end
end

View file

@ -706,6 +706,9 @@ ActiveRecord::Schema.define(version: 2022_09_02_151920) do
t.text "adresse"
t.datetime "created_at", null: false
t.string "email"
t.jsonb "etablissement_infos", default: {}
t.decimal "etablissement_lat", precision: 10, scale: 6
t.decimal "etablissement_lng", precision: 10, scale: 6
t.text "horaires"
t.string "nom", null: false
t.string "organisme"

View file

@ -7,6 +7,10 @@ FactoryBot.define do
telephone { '1234' }
horaires { 'de 9 h à 18 h' }
adresse { 'adresse' }
siret { '35600082800018' }
etablissement_infos { { adresse: "75 rue du Louvre\n75002\nPARIS\nFRANCE" } }
etablissement_lat { 48.87 }
etablissement_lng { 2.34 }
association :administrateur
end