884 Commits

Author SHA1 Message Date
Pea Tyczynska
ea3144c3fd Add downgrade steps to new rates migration, add end_date to old rates
and refactor migration statements for security good practice
2018-09-25 15:10:16 +01:00
Pea Tyczynska
08fec8f928 Fix tests - update number fo letter rates in test 2018-09-25 15:10:16 +01:00
Pea Tyczynska
86533c2366 Do not update the rate that doesn't change 2018-09-25 15:10:16 +01:00
Pea Tyczynska
0c0166922c Update migration number and get rid of explicit UTC zoning therein 2018-09-25 15:10:16 +01:00
Pea Tyczynska
b3191dbc2a Filter letter rates by post_class in get_rate
Also adjust existing tests.
2018-09-25 15:10:15 +01:00
Pea Tyczynska
8b410e8876 Add new letter rates from 1st of October 2018 2018-09-25 15:10:15 +01:00
Leo Hemsted
918e4b390f add postage to notification + noti_history
if it's a letter notification, postage must equal "first" or "second",
else it must equal null
2018-09-19 16:32:58 +01:00
Rebecca Law
5f73dfdbe9 Added constraints to services.postage: not nullable and can only containt "first" or "second" 2018-09-18 17:41:25 +01:00
Rebecca Law
1c0892888f Change the name of letter_class to postage, this will match the domain language used in the documentation.
Updated the tests to answer review comments.
2018-09-18 15:22:08 +01:00
Rebecca Law
efb618e956 Fix merge conflicts for the db migration file.
Update test_services_dao to stop using fixtures. This is a massive change. The only real change in the file is to check for the letter_class.
2018-09-17 15:45:29 +01:00
Rebecca Law
79815b4f8a In order to support sending letters by first class we need a way to know how the service wants us to send the letter.
To start with this will be an attribute on the service, at the time the notification is created it will look at Service.letter_class to decide what class to use for the letter.

This PR adds Service.letter class as a nullable column.
Updated the create_service and update_service method to default the value to second.

Subsequent PRs will add the check constraint to ensure we only get first or second in the letter_class column and make that column nullable.
This can't be done all at once because it will cause an error if someone inserts or updates a service during the deploy.
2018-09-17 11:27:43 +01:00
Chris Hill-Scott
244e91021d Add two new letter logos 2018-09-14 13:58:50 +01:00
Alexey Bezhan
0dcf04def9 Add notification status for returned letters
We need to update letter notifications with a new status when DVLA
gives us a list of references for returned letters.

This adds the new status to the models and the DB.

DVLA call this 'returned mail', so I'm using it as the status name
since it seems less ambiguous than 'returned'.
2018-09-04 16:55:22 +01:00
Chris Hill-Scott
5d5047fb13 Add unique constraint to email branding domains
Does two things:

1. Revert "Revert "Add unique constraint to email branding domain""

This reverts commit af9cb30ef3.

2. Don’t allow empty string in email branding domain

Columns with multiple `null`s can have a uniqueness constraint. Columns
with multiple empty string values are not considered unique.

This commit:
- removes any duplicate empty string values
- casts empty strings to null string any time these columns are updated

---

Squashed into this single commits because these two things are not
atomic as individual commits.
2018-09-04 11:10:46 +01:00
Chris Hill-Scott
af9cb30ef3 Revert "Add unique constraint to email branding domain" 2018-09-04 10:55:49 +01:00
Chris Hill-Scott
f095fa1ddf Add unique constraint to email branding domain
Brandings with a domain set should be considered canonical. It doesn’t
make sense to have the same domain set on multiple different email
brands – you can’t tell which one to use.
2018-09-04 09:46:50 +01:00
Chris Hill-Scott
834ad73304 Drop service branding column
We’re not using this column any more, so let’s clean up after ourselves.
2018-08-31 15:56:25 +01:00
Chris Hill-Scott
0c47d41977 Remove govuk from possible brands
‘GOV.UK’ doesn’t make sense as a type of brand. It only made sense as
a type of branding that a service had.

Since we’ve:
- deprecated the service branding column
- made sure it’s not used as a value in the email branding table

we can remove this value from the table of possible brand types.
2018-08-30 16:36:35 +01:00
Chris Hill-Scott
337496c5bc Deprecate service branding column
We want to drop this column. First we have to stop using it anywhere.

Needs to be made nullable so we can stop writing to it.
2018-08-30 16:05:37 +01:00
Chris Hill-Scott
11225b7149 Make branding type non-nullable
We’ve already removed all the `null` values, and made it impossible to
add new brandings with a `null` brand type.

