Skip to content

Commit

Permalink
Reordenar provincias alfabéticamente (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciopasquier committed Oct 28, 2015
1 parent d161a26 commit 38b6c44
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 39 deletions.
28 changes: 28 additions & 0 deletions db/migrate/20151028224008_fix_provincia_ids.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class FixProvinciaIds < ActiveRecord::Migration
def up
# Salta, de 1 a 16
Serie.where(provincia_id: 1).update_all provincia_id: 16
# Buenos Aires, de 2 a 1
Serie.where(provincia_id: 2).update_all provincia_id: 1
# Entre Rios, de 5 a 8
Serie.where(provincia_id: 5).update_all provincia_id: 8
# Santa Fe, de 17 a 20
Serie.where(provincia_id: 17).update_all provincia_id: 20
# Corrientes, de 21 a 6
Serie.where(provincia_id: 21).update_all provincia_id: 6
# Córdoba, de 22 a 7
Serie.where(provincia_id: 22).update_all provincia_id: 7
# Jujuy, de 23 a 10
Serie.where(provincia_id: 23).update_all provincia_id: 10
end

def down
Serie.where(provincia_id: 10).update_all provincia_id: 23
Serie.where(provincia_id: 7).update_all provincia_id: 22
Serie.where(provincia_id: 6).update_all provincia_id: 21
Serie.where(provincia_id: 20).update_all provincia_id: 17
Serie.where(provincia_id: 8).update_all provincia_id: 5
Serie.where(provincia_id: 1).update_all provincia_id: 2
Serie.where(provincia_id: 16).update_all provincia_id: 1
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20140805070005) do
ActiveRecord::Schema.define(version: 20151028224008) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down
76 changes: 38 additions & 38 deletions db/semillas/provincias.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@
# El id es de uso interno, y si se lo cambia se corre el riesgo de perder
# asociaciones previas.
- id: 1
valor: Salta
slug: salta
- id: 2
valor: Buenos Aires
slug: buenos-aires
- id: 3
- id: 2
valor: Capital Federal
slug: capital-federal
- id: 3
valor: Catamarca
slug: catamarca
- id: 4
valor: San Luis
slug: san-luis
valor: Chaco
slug: chaco
- id: 5
valor: Entre Ríos
slug: entre-rios
valor: Chubut
slug: chubut
- id: 6
valor: La Rioja
slug: la-rioja
valor: Corrientes
slug: corrientes
- id: 7
valor: Santiago del Estero
slug: santiago-del-estero
valor: Córdoba
slug: cordoba
- id: 8
valor: Chaco
slug: chaco
valor: Entre Ríos
slug: entre-rios
- id: 9
valor: San Juan
slug: san-juan
valor: Formosa
slug: formosa
- id: 10
valor: Catamarca
slug: catamarca
valor: Jujuy
slug: jujuy
- id: 11
valor: La Pampa
slug: la-pampa
Expand All @@ -41,35 +41,35 @@
valor: Misiones
slug: misiones
- id: 14
valor: Formosa
slug: formosa
- id: 15
valor: Neuquén
slug: neuquen
- id: 16
- id: 15
valor: Río Negro
slug: rio-negro
- id: 16
valor: Salta
slug: salta
- id: 17
valor: Santa Fe
slug: santa-fe
valor: San Juan
slug: san-juan
- id: 18
valor: Tucumán
slug: tucuman
valor: San Luis
slug: san-luis
- id: 19
valor: Chubut
slug: chubut
valor: Santa Cruz
slug: santa-cruz
- id: 20
valor: Tierra del Fuego
slug: tierra-del-fuego
valor: Santa Fe
slug: santa-fe
- id: 21
valor: Corrientes
slug: corrientes
valor: Santiago del Estero
slug: santiago-del-estero
- id: 22
valor: Córdoba
slug: cordoba
valor: Tierra del Fuego
slug: tierra-del-fuego
- id: 23
valor: Jujuy
slug: jujuy
valor: Tucumán
slug: tucuman
- id: 24
valor: Santa Cruz
slug: santa-cruz
valor: La Rioja
slug: la-rioja

0 comments on commit 38b6c44

Please sign in to comment.