diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-04-08 16:14:11 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-04-09 11:02:25 +0100 |
commit | ba8365ab57df349e9c9dafe223548bd2efab515d (patch) | |
tree | 338cf5fae7cb0e5b53aa4c049318e80e78c71feb | |
parent | d436fa0e7d82989a0d7c1c234f7946214da290b3 (diff) |
Add default blank string to PublicBody@short_name
The validation allows a blank short_name but the schema does not.
-rw-r--r-- | app/models/public_body.rb | 2 | ||||
-rw-r--r-- | db/migrate/20140408145616_add_default_short_name_to_public_bodies.rb | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 161bc435d..c1868b32c 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -6,7 +6,7 @@ # # id :integer not null, primary key # name :text not null -# short_name :text not null +# short_name :text default(""), not null # request_email :text not null # version :integer not null # last_edit_editor :string(255) not null diff --git a/db/migrate/20140408145616_add_default_short_name_to_public_bodies.rb b/db/migrate/20140408145616_add_default_short_name_to_public_bodies.rb new file mode 100644 index 000000000..5fb239ebd --- /dev/null +++ b/db/migrate/20140408145616_add_default_short_name_to_public_bodies.rb @@ -0,0 +1,11 @@ +class AddDefaultShortNameToPublicBodies < ActiveRecord::Migration + + def up + change_column_default(:public_bodies, :short_name, '') + end + + def down + change_column_default(:public_bodies, :short_name, nil) + end + +end |