diff options
author | Struan Donald <struan@exo.org.uk> | 2018-04-05 16:32:25 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2018-04-11 10:42:52 +0100 |
commit | 0302be8672651348c6357c1afcb917420e956dc6 (patch) | |
tree | f6855aa79d5d9c3e6ad476fc3201f6c0a515522a | |
parent | 3328c572d4a5fbfd93cc95001273152691e71c50 (diff) |
add extra column to body table
Adds and extra column for bodies and the associated Extra role.
-rwxr-xr-x | bin/update-schema | 1 | ||||
-rw-r--r-- | db/downgrade_0061---0060.sql | 5 | ||||
-rw-r--r-- | db/schema.sql | 3 | ||||
-rw-r--r-- | db/schema_0061-add-extra-body.sql | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Body.pm | 12 |
5 files changed, 22 insertions, 4 deletions
diff --git a/bin/update-schema b/bin/update-schema index bbfd732f2..fb88c84a1 100755 --- a/bin/update-schema +++ b/bin/update-schema @@ -212,6 +212,7 @@ else { # (assuming schema change files are never half-applied, which should be the case) sub get_db_version { return 'EMPTY' if ! table_exists('problem'); + return '0061' if column_exists('body', 'extra'); return '0060' if column_exists('body', 'convert_latlong'); return '0059' if column_exists('response_templates', 'external_status_code'); return '0058' if column_exists('body', 'blank_updates_permitted'); diff --git a/db/downgrade_0061---0060.sql b/db/downgrade_0061---0060.sql new file mode 100644 index 000000000..d6934b9b0 --- /dev/null +++ b/db/downgrade_0061---0060.sql @@ -0,0 +1,5 @@ +BEGIN; + +ALTER TABLE body DROP extra; + +COMMIT; diff --git a/db/schema.sql b/db/schema.sql index d08ea675d..fa0bd07bd 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -57,7 +57,8 @@ create table body ( fetch_problems boolean not null default 'f', blank_updates_permitted boolean not null default 'f', convert_latlong boolean not null default 'f', - deleted boolean not null default 'f' + deleted boolean not null default 'f', + extra text ); create table body_areas ( diff --git a/db/schema_0061-add-extra-body.sql b/db/schema_0061-add-extra-body.sql new file mode 100644 index 000000000..125b171fb --- /dev/null +++ b/db/schema_0061-add-extra-body.sql @@ -0,0 +1,5 @@ +BEGIN; + +ALTER TABLE body ADD extra text; + +COMMIT; diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm index 0b11f2771..74a38f225 100644 --- a/perllib/FixMyStreet/DB/Result/Body.pm +++ b/perllib/FixMyStreet/DB/Result/Body.pm @@ -50,6 +50,8 @@ __PACKAGE__->add_columns( { data_type => "boolean", default_value => \"false", is_nullable => 1 }, "convert_latlong", { data_type => "boolean", default_value => \"false", is_nullable => 0 }, + "extra", + { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->has_many( @@ -124,13 +126,17 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07035 @ 2018-03-15 12:38:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rturOWpYmPRO0yE9yWHXjA +# Created by DBIx::Class::Schema::Loader v0.07035 @ 2018-04-05 14:29:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HV8IM2C1ErrpvXoRTZ1B1Q + +__PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn"); +__PACKAGE__->rabx_column('extra'); use Moo; use namespace::clean; -with 'FixMyStreet::Roles::Translatable'; +with 'FixMyStreet::Roles::Translatable', + 'FixMyStreet::Roles::Extra'; sub url { my ( $self, $c, $args ) = @_; |