Making it a database constraint just gives us extra safety.
2018-08-29 12:46:21 +01:00
Chris Hill-Scott
0107cdcfde Set branding_type to org if it’s none
Same as a0deef06e2 but with `is null` not
`= null` 🤦🏻
2018-08-28 17:24:14 +01:00
Chris Hill-Scott
a71ce9fb54 Add NHS logo for letters
Matches: https://github.com/alphagov/notifications-template-preview/pull/192
2018-08-28 16:56:42 +01:00
Chris Hill-Scott
a0deef06e2 Set branding_type to org if it’s none
So later we can:
- make it non-nullable later
- remove `govuk` as an option

This is mostly for people’s local databases, the manual work here has
been done on production already.
2018-08-28 16:22:42 +01:00
Rebecca Law
a960d2fb1d Remove db columns 2018-08-24 16:09:17 +01:00
Rebecca Law
25c5e0ceb8 Need to do the data migration after removing the columns in the code. 2018-08-24 15:51:28 +01:00
Rebecca Law
45632293b2 Remove new colour columns 2018-08-24 13:53:04 +01:00
Rebecca Law
6c5e60f0a9 Fix merge conflicts 2018-08-23 15:04:44 +01:00
Rebecca Law
4fe1e6bb66 Merge branch 'master' into add-brand-type-to-email-branding 2018-08-23 15:02:55 +01:00
Rebecca Law
f80cd508ac Fix name typo 2018-08-23 14:43:41 +01:00
Rebecca Law
3816010c72 Add brand_type to EmailBranding.
It makes more sense to put the brand_type with EmailBranding rather than in Service.
Next step is to add the new type to the form in admin app.
2018-08-23 13:53:05 +01:00
Chris Hill-Scott
a950425882 Add letter logo for Pension Wise 2018-08-23 13:38:56 +01:00
Rebecca Law
640a400165 DB update script - missing from last commit 2018-08-16 17:10:02 +01:00
Chris Hill-Scott
e0570c1773 Remove caseworking permission
What became ‘caseworking view’ is now available to all services.
2018-08-10 09:09:18 +01:00
Rebecca Law
c30e58eaad Instead of deleting the data in the name field just copy it to the text field.
The admin app still needs to use the name column.
Add the text field to the post data schemas.
If the text is not in the post data, then populate it with the data in the name field.
This should make the migration to text easier, and will work until we are able to update the admin app.
2018-08-02 15:55:45 +01:00
Pea Tyczynska
4345771547 Update migration file version number for email_branding update 2018-07-31 18:01:58 +01:00
Pea Tyczynska
f69bc50985 Move data back before dropping the column for downgrade 2018-07-31 17:58:19 +01:00
Pea Tyczynska
c5792f4d79 Migration file for email_branding fields update 2018-07-31 17:58:19 +01:00
Pea Tyczynska
cf20cea81c Fix migration version numbering 2018-07-31 16:44:21 +01:00
Pea (Malgorzata Tyczynska)
ea28b65871 Merge pull request #1999 from alphagov/drop_monthly_billing_table
Drop monthly billing table
2018-07-31 16:35:48 +01:00
Rebecca Law
cc36209564 Fix file name for migration script 2018-07-31 14:00:18 +01:00
Rebecca Law
7378232353 Added migration script 2018-07-31 13:54:37 +01:00
Pea Tyczynska
885ed1e8e3 Remove monthly_billing table from the database 2018-07-31 11:47:13 +01:00
Rebecca Law
2b0ec9353e Added missing migration file 2018-07-25 14:16:36 +01:00
Alexey Bezhan
778909b189 Add callback_type to service callback history records
We've updated the current service callbacks to add callback types
in #1964, but since the table is versioned we also need to add a
type to the history records.

Even though they're not used anywhere at the moment this might make
it easier to restore from a history callback record in the future.
2018-07-18 13:57:42 +01:00
Pea Tyczynska
e81c395ab1 Assign delivery_status type to existing callbacks 2018-07-18 11:36:39 +01:00
Pea Tyczynska
183aa160c6 Add callback_type column to service_callback_api table
Also add service_callback_type table with allowed types
2018-07-17 16:54:00 +01:00
Rebecca Law
e4cc90e585 Fix merge conflict 2018-07-11 10:09:33 +01:00
Rebecca Law
df0df55402 Added unique constraint for service_id + notification_type
Change updated_at to have onupdate rather than default.
2018-07-11 10:09:33 +01:00
Rebecca Law
b71f6777e9 Create a table SERVICE_DATA_RETENTION to store the number of days the notification is to be kept for. 2018-07-11 10:09:33 +01:00
Rebecca Law
526831504d Merge branch 'master' of github.com:alphagov/notifications-api 2018-07-10 15:46:49 +01:00