Commit Graph
717 Commits
Author SHA1 Message Date
Chris Hill-Scott f0f3e03931 Add letter logo for environment agency
Depends on:
https://github.com/alphagov/notifications-template-preview/pull/87
2018-01-29 17:29:24 +00:00
Chris Hill-Scott d70fc958f6 Backfill redaction for pre-seeded templates
Will specifically affect the email auth template, which was seeded
without a matching row in the `template_redacted` table.

Effectively re-runs c24edcf388

> add historical redaction data
>
> every current template gets a row in the template_redacted table -
> this inserts one for any template that doesn't already have a row,
> with redact set to false, the user set to NOTIFY_USER since it was
> just a script, and the updated_at set to the time the script is run
2018-01-18 12:38:43 +00:00
Katie Smith f6ef0ebbd7 Remove database default on rate_limit column
The default for the rate_limit column in the services and
services_history model is now set in the model, so we can remove the
default from the database.

Pivotal story: https://www.pivotaltracker.com/story/show/153992529
2018-01-11 10:37:26 +00:00
Katie Smith 649679d67f Add rate_limit column to service model
The API rate limit will be removed from the config and added to services
so that it is possible to change the rate_limit for individual services
in rare cases.

Pivotal story: https://www.pivotaltracker.com/story/show/153992529
2018-01-09 11:20:52 +00:00
Rebecca Law 7792c18efb Migration script to update the templates and templates_history (latest version only) with the service default letter contact block. 2018-01-05 17:34:51 +00:00
Rebecca Law 884b8f3990 Merge branch 'master' into revert-is_letter_contact_blank 2018-01-05 16:20:50 +00:00
Rebecca Law f34a380f7f Fix file name 2018-01-05 16:00:29 +00:00
Rebecca Law 0bc42d1873 Forgot script 2018-01-05 15:58:13 +00:00
Rebecca Law 9e9b8ab1a3 There was a misunderstanding about how we wanted the feature to work.
There is no need for the extra column.
If a template does not have a default address set - they address will be blank.
Otherwise use the address of the service_letter_contact.

There will be another PR to do a db migration.
Template.service_letter_contact = blank if no service_letter_contacts for service ELSE use set Template.serivce_letter_contact_id = service default service_letter_contact
2018-01-05 15:32:43 +00:00
Rebecca Law 6a3831eace Added a boolean column to templates called is_letter_contact_blank.
If is_letter_contact_blank then the user has set the letter contact block to be blank on purpose
ELSE IF is_letter_contact_blank is false THEN use the template default
IF template default is blank THEN the service_letter_contact is blank use the service default
2018-01-04 11:33:10 +00:00
venusbb 689ece75a0 db version change 2017-12-13 10:03:40 +00:00
Leo Hemsted ea71af695d Merge branch 'master' into remove-fragments-from-db 2017-12-12 16:32:07 +00:00
Leo Hemsted 08b21bc0f4 remove fragments from db 2017-12-07 10:23:41 +00:00
Rebecca Law da656af6e0 Fix merge conflict with db script 2017-12-06 17:26:32 +00:00
Rebecca Law ad060435ca Merge branch 'master' into refactor-letter-rates 2017-12-06 17:25:39 +00:00
Rebecca Law 14be85160c Insert initial letter rates.
Create letter rates dao.
Query to fetch letter rates.
2017-12-06 16:40:38 +00:00
Chris Hill-Scott 64f13a0064 Add a new organisation for letter branding 2017-12-05 13:56:13 +00:00
Rebecca Law 07a71ef71c Fix db migration script 2017-12-05 13:54:10 +00:00
Rebecca Law 91e6cb9215 Merge branch 'master' into refactor-letter-rates 2017-12-05 12:03:13 +00:00
Rebecca Law 956907c170 Revert the last commit. It was intended for another branch. 2017-12-05 10:54:55 +00:00
Rebecca Law 00d2e543dc Refactor letter_rates table to include everything needed to calculate billing for letter notificaitons.
It is ok to drop the existing tables as they are not used anywhere as of yet.
2017-12-05 10:32:19 +00:00
Rebecca Law 06a6d37595 Merge branch 'master' into add-crown-column-to-services 2017-12-05 10:28:26 +00:00
Rebecca Law b4a1d635f7 Rebuild the letter_rates table to include everything it needs.
The current letter_rates table is not used so it is ok to drop and re-create it
2017-12-05 10:27:29 +00:00
Rebecca Law 7fa4e7ffc7 Set crown if organisation_type is updated on service.
Add some tests.
Update the initial values of crown.
2017-12-04 16:07:26 +00:00
Katie Smith f73319f5ef Add and populate crown column to services and services_history
- Added the boolean 'crown' column to services and services_history tables
- We populate this column in the same migration script by checking the
'organisation_type' of a service
2017-12-04 13:31:08 +00:00
Ken Tsang 907a9d62a1 Add letters_as_pdf service permission 2017-12-01 17:25:20 +00:00
Rebecca Law 12dd58d281 Script to drop the tables. 2017-11-30 16:51:26 +00:00
venusbb 5761d22822 Migration to create new database table service_callback_api 2017-11-28 15:25:15 +00:00
Rebecca Law df2d3a95ae [WIP] 2017-11-23 14:55:49 +00:00
Rebecca Law 80db78e7a5 Fix merge conflict 2017-11-23 13:46:14 +00:00
Rebecca Law a19cb66590 Merge branch 'master' into add-reply-to-notifications 2017-11-23 13:45:27 +00:00
Rebecca Law 1378c45ba1 Add a column to Notifications to store the reply_to_text.
This is text value of the sender_id, depending on the channel this will be a SMS sender, email reply to address or a letter contact block.
This is the first PR in a series to refactor how we send the "reply_to" the provider, eventually we can eliminate the notification_to_sms_sender and notification_to_email_to tables.
2017-11-22 14:46:14 +00:00
Alexey Bezhan 0be39cc9f9 Add a migration to add template service_letter_contact_id columns 2017-11-22 14:26:04 +00:00
Rebecca Law c80bdbaffe Remove email_reply_to and letter_contact_block from Services 2017-11-21 11:06:07 +00:00
Alexey Bezhan 0a50993fc2 Validate notifcations.template_history foreign key constraints
Removes "NOT VALID" mark from the notifications -> template_history
foreign key constraint by validating existing records.

