Files
grecia/db/migrate/20201111095452_create_sdg_goals.rb
Javi Martín 428644cd3e Add SDG goal model
Since data for this model (title and description) is not generated in
CONSUL but by the United Nations, we aren't storing it in the database
but in our YAML translation files.

The reasoning is as follows. Suppose that, a few months after CONSUL
gets SDG support, a new language is added to CONSUL.

With YAML files, getting the texts in the new language would mean
updating CONSUL to include the new language.

But if we store these texts in the database, it means we have to update
the databases of all existing CONSUL installations, either each
installation by themselves (duplicating efforts) or running a rake task
(which we would have to write each time).

So we believe using translations works better in this case.

We're still storing records in the database with the code, so they can
be easily referenced via `has_many` or `has_many :through` associations.
2020-12-02 12:13:02 +01:00

11 lines
207 B
Ruby

class CreateSDGGoals < ActiveRecord::Migration[5.2]
def change
create_table :sdg_goals do |t|
t.integer :code, null: false
t.timestamps
t.index :code, unique: true
end
end
end