Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New approach to dataset referencing between widgets, number input questions, answer validation, local dev make scripts #101

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ clean:
clean-images:
docker images prune

# Requires argument `dbname` to specify the name of the new DB, usage: `make local-db dbname=my_db`
# Requires argument `dbname` to specify the name of the new DB, usage: `make local-db dbname=my_db dbfile=mydb.sql`
# Requires argument `dbfile` to specify the name of the DB dump file to recreate, usage: `make local-db dbname=my_db dbfile=mydb.sql`
local-db:
cd db && docker exec --workdir / investigations-api-postgres-1 psql -U craft -c "create database $(dbname);"
cd db && docker exec --workdir / investigations-api-postgres-1 psql -U craft -d $(dbname) -f inv_mar.sql
cd db && docker exec --workdir / investigations-api-postgres-1 psql -U craft -d $(dbname) -f $(dbfile)
echo "\n\n\n\nDon't forget to update your docker-compose-local-db.yaml with the DB name: $(dbname)"

db-list:
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@ This project was created with Docker version 20.10.5.

## Set up and run the project locally

#### Make scripts

---
To list your local DBs:

`make db-list`

---
To list the databases sitting around in the `prod` environment:

`make cloud-db-list`

---
To export a `prod` database to the `gs://release_db_sql_files/investigations/` bucket:

`make cloud-db-export dbname=prod_db`

* The argument `dbname` is required and should be one of the databases listed from `make cloud-db-list`
* Once you download the DB dump file, move it to the `./db/` folder
---
To recreate a local DB from a dump file located within `./db/`:

`make local-db dbname=my_new_local_db dbfile=prod.sql`

* The argument `dbname` is required and will be the name of the newly created database
* The argument `dbfile` is required and should be the name of the DB file to recreate, this file _must_ be in the `./db/` folder
---
#### Deprecated workflow

0. Uncomment the `COPY` line in `./db/Dockerfile`
1. Install [Docker](https://docs.docker.com/get-docker/)
2. Clone this repository
3. Add a .env file (based on .env.sample) and provide values appropriate to your local dev environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,98 @@ fieldLayouts:
userCondition: null
warning: null
width: 100
-
elementCondition:
class: craft\elements\conditions\entries\EntryCondition
conditionRules:
-
class: craft\fields\conditions\OptionsFieldConditionRule
fieldUid: a966d509-84b0-43ab-9a5b-42590a5fb537 # Answer Type
operator: in
uid: b0369af6-cbb4-4ac0-8301-401d8a0ec2cf
values:
- number
elementType: craft\elements\Entry
fieldContext: global
fieldUid: 79f2f742-966c-42df-9d04-8492d456325c # Minimum
instructions: null
label: null
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: e972137e-acc9-48fe-a897-06639c0cc354
userCondition: null
warning: null
width: 25
-
elementCondition:
class: craft\elements\conditions\entries\EntryCondition
conditionRules:
-
class: craft\fields\conditions\OptionsFieldConditionRule
fieldUid: a966d509-84b0-43ab-9a5b-42590a5fb537 # Answer Type
operator: in
uid: 210b86ab-5066-4414-9848-ac87a33a6232
values:
- number
elementType: craft\elements\Entry
fieldContext: global
fieldUid: d5901e55-99c9-441a-937e-05a065d6e60b # Maximum
instructions: null
label: null
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 08139682-17dd-426c-af3b-dd9d171a63ac
userCondition: null
warning: null
width: 25
-
elementCondition:
class: craft\elements\conditions\entries\EntryCondition
conditionRules:
-
class: craft\fields\conditions\OptionsFieldConditionRule
fieldUid: a966d509-84b0-43ab-9a5b-42590a5fb537 # Answer Type
operator: in
uid: 56af986b-38fc-4fb6-9c5f-c147b11902c3
values:
- number
elementType: craft\elements\Entry
fieldContext: global
fieldUid: 24f2e959-23a9-4f1a-8394-0849fb85b85b # Precision
instructions: null
label: null
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 5eb2e698-b5d8-4dad-b93e-f1415fa657f2
userCondition: null
warning: null
width: 25
-
elementCondition:
class: craft\elements\conditions\entries\EntryCondition
conditionRules:
-
class: craft\fields\conditions\OptionsFieldConditionRule
fieldUid: a966d509-84b0-43ab-9a5b-42590a5fb537 # Answer Type
operator: in
uid: fa7553ab-5c70-4b93-a086-ef38824696cc
values:
- number
elementType: craft\elements\Entry
fieldContext: global
fieldUid: 37af5dda-9a0b-458a-b48c-1bd31b9170af # Validation
instructions: null
label: null
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 4c8613d1-5b87-49c5-9916-5223625962ec
userCondition: null
warning: null
width: 100
name: Content
uid: 38c902fa-7739-496e-a506-0b98d6d480d0
userCondition: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ settings:
__assoc__:
-
- label
- Select
- Textarea
-
- value
- select
- textarea
-
- default
- ''
-
__assoc__:
-
- label
- Widget
- Select
-
- value
- widget
- select
-
- default
- ''
-
__assoc__:
-
- label
- Textarea
- Number
-
- value
- textarea
- number
-
- default
- ''
Expand All @@ -63,6 +63,17 @@ settings:
-
- default
- ''
-
__assoc__:
-
- label
- Widget
-
- value
- widget
-
- default
- ''
-
__assoc__:
-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
columnSuffix: vcifkykz
contentColumnType: integer(10)
fieldGroup: e1b23b33-c33f-4c74-9811-250c2cc2789a # Data
handle: maximum
instructions: null
name: Maximum
searchable: false
settings:
decimals: 0
defaultValue: null
max: null
min: 0
prefix: null
previewCurrency: null
previewFormat: decimal
size: null
suffix: null
translationKeyFormat: null
translationMethod: none
type: craft\fields\Number
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
columnSuffix: pychgyxo
contentColumnType: integer(10)
fieldGroup: e1b23b33-c33f-4c74-9811-250c2cc2789a # Data
handle: minimum
instructions: null
name: Minimum
searchable: false
settings:
decimals: 0
defaultValue: null
max: null
min: 0
prefix: null
previewCurrency: null
previewFormat: decimal
size: null
suffix: null
translationKeyFormat: null
translationMethod: none
type: craft\fields\Number
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
columnSuffix: uibuvada
contentColumnType: smallint(1)
fieldGroup: e1b23b33-c33f-4c74-9811-250c2cc2789a # Data
handle: precision
instructions: null
name: Precision
searchable: false
settings:
decimals: 0
defaultValue: 0
max: 6
min: 0
prefix: null
previewCurrency: null
previewFormat: none
size: null
suffix: null
translationKeyFormat: null
translationMethod: none
type: craft\fields\Number
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
columnSuffix: null
contentColumnType: string
fieldGroup: b0465285-e18b-4739-a3a5-cb0ec0571dd8 # Questions
handle: validation
instructions: null
name: Validation
searchable: false
settings:
contentTable: '{{%matrixcontent_validation}}'
maxBlocks: null
minBlocks: null
propagationKeyFormat: null
propagationMethod: all
translationKeyFormat: null
translationMethod: site
type: craft\fields\Matrix
Loading
Loading