Skip to content

Commit

Permalink
Merge pull request #370 from Tampere/feature/refactor-project-types
Browse files Browse the repository at this point in the history
Refactor project types and search
  • Loading branch information
tkataja authored Mar 22, 2023
2 parents 4c6c1e7 + 5157d17 commit 9a91508
Show file tree
Hide file tree
Showing 50 changed files with 1,375 additions and 951 deletions.
1 change: 1 addition & 0 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[sqlfluff]
exclude_rules = L031
dialect = postgres

[sqlfluff:rules]
tab_space_size = 2
Expand Down
41 changes: 37 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Hanna

Hanna is a project management application. It is designed and built initially for the needs of KAPA and KITIA, but with capabilities of expanding to other departments' needs in the future.

Minimum implementation is planned to be finished by 2023 and the software with full functionality and integration list by July 2023.

## Development

- Steps required when running for the first time
* `cp backend/.template.env backend/.env`
* See the `.template.env` file to check if you need to replace or fill some initial values
- `cp backend/.template.env backend/.env`
- See the `.template.env` file to check if you need to replace or fill some initial values

When `backend/.env` is properly set, start the development by running:

Expand Down Expand Up @@ -42,6 +43,38 @@ Web application is served at: https://localhost
NOTE! Due to using https on development at localhost, Caddy Root Certificate need to be configured and trusted (only once)

- After starting the Caddy proxy (via docker compose) for the first time, root certificate can be found from `PROJECT_ROOT/docker/proxy/data/caddy/pki/authorities/local/root.crt`
- MacOS users: ```open ./docker/proxy/data/caddy/pki/authorities/local/root.crt```
- MacOS users: `open ./docker/proxy/data/caddy/pki/authorities/local/root.crt`
- Open the root file in Keychain Access
- Find the Caddy Root CA using the search and right-clicking it, then select *Get Info* and expand the *Trust* section. Finally set SSL setting to *Always Trust*
- Find the Caddy Root CA using the search and right-clicking it, then select _Get Info_ and expand the _Trust_ section. Finally set SSL setting to _Always Trust_

## Hotfix releases

### Releasing fixes existing on `main`

1. Create a new branch off the latest release tag
> hotfix/_\<description\>_
2. Cherry pick the hotfix commits onto the new branch

```sh
# Single commit
$ git cherry-pick <sha>

# Merge commit
$ git cherry-pick -m 1 <sha>
```

3. Create a release manually
- Target: the hotfix branch
- Tag: new patch version number (create on publish)
- Description: write manually or copy from the current release draft

### Committing and deploying new fixes

1. Create a new branch off the latest release tag
> hotfix/_\<description\>_
2. Commit new fixes onto the branch
3. Create a release manually
- Target: the hotfix branch
- Tag: new patch version number (create on publish)
- Description: write manually or copy from the current release draft
4. Merge the hotfix branch back to `main`
39 changes: 39 additions & 0 deletions backend/db_migrations/0039_project-investment.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ALTER TABLE project_common RENAME TO project_investment;
ALTER TABLE project_investment DROP COLUMN project_type;

-- Add new columns as optional
ALTER TABLE project
ADD COLUMN start_date date,
ADD COLUMN end_date date,
ADD COLUMN lifecycle_state code_id;

-- Set default values
UPDATE project
SET start_date = current_date,
end_date = current_date,
lifecycle_state = ('HankkeenElinkaarentila', '01')::code_id;

-- Override with existing values if found
UPDATE project p
SET start_date = pi.start_date,
end_date = pi.end_date,
lifecycle_state = pi.lifecycle_state
FROM project_investment AS pi
WHERE p.id = pi.id;

-- Set the columns required
ALTER TABLE project
ALTER COLUMN start_date
SET NOT NULL,
ALTER COLUMN end_date
SET NOT NULL,
ALTER COLUMN lifecycle_state
SET NOT NULL;

-- Remove the old columns
ALTER TABLE project_investment DROP COLUMN start_date,
DROP COLUMN end_date,
DROP COLUMN lifecycle_state;

-- Remove old project type code list
DELETE FROM code WHERE (id) .code_list_id = 'HankeTyyppi';
Loading

0 comments on commit 9a91508

Please sign in to comment.