Merge pull request #3147 from betagouv/clean-carto

Remove now useless carto tables
This commit is contained in:
gregoirenovel 2018-12-19 10:32:58 +01:00 committed by GitHub
commit 5a30467594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 31 deletions

View file

@ -41,7 +41,7 @@ class Champs::CarteController < ApplicationController
coordinates = JSON.parse(coordinates)
if @champ.cadastres?
cadastres = ModuleApiCartoService.generate_cadastre(coordinates)
cadastres = ApiCartoService.generate_cadastre(coordinates)
geo_areas += cadastres.map do |cadastre|
cadastre[:source] = GeoArea.sources.fetch(:cadastre)
cadastre
@ -49,7 +49,7 @@ class Champs::CarteController < ApplicationController
end
if @champ.quartiers_prioritaires?
quartiers_prioritaires = ModuleApiCartoService.generate_qp(coordinates)
quartiers_prioritaires = ApiCartoService.generate_qp(coordinates)
geo_areas += quartiers_prioritaires.map do |qp|
qp[:source] = GeoArea.sources.fetch(:quartier_prioritaire)
qp
@ -57,7 +57,7 @@ class Champs::CarteController < ApplicationController
end
if @champ.parcelles_agricoles?
parcelles_agricoles = ModuleApiCartoService.generate_rpg(coordinates)
parcelles_agricoles = ApiCartoService.generate_rpg(coordinates)
geo_areas += parcelles_agricoles.map do |parcelle_agricole|
parcelle_agricole[:source] = GeoArea.sources.fetch(:parcelle_agricole)
parcelle_agricole

View file

@ -1,4 +1,4 @@
class ModuleApiCartoService
class ApiCartoService
def self.generate_qp(coordinates)
coordinates.flat_map do |coordinate|
ApiCarto::QuartiersPrioritairesAdapter.new(

View file

@ -0,0 +1,6 @@
class DropOldCarto < ActiveRecord::Migration[5.2]
def change
drop_table :cadastres
drop_table :quartier_prioritaires
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_12_04_125101) do
ActiveRecord::Schema.define(version: 2018_12_18_103212) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -142,22 +142,6 @@ ActiveRecord::Schema.define(version: 2018_12_04_125101) do
t.index ["gestionnaire_id"], name: "index_avis_on_gestionnaire_id"
end
create_table "cadastres", id: :serial, force: :cascade do |t|
t.string "surface_intersection"
t.float "surface_parcelle"
t.string "numero"
t.integer "feuille"
t.string "section"
t.string "code_dep"
t.string "nom_com"
t.string "code_com"
t.string "code_arr"
t.text "geometry"
t.integer "dossier_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "champs", id: :serial, force: :cascade do |t|
t.string "value"
t.integer "type_de_champ_id"
@ -487,16 +471,6 @@ ActiveRecord::Schema.define(version: 2018_12_04_125101) do
t.index ["service_id"], name: "index_procedures_on_service_id"
end
create_table "quartier_prioritaires", id: :serial, force: :cascade do |t|
t.string "code"
t.string "nom"
t.string "commune"
t.text "geometry"
t.integer "dossier_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "received_mails", id: :serial, force: :cascade do |t|
t.text "body"
t.string "subject"