Commit Graph
641 Commits
Author SHA1 Message Date
Pea Tyczynska cea1f24aa0 Simplify the first migration, we will do execute statements later 2020-01-30 17:28:23 +00:00
Pea Tyczynska a2333c2009 Fix typo where wrong column name was checked for being null 2020-01-30 16:34:59 +00:00
Pea Tyczynska 20124d599c Make sure email_access_validated_at is not null after being populated 2020-01-30 16:02:34 +00:00
Pea M. Tyczynska d34eafa1de Merge pull request #2700 from alphagov/re-validate-user-email
Add email_access_valdiated_at field to user table, populate it
2020-01-30 15:35:39 +00:00
Pea Tyczynska 0eed4c99a7 Add email_access_valdiated_at field to user table, populate it
and update it when users have to use their email to interact with
Notify service.

Initial population:
If user has email_auth, set last_validated_at to logged_in_at.
If user has sms_auth,  set it to created_at.

Then:
Update email_access_valdiated_at date when:
- user with email_auth logs in
- new user is created
- user resets password when logged out, meaning we send them an
email with a link they have to click to reset their password.
2020-01-30 14:51:54 +00:00
Katie Smith 64c2061baa Use encryption module from utils
Now that the encryption module has been moved from this app to utils, we
can remove it from here (along with its tests) and import it from utils
instead. This also renames the `encryption.py` file to `hashing.py`,
since it no longer contains the encryption class.
2020-01-24 13:18:37 +00:00
Rebecca Law 5e0ebe8e7a Fix conflicts with db migrations 2019-12-27 11:21:26 +00:00
Rebecca Law 606b2b6c84 Change the insert to use updated_at as the reported_at date 2019-12-27 10:27:59 +00:00
Rebecca Law 22851c4ef0 Migration script to populate the returned letters. 2019-12-27 10:27:59 +00:00
Pea Tyczynska f8ff2d121f Changes following review:
- Check if right keys in new history rows
- Improve model and get rid of old revision version
- Add updated migration file
- Test data when inserting into inbound sms history
2019-12-20 16:17:27 +00:00
Pea Tyczynska de9d1a41eb Create InboundSmsHistory model and table 2019-12-20 16:16:29 +00:00
Rebecca Law d330025447 Changed reported_at to a date and included audit columns. 2019-12-12 14:11:54 +00:00
Rebecca Law e80a002c58 New table returned-letters
The table will contain notification ids for services that have returned letters. This will make it easy to query the data in Notification_history since we can join on the primary key.
2019-12-09 16:19:22 +00:00
Rebecca Law 43c0122dd0 Fix db downgrade script 2019-11-06 13:54:16 +00:00
Rebecca Law 4da06f1d5d remove old db upgrade file 2019-11-06 11:17:01 +00:00
Rebecca Law fd0c12912a Fix merge conflict with db upgrade 2019-11-06 10:54:38 +00:00
Rebecca Law db5a50c5a7 Adding a scheduled task to processing missing rows from job
Sometimes a job finishes but has missed a row in the middle. It is a mystery why this is happening, it could be that the task to save the notifications has been dropped.
So until we solve the missing let's find missing rows and process them.

A new scheduled task has been added to find any "finished" jobs that do not have enough notifications created. If there are missing notifications the job processes those rows for the job.
Adding the new task to beat schedule will be done in the next commit.

A unique key constraint has been added to Notifications to ensure that the row is not added twice. Any index or constraint can affect performance, but this unique constraint should not affect it enough for us to notice.
2019-11-06 10:49:46 +00:00
Leo Hemsted 4ed6ca1601 remove loadtesting from the database 2019-11-05 15:01:55 +00:00
David McDonald 4bc71f36bf Delete dm_datetime database table
No longer needed
2019-10-08 14:02:43 +01:00
Leo Hemsted ddfc722537 letter rates go up by 5p as of 1st october 2019 2019-09-25 16:33:53 +01:00
Chris Hill-Scott edb5790b7c Use nhs_gp not gp as org type
Means we have the option of looking for anything starting with `nhs` as
a way of filtering organisations.
2019-08-28 15:24:30 +01:00
Chris Hill-Scott a5b36457f2 Add ‘GP’ as an org type
Although their allowances are the same as what we call `nhs_local` it
makes more sense to store them separately because:
- we already present them as two separate choices to the user
- we may want to handle them differently in the future, eg in terms of
  what branding choices are available to them
2019-08-27 17:01:03 +01:00
Rebecca Law b37de7785c Remove the organisation_to_service table.
This table is no longer used or referenced in the code.
We can remove this mapping table now that the organisation to service relationship is handled by the foreign key in Services.
2019-08-15 15:17:53 +01:00
Rebecca Law c4127d0508 Improve the data migration and downgrade script. 2019-08-14 11:01:22 +01:00
Rebecca Law 55dc7184cc Add organisation_id to Service.
This is the second commit in the series to add organisation_id to Service.
- Data migration to update services.organisation_id from data in organisation_to_service
 (The rollback will lose any updates to organisation unless the script is updated to set organistion_to_service from service.organisation_id )
