Commit 774f7bc040df6f35255f11811c904bbf61235a75
Committed by
Fabio Teixeira
1 parent
b8715f08
Exists in
master
and in
5 other branches
Add migration for new institution fields
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Parley Martins <parley@outlook.com>
Showing
5 changed files
with
53 additions
and
0 deletions
Show diff stats
db/migrate/20140814125947_add_new_fields_to_public_institution.rb
0 → 100644
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +class AddNewFieldsToPublicInstitution < ActiveRecord::Migration | |
| 2 | + def up | |
| 3 | + add_column :institutions, :sisp, :boolean, :default => false | |
| 4 | + remove_column :institutions, :juridical_nature | |
| 5 | + end | |
| 6 | + | |
| 7 | + def down | |
| 8 | + remove_column :institutions, :sisp | |
| 9 | + add_column :institutions, :juridical_nature, :string | |
| 10 | + end | |
| 11 | +end | ... | ... |
db/migrate/20140814131606_create_juridical_natures_table.rb
0 → 100644
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +class CreateJuridicalNaturesTable < ActiveRecord::Migration | |
| 2 | + def up | |
| 3 | + create_table :juridical_natures do |t| | |
| 4 | + t.string :name | |
| 5 | + end | |
| 6 | + | |
| 7 | + SoftwareHelper.create_list_with_file("plugins/mpog_software/public/static/juridical_nature.txt", JuridicalNature) | |
| 8 | + end | |
| 9 | + | |
| 10 | + def down | |
| 11 | + drop_table :juridical_natures | |
| 12 | + end | |
| 13 | +end | ... | ... |
db/migrate/20140814134827_add_juridical_nature_reference_to_institutions_table.rb
0 → 100644
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +class AddJuridicalNatureReferenceToInstitutionsTable < ActiveRecord::Migration | |
| 2 | + def up | |
| 3 | + change_table :institutions do |t| | |
| 4 | + t.references :juridical_nature | |
| 5 | + end | |
| 6 | + end | |
| 7 | + | |
| 8 | + def down | |
| 9 | + change_table :institutions do |t| | |
| 10 | + t.remove_references :juridical_nature | |
| 11 | + end | |
| 12 | + end | |
| 13 | +end | ... | ... |