feat: projections auto create their tables (#3324)

* begin init checks for projections

* first projection checks

* debug notification providers with query fixes

* more projections and first index

* more projections

* more projections

* finish projections

* fix tests (remove db name)

* create tables in setup

* fix logging / error handling

* add tenant to views

* rename tenant to instance_id

* add instance_id to all projections

* add instance_id to all queries

* correct instance_id on projections

* add instance_id to failed_events

* use separate context for instance

* implement features projection

* implement features projection

* remove unique constraint from setup when migration failed

* add error to failed setup event

* add instance_id to primary keys

* fix IAM projection

* remove old migrations folder

* fix keysFromYAML test
This commit is contained in:
Livio Amstutz
2022-03-23 09:02:39 +01:00
committed by GitHub
parent 9e13b70a3d
commit 56b916a2b0
400 changed files with 6508 additions and 8890 deletions

View File

@@ -23,8 +23,8 @@ var (
", memberships.iam_id" +
", memberships.project_id" +
", memberships.grant_id" +
", zitadel.projections.projects.name" +
", zitadel.projections.orgs.name" +
", projections.projects.name" +
", projections.orgs.name" +
", COUNT(*) OVER ()" +
" FROM (" +
"SELECT members.user_id" +
@@ -37,7 +37,7 @@ var (
", NULL::STRING AS iam_id" +
", NULL::STRING AS project_id" +
", NULL::STRING AS grant_id" +
" FROM zitadel.projections.org_members as members" +
" FROM projections.org_members as members" +
" UNION ALL " +
"SELECT members.user_id" +
", members.roles" +
@@ -49,7 +49,7 @@ var (
", members.iam_id" +
", NULL::STRING AS project_id" +
", NULL::STRING AS grant_id" +
" FROM zitadel.projections.iam_members as members" +
" FROM projections.iam_members as members" +
" UNION ALL " +
"SELECT members.user_id" +
", members.roles" +
@@ -61,7 +61,7 @@ var (
", NULL::STRING AS iam_id" +
", members.project_id" +
", NULL::STRING AS grant_id" +
" FROM zitadel.projections.project_members as members" +
" FROM projections.project_members as members" +
" UNION ALL " +
"SELECT members.user_id" +
", members.roles" +
@@ -73,10 +73,10 @@ var (
", NULL::STRING AS iam_id" +
", members.project_id" +
", members.grant_id" +
" FROM zitadel.projections.project_grant_members as members" +
" FROM projections.project_grant_members as members" +
") AS memberships" +
" LEFT JOIN zitadel.projections.projects ON memberships.project_id = zitadel.projections.projects.id" +
" LEFT JOIN zitadel.projections.orgs ON memberships.org_id = zitadel.projections.orgs.id")
" LEFT JOIN projections.projects ON memberships.project_id = projections.projects.id" +
" LEFT JOIN projections.orgs ON memberships.org_id = projections.orgs.id")
membershipCols = []string{
"user_id",
"roles",