- Update Service.organisation relationship to a ForeignKey relationship to Organisation.
- Update Organisation.services to a backref relationship to Service.
2019-08-13 17:25:30 +01:00
Katie Smith 6ea849298e Merge pull request #2580 from alphagov/set-bad-email-addresses-to-perm-fail
Set bad email addresses to permanent-failure
2019-08-12 16:03:01 +01:00
Katie Smith b31e431d4e Rename migration file to match migration revision ID
Because these were slightly different, the `check_if_new_migration`
script would always think there was a new migration to run and so we
were always testing the db migrations when deploying.
2019-08-09 12:41:19 +01:00
Katie Smith f8035811a7 Add new 'upload_letters' permission 2019-08-05 12:02:43 +01:00
Pea Tyczynska 5977adef1c Add live to excluded environments in migration 2019-07-25 16:03:08 +01:00
Pea Tyczynska 38bb2c1cf6 Simpify org types migration script and introduce foreign key
Don't transform org types on prod
2019-07-24 17:55:56 +01:00
Pea Tyczynska 5b256fa64e Migrate all orgs and services onto new organisation types
Remove all mentions of generic 'nhs' organisation type.
2019-07-22 14:58:41 +01:00
Pea Tyczynska edda816ffa Temporarily add generic 'nhs' 2019-07-19 15:13:24 +01:00
Pea Tyczynska aa88252cf7 Drop making crown not nullable on downgrade as it would fail anyway 2019-07-18 17:05:24 +01:00
Pea Tyczynska d89ef0594f nhs_central is crown org and also we do not update org type while
updating service anymore.
2019-07-18 17:05:24 +01:00
Pea Tyczynska e4cb56b5d3 Emergency service instead of emergency services 2019-07-18 17:05:23 +01:00
Pea Tyczynska 8a3ac8400f Update service type and crown when service is added to organisation 2019-07-18 17:05:23 +01:00
Pea Tyczynska 9dfc550f46 Add org types table 2019-07-18 17:05:22 +01:00
Leo Hemsted a61a28a8c8 add emails to send when an MOU is signed
* tell the user that clicks the button
* tell the notify team
* tell the person that the button was clicked on behalf of

there are two templates for the first case
2019-07-09 11:57:13 +01:00
Pea Tyczynska 2a5b0f8f17 Change the order of delete statements to respect foreign key constraint 2019-06-28 11:22:12 +01:00
Pea Tyczynska 9782b08982 Add comment reminder to add template redacted when creating a template
through a migration.
Also fix the downgrades so they delete everything that needs deleting.
2019-06-26 19:03:15 +01:00
Pea Tyczynska bd3594b2a9 Resign from trigger solution as we couldn't make it work 2019-06-26 18:36:03 +01:00
Pea Tyczynska 32e45828f8 Rename migration file 2019-06-26 18:36:03 +01:00
Pea Tyczynska ce6f1a5572 Add trigger that ensures row in template_redacted is created
when adding new template through a migration
2019-06-26 18:36:03 +01:00
Pea Tyczynska 0ca7d4a20c Create template_redacted entry for templates created by migration
So that we can edit those templates
2019-06-26 18:36:03 +01:00
Chris Hill-Scott 8977f5193e Add columns for on whose behalf agreement signed
This is changing because we’re going to introduce accepting contracts
and MoUs online.

Previously
---
We had one column for who signed the agreement, which is foreign keyed
to the user table. This is still relevant, because there will always be
a user who is clicking the button.

Now
---
We add two new fields for the name and email address of the person on
whose behalf the agreement is being accepted. This person:
- is different from the one signing the agreement
- won’t necessarily have a Notify account
2019-06-18 10:41:22 +01:00
Rebecca Law a1f6a5f78a Update the unique constraint for the name of an api_key so that it only looks at api_keys that are not expired (or expiry_date is null).
This will allow clients to create a new api key with the same name.
2019-06-04 15:30:27 +01:00
Pea Tyczynska c4d20667a6 Add notification deletion to downgrade to respect foreign key constraints 2019-05-28 15:25:06 +01:00
Pea Tyczynska 5f1f688c7b Create template to verify service email reply-to addresses
So that template with the same ID is present on all environments
2019-05-28 15:14:09 +01:00
Rebecca Law 3374e03ce9 Prepare to stop inserting NotificationHistory at the time of inserting a notificaiton.
Need to remove foreign key to complaints.
Make sure if getting Notification.id we look to both tables.
2019-05-21 16:08:18 +01:00
Pea Tyczynska 67e3a7689a Give existing users all folder permissions
This will be done just before we turn on folder permissions
to all services to ensure that all users start with all the
permissions.
2019-05-17 10:33:05 +01:00