Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
3521912
WIP: relational schema generation 1
Feb 7, 2024
090858f
intermediate commit
Feb 8, 2024
9551dd2
main merged
Feb 8, 2024
7346c76
files moved to new destinations
Feb 8, 2024
449bf0a
first doc and working for debugger
Feb 8, 2024
d1dd8d7
Merge branch 'main' into generate_relational_db_schema
Feb 12, 2024
90dee01
shorten projector. used_as_default_projector_for_current_list_of_spe…
Feb 12, 2024
a9a028a
table- and field-names moved to helper_get_names.py
Feb 13, 2024
f59d7d1
all constraint names to build in helper_get_names
Feb 13, 2024
7f73d36
added .gitignore
Feb 14, 2024
1ffc8dc
last name get methos (?)
Feb 14, 2024
e569cda
removed primary attribute
Feb 14, 2024
d33c92c
fix error DEFAULT with empty enum list
Feb 15, 2024
dff00aa
schema.sql to schema_relational.sql in text
Feb 15, 2024
59e452f
make target generate-relational-schema
Feb 15, 2024
8a740ed
makefile commands db handling
Feb 16, 2024
308f3a1
use psycopg-binaray for dev
Feb 19, 2024
d80fefd
Merge branch 'main' into generate_relational_db_schema
Feb 19, 2024
d5e43e2
Apply database schema on starting dev container
Feb 19, 2024
2d17230
merge main
Feb 20, 2024
25947b6
intermediate with postgres function truncate_tables for test setup, c…
Feb 23, 2024
b8fd2c3
deployable schema and test with some data initialized
Feb 29, 2024
ed40049
Merge branch 'main' into generate_relational_db_schema
Feb 29, 2024
737d98f
workflow_states defined, common data test-setup in db-template ready
Feb 29, 2024
2c35082
tests for generic and 1:1 relation plus fixes
Mar 1, 2024
0839b27
create_meeting-method
Mar 5, 2024
8116b90
Install postgres debugger as deb package
Mar 8, 2024
baa1c0b
Implement 1:n relations, where the n-side is required via trigger
Mar 8, 2024
6456c24
debug capabilities, some new attributes and 1 dummy
Mar 11, 2024
e2988da
Some setup fixes
jsangmeister Mar 18, 2024
b0f6856
fix formal checks
Mar 19, 2024
171f02d
better documented models.yml
Mar 19, 2024
50d0b39
Disable model.yml validation in CI
jsangmeister Mar 20, 2024
f1b19a2
Merge pull request #61 from jsangmeister/setup-fixes
jsangmeister Mar 20, 2024
11fc904
add *.code-workspace to gitignore
Mar 22, 2024
6a61d07
intermediate checks
Mar 25, 2024
1db9010
draft: started get relation letters in check_relation_definitions
Mar 25, 2024
5a23cf2
Merge branch 'main' into feature/relational-db
jsangmeister Mar 26, 2024
6e825eb
merge main/feature
Mar 26, 2024
a5c7bac
fix some small errors in models.yml
Mar 28, 2024
70983bf
add .gitignore
Mar 28, 2024
cf80722
Merge branch 'feature/relational-db' into generate_relational_db_schema
Mar 30, 2024
156b6ea
models.yml fixed with all needed reference attributes
Apr 3, 2024
3db9ee8
add check for existing to-attribute if reference is present
Apr 3, 2024
6438beb
Apply PR65 readd 'to' relation fields
Apr 3, 2024
647fd81
escape ' in comment
Apr 3, 2024
583ef7a
define fields organization_id automatically as number with value 1
Apr 3, 2024
861f75d
remove unnecessary elements from decision list
Apr 4, 2024
65f17da
readd .gitignore
Apr 4, 2024
f9c7f78
fix annotations from code review
Apr 4, 2024
275ff68
fix format eror
Apr 4, 2024
1d0c410
Merge pull request #17 from r-peschke/generate_relational_db_schema
Apr 5, 2024
8581da5
change table names: use appendix "_t"
Apr 5, 2024
6d8395f
Merge pull request #71 from r-peschke/relDB-change_table_names
Apr 5, 2024
5a9094c
sql only in relation, better error reporting
Apr 9, 2024
5f3735c
Merge pull request #73 from r-peschke/I13_fix_sql_signification
Apr 9, 2024
6d05b70
Merge `main` into `feature/relational-db`
jsangmeister Apr 9, 2024
f8e5d54
Fix close issues action
jsangmeister Apr 9, 2024
3c1be82
Merge pull request #75 from jsangmeister/fix-close-issues
jsangmeister Apr 9, 2024
8a9d693
Fix close issues
jsangmeister Apr 9, 2024
3f279f9
Merge pull request #76 from jsangmeister/fix-close-issues
jsangmeister Apr 9, 2024
13b4653
Fix close issues
jsangmeister Apr 9, 2024
5d0823d
Merge pull request #77 from jsangmeister/fix-close-issues
jsangmeister Apr 9, 2024
6439e54
enum checking in constraint instead pg enums (only string)
Apr 11, 2024
e4641fb
convert enums to constraints and colors to strings
Apr 12, 2024
cb70d6d
Merge pull request #80 from r-peschke/I13_enums_and_hex
Apr 12, 2024
e4c02dc
use python-sql for generating sql
Apr 17, 2024
7203c19
Fix models & rudimentary validation
jsangmeister Apr 18, 2024
ba658f8
Re-enable CI
jsangmeister Apr 18, 2024
9cef28f
Fix models
jsangmeister Apr 18, 2024
e509878
Comment out unfinished SQL statements
jsangmeister Apr 18, 2024
98307c5
Revert relation change
jsangmeister Apr 18, 2024
61a9e48
fix hints from code review
Apr 18, 2024
7e253f4
Add support for self-referencing relations
jsangmeister Apr 18, 2024
b3cfeb6
fix hints from code review 2
Apr 18, 2024
936d185
Merge pull request #84 from jsangmeister/fix-models
jsangmeister Apr 19, 2024
fae58a6
Merge branch 'feature/relational-db' into add-identical-motion-ids
jsangmeister Apr 19, 2024
b6da76d
Merge pull request #85 from jsangmeister/add-identical-motion-ids
jsangmeister Apr 19, 2024
33f340d
Merge branch 'main' into feature/relational-db
jsangmeister Apr 19, 2024
06f6a73
merge feature/relational-db
Apr 19, 2024
6da629c
fix import helper_get_names
Apr 19, 2024
572111f
Merge pull request #83 from r-peschke/I13_python_sql_replaces_psycopg…
Apr 19, 2024
78d720e
Merge main into feature branch
Apr 26, 2024
6b090c8
Merge pull request #92 from r-peschke/feature/relational-db
Apr 26, 2024
dc13061
Merge branch 'main' into feature/relational-db
May 6, 2024
e7433f6
Merge pull request #98 from r-peschke/feature/relational-db
May 6, 2024
9077385
Ch attribute set is_view_field
reicda May 17, 2024
de6e58a
Merge branch 'main' into feature/relational-db
May 29, 2024
59b4f26
Merge pull request #105 from r-peschke/feature/relational-db
May 29, 2024
7d6ccb1
implemented get view field and write field method
reicda Jun 5, 2024
41c2e71
Merge branch 'main' into feature/relational-db
Jun 6, 2024
e563c46
Moved functions to helper_get_names
reicda Jun 12, 2024
dc2275e
Merge pull request #102 from reicda/2311-dr-dev-branch-rel-db
reicda Jun 14, 2024
4aa5adc
Merge branch 'main' into feature/relational-db
Jun 14, 2024
f20bd7d
Merge branch 'main' into feature/relational-db
Jun 24, 2024
daf124f
Merge remote-tracking branch 'upstream/main' into feature/relational-db
Jul 5, 2024
312dad9
make CREATE EXTENSION idempotent
Jul 12, 2024
13962d8
Merge pull request #130 from r-peschke/make_create_extension_idempotent
Jul 18, 2024
f6edd38
merge main into feature/relational-db
Aug 14, 2024
e61d605
Add reference for foreign key to field meeting/anonymous_group_id
Aug 14, 2024
74824dd
Merge pull request #150 from r-peschke/Add_reference_to_meeting_anony…
Aug 14, 2024
717cb1c
Fix import and generate new relational schema
Aug 15, 2024
84da921
Merge pull request #152 from r-peschke/Fix_import_into_generate_sql_main
Aug 15, 2024
24f09dc
remove idempotency from relational schema (should always be done by m…
Aug 15, 2024
70d4e8f
fix formatting
Aug 16, 2024
40525cc
Merge pull request #153 from r-peschke/remove_idempotency_of_rel_schema
Aug 16, 2024
7d87d03
version upgrade python-sql package to 1.5.1
Aug 22, 2024
d1e7daa
Merge pull request #154 from r-peschke/refresh-python-sql-1.5.1
Aug 22, 2024
ab81ad9
Remove function truncate_tables from relational schema generation
Aug 28, 2024
f3ea624
Merge pull request #156 from r-peschke/remove_funtion_truncate_tables…
Aug 28, 2024
694aaa8
set all FK to INITIALLY DEFERRED
reicda Sep 4, 2024
eaa6519
cleanup
reicda Sep 4, 2024
8f03d2c
Merge pull request #159 from reicda/set-all-foreign-key-contraints-to…
Sep 4, 2024
452a40b
merge main into feature/relational-db
Sep 16, 2024
a9deb5a
Merge branch 'main' into feature/relational-db
Sep 18, 2024
0461b60
main merge with fixes, generate field_name for nm-table_name from ini…
Sep 18, 2024
163343e
newly generated schema_relational.sql
Sep 18, 2024
f87debb
remove tailing _t from nm- and gm-table names in schema generation
Sep 18, 2024
40757a7
Merge pull request #173 from r-peschke/I171_intermediate_tables_witho…
Sep 18, 2024
6e3fce0
NOTIFY trigger (#212)
peb-adr Mar 6, 2025
60a52d2
Merge remote-tracking branch 'upstream/main' into HEAD
ostcar Apr 1, 2025
760ffa4
Generate schema after merge
ostcar Apr 1, 2025
c45d201
Fix decimal type (#248)
ostcar Apr 4, 2025
39c09d4
Send notifications on transaction commit (#249)
rrenkert Apr 7, 2025
55930d1
Merge remote-tracking branch 'upstream/main' into feature/relational-db
ostcar Apr 7, 2025
39a3824
Set views in quotes. (#250)
ostcar Apr 7, 2025
bce10cf
Add/Fix file with init data (#251)
ostcar Apr 8, 2025
0195595
remove _t from table name in notification to get correct fqid (#252)
LinKaKling Apr 9, 2025
8c03c46
update trigger and functions (#254)
rrenkert Apr 9, 2025
1106164
Generate views for all collections (#255)
hjanott Apr 11, 2025
0eb36c4
[rel-db] Initially defer and use correct field in nm gm (#263)
hjanott May 28, 2025
5b903a6
Add cascading delete to intermediate tables (#271)
hjanott Jun 11, 2025
5cbb361
Unique keyword for 1:1 relations (#272)
hjanott Jun 11, 2025
ced8eb5
give ordered output on view relation lists (#273)
hjanott Jun 13, 2025
332013b
use custom sql for relations of user with committee and meeting (#277)
hjanott Jul 2, 2025
7fa0add
merge upstream main
hjanott Jul 14, 2025
7604835
Fix and unify the sql attributes
ostcar Jul 17, 2025
839fb55
Change models.yml for new vote service based on rel-db
ostcar Jul 17, 2025
07cd4c7
generate sql
ostcar Jul 17, 2025
c7071cf
[rel-db] Double precision (#286)
hjanott Jul 17, 2025
13c0ca5
[Rel-DB] Fix and unify the sql attributes (#288)
ostcar Jul 17, 2025
96d6204
move analog from visibility to method
ostcar Jul 18, 2025
a8c09b6
Merge remote-tracking branch 'upstream' into HEAD
hjanott Jul 24, 2025
59c42d3
generate schema
hjanott Jul 24, 2025
a45bb6d
cleanups
ostcar Jul 26, 2025
05aac25
Merge branch 'main' into feature/relational-db
ostcar Jul 27, 2025
13ee685
Fix sql comments with quotes (#292)
hjanott Jul 28, 2025
dd23ffc
Related models notification log trigger (#256)
LinKaKling Aug 18, 2025
39e3d28
[rel-db] Handle relational fields referencing themselves (#293)
vkrasnovyd Aug 20, 2025
87fd8a6
Merge remote-tracking branch 'upstream/feature/relational-db' into fe…
ostcar Aug 25, 2025
10a6f4e
Move analog back to visibility
ostcar Aug 25, 2025
41c15d0
poll/result is not required
ostcar Aug 25, 2025
076ab67
Update sql
ostcar Aug 25, 2025
41c23bb
Vote can be any text
ostcar Aug 29, 2025
0896755
Merge remote-tracking branch 'upstream/main' into feature/relational-db
ostcar Sep 4, 2025
a26b45d
[rel-db] Remove option from base_data (#305)
ostcar Sep 4, 2025
cfb9ff2
Merge remote-tracking branch 'upstream/feature/relational-db' into fe…
ostcar Sep 5, 2025
cbe528f
make poll/config and poll/request text fields
ostcar Sep 7, 2025
6d5c2ac
Add field live_voting_enabled
ostcar Sep 8, 2025
b940876
[rel-db] Update sequences after insert (#312)
rrenkert Sep 11, 2025
5b34950
Add references to history collections (#311)
rrenkert Sep 11, 2025
f96efec
restriciton modes and new publish system
ostcar Sep 13, 2025
1067e1d
Merge remote-tracking branch 'upstream/feature/relational-db' into fe…
ostcar Sep 13, 2025
5fc2e68
make allow_invalid a separat attribute
ostcar Sep 13, 2025
f47728e
[rel-db] Introduce more relations/constraints / change handling of MO…
hjanott Sep 24, 2025
b2e83a1
Improve check_not_null_for_relation_lists trigger (#308)
vkrasnovyd Sep 26, 2025
63552b9
Merge remote-tracking branch 'upstream/feature/new-vote-service' into…
ostcar Oct 1, 2025
76186e5
Merge branch 'feature/new-vote-service' into feature/relational-db
ostcar Oct 1, 2025
26540c6
Move gender to base_data
ostcar Oct 1, 2025
9357b13
Remove relation from vote to meeting.
ostcar Oct 3, 2025
4f12429
Move vote/*_user_id in its own restriction mode
ostcar Oct 4, 2025
77f9928
Rename values of poll/method
ostcar Oct 5, 2025
d512fa2
vote_split
ostcar Oct 8, 2025
3126139
Fix related Models Notification to be always 'update' (#334)
LinKaKling Oct 16, 2025
882048c
Move poll/voted_ids to restriction_mode B
ostcar Oct 17, 2025
eb7e9f2
Remove setting log_min_messages (#335)
rrenkert Oct 23, 2025
54491cc
[rel-db] add sequential numbers before insert (#319)
hjanott Oct 29, 2025
acdf857
[rel-db] Add poll_config_X-collections (#338)
ostcar Nov 3, 2025
a13f31d
New way to vote vor a list of candidates or other optons (#341)
ostcar Nov 5, 2025
3de5240
Merge remote-tracking branch 'upstream/main' into feature/relational-db
ostcar Nov 8, 2025
0d0c670
Remove vote (#343)
ostcar Nov 13, 2025
4a8a43a
[rel-DB] Merge main (#355)
vkrasnovyd Dec 2, 2025
7c7e3a4
Merge branch 'main' into feature/relational-db
rrenkert Dec 10, 2025
bad6126
Re-add test data for --rl:gr (#349)
vkrasnovyd Dec 16, 2025
96ae121
Merge remote-tracking branch 'upstream/main' into feature/relational-db
rrenkert Dec 17, 2025
bc648c8
Implement TextArrayField (#361)
vkrasnovyd Dec 18, 2025
68c9bc4
Merge remote-tracking branch 'upstream/main' into feature/relational-db
ostcar Jan 16, 2026
5baa08e
generate models.yml
ostcar Jan 16, 2026
20143fa
Merge remote-tracking branch 'upstream/main' into feature/relational-db
ostcar Jan 17, 2026
b97fe64
[rel-db] Add version table (#333)
hjanott Jan 22, 2026
0f4dab1
Fix merge commit '68c9bc4' (#375)
rrenkert Jan 23, 2026
fc4f3fe
[rel-DB] Add nt:ntR relation and n:m not_null trigger (#376)
vkrasnovyd Jan 23, 2026
2c58ca5
[rel-db] Add CREATE INDEX and update custom SQLs (#378)
rrenkert Feb 2, 2026
d0cc2af
[rel-DB] Fix check_not_null_for_n_m() (#377)
vkrasnovyd Feb 9, 2026
3ee58d1
[rel-DB] Isolate rows for user.committee_ids calculation (#381)
vkrasnovyd Feb 9, 2026
7ad7d26
Moving makefile and adjusting references to its maketargets
Janmtbehrens Feb 12, 2026
ee16c02
Change Workflow CI environment to root
Janmtbehrens Feb 12, 2026
0a022d0
Adjusted hard coded paths in Makefile
Janmtbehrens Feb 12, 2026
c2f5a0d
Adjusted paths again. Moved .sqlfuffignore
Janmtbehrens Feb 12, 2026
46400c0
Calling isort on base.py and test_generic_relations.py
Janmtbehrens Feb 12, 2026
16bfcf4
Add dev to appy-test-data target
Janmtbehrens Feb 12, 2026
18558cc
Adjusting run-dev
Janmtbehrens Feb 12, 2026
9e0be22
Add -f flag to dev-stop
Janmtbehrens Feb 13, 2026
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
9 changes: 3 additions & 6 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:
validate-models:
name: CI
runs-on: ubuntu-latest
defaults:
run:
working-directory: dev/

steps:
- uses: actions/checkout@v6
Expand All @@ -27,7 +24,7 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install requirements
run: pip install -r requirements.txt
run: pip install -r dev/requirements.txt

- name: Check black
if: always()
Expand All @@ -54,11 +51,11 @@ jobs:
run: make validate-models

- name: Generate models.yml from collections
run: python src/join_models_yml.py
run: python dev/src/join_models_yml.py

- name: Check if models.yml is up-to-date
run: |
if git diff --exit-code ../models.yml; then
if git diff --exit-code ./models.yml; then
echo "✅ models.yml is up-to-date"
else
echo "❌ models.yml is out of sync with collections/"
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/test-sql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Test SQL
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
# TODO: What container should be used? This is from the github example
container: node:20-bookworm-slim

services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: openslides
POSTGRES_DB: openslides
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Install psql
run: |
apt-get update
apt-get install --yes --no-install-recommends postgresql-client

- name: apply schema
shell: bash
run: bash dev/scripts/apply_db_schema.sh
env:
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_USER: openslides
DATABASE_NAME: openslides
PGPASSWORD: password

- name: insert base data
shell: bash
run: bash dev/scripts/apply_data.sh base_data.sql
env:
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_USER: openslides
DATABASE_NAME: openslides
PGPASSWORD: password

- name: insert test data
shell: bash
run: bash dev/scripts/apply_data.sh test_data.sql
env:
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_USER: openslides
DATABASE_NAME: openslides
PGPASSWORD: password
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Patterns of intentionally untracked files that Git should ignore

# Private development data
private/

# Python compiled files
__pycache__/

# Python virtual environment target directory
.virtualenv/
.venv/

# Mypy (static type checker) cache
.mypy_cache/

# Pytest, pytest-cov and Coverage.py cache
.pytest_cache/
.coverage
htmlcov/

# Specific editor files
.vscode/*
.vimrc

# coverage

migrations/*.json
migrations/*.sql

# secrets
secrets/

# code-workspaces
*.code-workspace
1 change: 1 addition & 0 deletions .sqlfluffignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
schema_relational.sql
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Commands inside the container
paths = dev/src/ dev/tests/

all: pyupgrade black autoflake isort flake8 mypy sqlfluff

pyupgrade:
pyupgrade --py310-plus --exit-zero-even-if-changed $$(find . -name '*.py')

check-pyupgrade:
pyupgrade --py310-plus $$(find . -name '*.py')

black:
black $(paths)

check-black:
black --check --diff $(paths)

autoflake:
autoflake $(paths)

isort:
isort $(paths)

check-isort:
isort --check-only --diff $(paths)

flake8:
flake8 $(paths)

mypy:
mypy dev/src/

sqlfluff:
sqlfluff fix --dialect postgres --verbose

validate-models:
python -m dev.src.validate

generate-relational-schema:
python -m dev.src.generate_sql_schema

drop-database:
dropdb -f -e --if-exists -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USER} ${DATABASE_NAME}

create-database:
createdb -e -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USER} ${DATABASE_NAME}

apply-db-schema:
dev/scripts/apply_db_schema.sh

apply-test-data:
dev/scripts/apply_data.sh base_data.sql
dev/scripts/apply_data.sh test_data.sql

create-database-with-schema: drop-database create-database apply-db-schema

create-test-data: create-database-with-schema apply-test-data

run-psql:
psql -h ${DATABASE_HOST} -p ${DATABASE_PORT} -U ${DATABASE_USER} -d ${DATABASE_NAME}

# Docker manage commands

run-dev:
USER_ID=$$(id -u $${USER}) GROUP_ID=$$(id -g $${USER}) docker compose -f dev/docker-compose.yml up -d --build
Comment thread
peb-adr marked this conversation as resolved.
docker compose -f dev/docker-compose.yml exec models bash --rcfile /etc/bash_completion

stop-dev:
docker compose -f dev/docker-compose.yml down
7 changes: 7 additions & 0 deletions collections/agenda_item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ weight:

content_object_id:
type: generic-relation
reference:
- motion
- motion_block
- assignment
- topic
to:
collections:
- motion
Expand All @@ -61,6 +66,7 @@ content_object_id:
constant: true
parent_id:
type: relation
reference: agenda_item
to: agenda_item/child_ids
equal_fields: meeting_id
restriction_mode: A
Expand All @@ -82,6 +88,7 @@ projection_ids:
restriction_mode: A
meeting_id:
type: relation
reference: meeting
to: meeting/agenda_item_ids
required: true
restriction_mode: A
Expand Down
2 changes: 2 additions & 0 deletions collections/assignment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ number_poll_candidates:
restriction_mode: A
sequential_number:
type: number
sequence_scope: meeting_id
description: The (positive) serial number of this model in its meeting. This number is auto-generated and read-only.
read_only: true
required: true
Expand Down Expand Up @@ -82,6 +83,7 @@ projection_ids:
restriction_mode: A
meeting_id:
type: relation
reference: meeting
to: meeting/assignment_ids
required: true
restriction_mode: A
Expand Down
3 changes: 3 additions & 0 deletions collections/assignment_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ weight:

assignment_id:
type: relation
reference: assignment
to: assignment/candidate_ids
equal_fields: meeting_id
restriction_mode: A
required: true
constant: true
meeting_user_id:
type: relation
reference: meeting_user
to: meeting_user/assignment_candidate_ids
restriction_mode: A
constant: true
meeting_id:
type: relation
reference: meeting
to: meeting/assignment_candidate_ids
required: true
restriction_mode: A
Expand Down
2 changes: 1 addition & 1 deletion collections/chat_group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ weight:
type: number
default: 10000
restriction_mode: A

chat_message_ids:
type: relation-list
to: chat_message/chat_group_id
Expand All @@ -31,6 +30,7 @@ write_group_ids:
restriction_mode: A
meeting_id:
type: relation
reference: meeting
to: meeting/chat_group_ids
required: true
restriction_mode: A
Expand Down
3 changes: 3 additions & 0 deletions collections/chat_message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ created:
restriction_mode: A
meeting_user_id:
type: relation
reference: meeting_user
to: meeting_user/chat_message_ids
restriction_mode: A
constant: true
chat_group_id:
type: relation
reference: chat_group
to: chat_group/chat_message_ids
restriction_mode: A
required: true
constant: true
meeting_id:
type: relation
reference: meeting
to: meeting/chat_message_ids
required: true
restriction_mode: A
Expand Down
28 changes: 27 additions & 1 deletion collections/committee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,37 @@ meeting_ids:
default_meeting_id:
type: relation
to: meeting/default_meeting_for_committee_id
reference: meeting
restriction_mode: A
user_ids:
type: relation-list
to: user/committee_ids
restriction_mode: A
read_only: true
description: "Calculated field."
description: "Calculated field: All users which are in a group of a meeting, belonging to the committee or beeing manager of the committee"
sql: |
(
SELECT array_agg(DISTINCT user_id ORDER BY user_id)
FROM (
-- Select user_ids from committees meetings
SELECT mu.user_id
FROM meeting_t AS m
INNER JOIN meeting_user_t AS mu ON mu.meeting_id = m.id
WHERE m.committee_id = c.id

UNION

-- Select user_ids from committee managers
SELECT cmu.user_id
FROM nm_committee_manager_ids_user_t cmu
WHERE cmu.committee_id = c.id

UNION

-- Select user_id from home committees
SELECT u.id FROM user_t u WHERE u.home_committee_id = c.id
) _
) AS user_ids
manager_ids:
type: relation-list
to: user/committee_management_ids
Expand All @@ -39,6 +63,7 @@ parent_id:
type: relation
to: committee/child_ids
restriction_mode: A
reference: committee
child_ids:
type: relation-list
to: committee/parent_id
Expand Down Expand Up @@ -69,6 +94,7 @@ organization_tag_ids:
restriction_mode: A
organization_id:
type: relation
reference: organization
to: organization/committee_ids
required: true
restriction_mode: A
Expand Down
2 changes: 2 additions & 0 deletions collections/gender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ organization_id:
required: true
to: organization/gender_ids
restriction_mode: A
reference: organization
user_ids:
type: relation-list
to: user/gender_id
restriction_mode: A
reference: user

5 changes: 5 additions & 0 deletions collections/group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,27 @@ poll_ids:
restriction_mode: A
used_as_motion_poll_default_id:
type: relation
reference: meeting
to: meeting/motion_poll_default_group_ids
restriction_mode: A
used_as_assignment_poll_default_id:
type: relation
reference: meeting
to: meeting/assignment_poll_default_group_ids
restriction_mode: A
used_as_topic_poll_default_id:
type: relation
reference: meeting
to: meeting/topic_poll_default_group_ids
restriction_mode: A
used_as_poll_default_id:
type: relation
reference: meeting
to: meeting/poll_default_group_ids
restriction_mode: A
meeting_id:
type: relation
reference: meeting
to: meeting/group_ids
required: true
restriction_mode: A
Expand Down
Loading