repo.RepoObject_external_src - V

type: V ( view ), modify_date: 2021-12-22 11:54:10

RepoObject_guid: 0DFE2E93-491A-EC11-851F-A81E8446D5B0

Description

Examples

Entity Diagram

entity-repo.repoobject_external_src

Columns

Table 1. Columns of repo.RepoObject_external_src - V
PK Column Name Data Type NULL? ID

1

uniqueidentifier

NOT NULL

nvarchar(128)

NOT NULL

nvarchar(128)

NOT NULL

int

NOT NULL

int

NOT NULL

nvarchar(128)

NOT NULL

nvarchar(128)

NOT NULL

varchar(1)

NOT NULL

nvarchar(128)

NOT NULL

nvarchar(128)

NOT NULL

varchar(1)

NOT NULL

Foreign Key Diagram

entity_1_1_fk-repo.repoobject_external_src

References

Object Reference Diagram - 1 1

entity_1_1_objectref-repo.repoobject_external_src

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-repo.repoobject_external_src

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-repo.repoobject_external_src

Column Reference Diagram

entity_1_1_colref-repo.repoobject_external_src

Indexes

PK_RepoObject_external_src

UK_RepoObject_external_src__2

idx_RepoObject_external_src__3

Column Details

_

RepoObject_guid

1

RepoObject_guid

uniqueidentifier

NOT NULL

external_AntoraComponent

external_AntoraComponent

nvarchar(128)

NOT NULL

external_AntoraModule

external_AntoraModule

nvarchar(128)

NOT NULL

is_external

is_external

int

NOT NULL

is_repo_managed

is_repo_managed

int

NOT NULL

RepoObject_name

RepoObject_name

nvarchar(128)

NOT NULL

RepoObject_schema_name

RepoObject_schema_name

nvarchar(128)

NOT NULL

RepoObject_type

RepoObject_type

varchar(1)

NOT NULL

SysObject_name

SysObject_name

nvarchar(128)

NOT NULL

SysObject_schema_name

SysObject_schema_name

nvarchar(128)

NOT NULL

SysObject_type

SysObject_type

varchar(1)

NOT NULL

sql_modules_definition

repo.RepoObject_external_src - V script
/*
<<property_start>>Description
* converts xref:sqldb:reference.additional_reference_object_t.adoc[] into xref:sqldb:repo.repoobject.adoc[]
* [ ] todo: solve issues with same external object names like internal names
<<property_end>>
*/
CREATE View repo.RepoObject_external_src
As
Select
    --PK: RepoObject_guid
    T1.RepoObject_guid
  , is_repo_managed          = 1
  , RepoObject_name          = T1.ObjectName
  , RepoObject_schema_name   = T1.SchemaName
  , RepoObject_type          = 'U'
  , SysObject_name           = T1.ObjectName
  , SysObject_schema_name    = T1.SchemaName
  , SysObject_type           = 'U'
  , external_AntoraComponent = T1.AntoraComponent
  , external_AntoraModule    = T1.AntoraModule
  , is_external              = 1
From
    reference.additional_Reference_Object_T                             As T1

    --filter not required, T1 should contain only external objects, but in case the current component or modules renames, we keep this for safity
    Cross Join config.ftv_get_parameter_value ( 'AntoraComponent', '' ) As AntoraComponent
    Cross Join config.ftv_get_parameter_value ( 'AntoraModule', '' ) As AntoraModule
Where
    Not (
            T1.AntoraComponent = AntoraComponent.Parameter_value_result
            And T1.AntoraModule = AntoraModule.Parameter_value_result
        )
    --work around to exclude same named objects
    And Not Exists
(
    Select
        1
    From
        repo.RepoObject As tgt
    Where
        tgt.RepoObject_schema_name = T1.SchemaName
        And tgt.RepoObject_name    = T1.ObjectName
)
    And Not Exists
(
    Select
        1
    From
        repo.RepoObject As tgt
    Where
        tgt.SysObject_schema_name = T1.SchemaName
        And tgt.SysObject_name    = T1.ObjectName
)