mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:17:35 +00:00
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:
@@ -26,6 +26,7 @@ const (
|
||||
OrgProjectMappingSearchKeyProjectID
|
||||
OrgProjectMappingSearchKeyOrgID
|
||||
OrgProjectMappingSearchKeyProjectGrantID
|
||||
OrgProjectMappingSearchKeyInstanceID
|
||||
)
|
||||
|
||||
type OrgProjectMappingViewSearchQuery struct {
|
||||
|
@@ -4,10 +4,12 @@ const (
|
||||
OrgProjectMappingKeyProjectID = "project_id"
|
||||
OrgProjectMappingKeyOrgID = "org_id"
|
||||
OrgProjectMappingKeyProjectGrantID = "project_grant_id"
|
||||
OrgProjectMappingKeyInstanceID = "instance_id"
|
||||
)
|
||||
|
||||
type OrgProjectMapping struct {
|
||||
ProjectID string `json:"-" gorm:"column:project_id;primary_key"`
|
||||
OrgID string `json:"-" gorm:"column:org_id;primary_key"`
|
||||
ProjectGrantID string `json:"-" gorm:"column:project_grant_id;"`
|
||||
ProjectGrantID string `json:"-" gorm:"column:project_grant_id"`
|
||||
InstanceID string `json:"instanceID" gorm:"column:instance_id"`
|
||||
}
|
||||
|
@@ -57,6 +57,8 @@ func (key OrgProjectMappingSearchKey) ToColumnName() string {
|
||||
return OrgProjectMappingKeyProjectID
|
||||
case proj_model.OrgProjectMappingSearchKeyProjectGrantID:
|
||||
return OrgProjectMappingKeyProjectGrantID
|
||||
case proj_model.OrgProjectMappingSearchKeyInstanceID:
|
||||
return OrgProjectMappingKeyInstanceID
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
@@ -2,13 +2,15 @@ package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/caos/logging"
|
||||
"github.com/lib/pq"
|
||||
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
"github.com/caos/zitadel/internal/project/model"
|
||||
es_model "github.com/caos/zitadel/internal/project/repository/eventsourcing/model"
|
||||
"github.com/lib/pq"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -39,6 +41,7 @@ type ProjectGrant struct {
|
||||
GrantID string `json:"grantId"`
|
||||
GrantedOrgID string `json:"grantedOrgId"`
|
||||
RoleKeys []string `json:"roleKeys"`
|
||||
InstanceID string `json:"instanceID"`
|
||||
}
|
||||
|
||||
func ProjectGrantFromModel(project *model.ProjectGrantView) *ProjectGrantView {
|
||||
|
Reference in New Issue
Block a user