From postgres docs:

> This form validates a foreign key or check constraint that was
> previously created as NOT VALID, by scanning the table to ensure there
> are no rows for which the constraint is not satisfied. Nothing happens
> if the constraint is already marked valid.

> Validation can be a long process on larger tables. The value of
> separating validation from initial creation is that you can defer
> validation to less busy times, or can be used to give additional time
> to correct pre-existing errors while preventing new errors. Note also
> that validation on its own does not prevent normal write commands
> against the table while it runs.

> Validation acquires only a SHARE UPDATE EXCLUSIVE lock on the table
> being altered. If the constraint is a foreign key then a ROW SHARE
> lock is also required on the table referenced by the constraint.
2017-11-20 15:23:27 +00:00
Rebecca Law 93f19956b8 Remove notification_statistics and Service.sms_sender 2017-11-20 13:13:13 +00:00
Chris Hill-Scott e8a94422e5 Make SMS prefix setting non-nullable
We have now:
- defaulted new services to start with this column set to `true`
- migrated all preexisting services[1] to have either `true` or `false` set
  for this column

There is no way for a service to switch back from `true`/`false` to
`null`.

This means that we can safely enforce a non-nullable constraint on this
column now.

1. There is a little gotcha: the GOV.UK Notify service still relies on
   the `sms_sender` column. It doesn’t have a row in the
   `service_sms_senders` table. This means the previous migration
   never changed this service’s value for `prefix_sms` from `null`. So
   this commit also changes its value to `False`, so that the rest of
   the migration, of the whole column, is possible.
2017-11-16 14:29:32 +00:00
venusbb 7ac0346961 change migration version 2017-11-16 13:44:55 +00:00
Venus Bailey bb0c8090c5 Merge pull request #1389 from alphagov/vb-sms-allowance-data-migration
migrate data from service table to annual billing
2017-11-16 13:16:15 +00:00
Rebecca Law 9fa59c9407 Fix merge conflict 2017-11-15 12:42:49 +00:00
Rebecca Law fd217e67f5 Merge branch 'master' into remove-initial-update-sms-sender 2017-11-15 12:33:38 +00:00
venusbb e903257156 version change because of other commits 2017-11-15 11:25:27 +00:00
Alexey Bezhan d2a220a418 Fix migration numbers after #1383 2017-11-15 11:03:55 +00:00
Rebecca Law 45bf7e1938 Fix db migration merge conflict
Update create_service_with_inbound_number
2017-11-15 11:00:56 +00:00
venusbb fcfea6844d Merge branch 'master' of https://github.com/alphagov/notifications-api into vb-sms-allowance-data-migration 2017-11-15 10:54:22 +00:00
Alexey Bezhan bc54d34a22 Merge pull request #1384 from alphagov/notifications-template-history
Fix notifications template history relationship
2017-11-15 10:51:56 +00:00
Rebecca Law e3f9dab884 Merge branch 'master' into remove-initial-update-sms-sender 2017-11-14 16:27:10 +00:00
venusbb 7c0c2a9a0f migrate data from service table to annual billing 2017-11-14 09:43:28 +00:00
Alexey Bezhan 9d4b8961cb Add a migration to replace notifications_template foreign key
Removes notifications.template_id foreign key and replaces it with
a composite foreign key constraint to TemplateHistory using the
existing notification columns for template ID and template version.

Foreign key constraint is created as NOT VALID to avoid locking the
notifications table while postgres verifies that existing records
don't break the constraint. From postgres docs:

> If the constraint is marked NOT VALID, the potentially-lengthy initial
> check to verify that all rows in the table satisfy the constraint is
> skipped. The constraint will still be enforced against subsequent
> inserts or updates (that is, they'll fail unless there is a matching
> row in the referenced table, in the case of foreign keys; and they'll
> fail unless the new row matches the specified check constraints). But
> the database will not assume that the constraint holds for all rows
> in the table, until it is validated by using the VALIDATE CONSTRAINT
> option.

VALIDATE CONSTRAINT will be issued as a separate migration in a
follow-up PR.
2017-11-10 15:13:55 +00:00
Leo Hemsted 15bf888624 make user mobile num nullable if user has email_auth enabled 2017-11-09 19:07:44 +00:00