@memberjunction/codegen-lib 6.1.0-edge.2 → 6.1.0-edge.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +180 -4
- package/README.md +89 -43
- package/dist/Angular/angular-codegen.d.ts +0 -8
- package/dist/Angular/angular-codegen.d.ts.map +1 -1
- package/dist/Angular/angular-codegen.js +32 -22
- package/dist/Angular/angular-codegen.js.map +1 -1
- package/dist/Angular/entity-data-grid-related-entity-component.js +2 -2
- package/dist/Angular/entity-data-grid-related-entity-component.js.map +1 -1
- package/dist/Angular/related-entity-components.d.ts +1 -1
- package/dist/Angular/related-entity-components.js +1 -1
- package/dist/Config/config.d.ts +118 -1
- package/dist/Config/config.d.ts.map +1 -1
- package/dist/Config/config.js +202 -8
- package/dist/Config/config.js.map +1 -1
- package/dist/Database/__tests__/exclude-schema-permissions.test.d.ts +2 -0
- package/dist/Database/__tests__/exclude-schema-permissions.test.d.ts.map +1 -0
- package/dist/Database/__tests__/exclude-schema-permissions.test.js +32 -0
- package/dist/Database/__tests__/exclude-schema-permissions.test.js.map +1 -0
- package/dist/Database/codeGenDatabaseProvider.d.ts +178 -2
- package/dist/Database/codeGenDatabaseProvider.d.ts.map +1 -1
- package/dist/Database/codeGenDatabaseProvider.js +175 -10
- package/dist/Database/codeGenDatabaseProvider.js.map +1 -1
- package/dist/Database/heal-schema-params.d.ts +33 -0
- package/dist/Database/heal-schema-params.d.ts.map +1 -0
- package/dist/Database/heal-schema-params.js +51 -0
- package/dist/Database/heal-schema-params.js.map +1 -0
- package/dist/Database/manage-metadata.d.ts +301 -2
- package/dist/Database/manage-metadata.d.ts.map +1 -1
- package/dist/Database/manage-metadata.js +1242 -96
- package/dist/Database/manage-metadata.js.map +1 -1
- package/dist/Database/materializationAnalysis.d.ts +241 -0
- package/dist/Database/materializationAnalysis.d.ts.map +1 -0
- package/dist/Database/materializationAnalysis.js +415 -0
- package/dist/Database/materializationAnalysis.js.map +1 -0
- package/dist/Database/materializationBroadRender.d.ts +67 -0
- package/dist/Database/materializationBroadRender.d.ts.map +1 -0
- package/dist/Database/materializationBroadRender.js +104 -0
- package/dist/Database/materializationBroadRender.js.map +1 -0
- package/dist/Database/materializationDrift.d.ts +59 -0
- package/dist/Database/materializationDrift.d.ts.map +1 -0
- package/dist/Database/materializationDrift.js +85 -0
- package/dist/Database/materializationDrift.js.map +1 -0
- package/dist/Database/materializationParamClassifier.d.ts +92 -0
- package/dist/Database/materializationParamClassifier.d.ts.map +1 -0
- package/dist/Database/materializationParamClassifier.js +224 -0
- package/dist/Database/materializationParamClassifier.js.map +1 -0
- package/dist/Database/materializationParamVerifier.d.ts +71 -0
- package/dist/Database/materializationParamVerifier.d.ts.map +1 -0
- package/dist/Database/materializationParamVerifier.js +302 -0
- package/dist/Database/materializationParamVerifier.js.map +1 -0
- package/dist/Database/materializationSqlAst.d.ts +78 -0
- package/dist/Database/materializationSqlAst.d.ts.map +1 -0
- package/dist/Database/materializationSqlAst.js +142 -0
- package/dist/Database/materializationSqlAst.js.map +1 -0
- package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.d.ts +93 -56
- package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.d.ts.map +1 -1
- package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.js +399 -247
- package/dist/Database/providers/postgresql/PostgreSQLCodeGenProvider.js.map +1 -1
- package/dist/Database/providers/postgresql/__tests__/PostgreSQLCodeGenProvider.materialization.test.d.ts +2 -0
- package/dist/Database/providers/postgresql/__tests__/PostgreSQLCodeGenProvider.materialization.test.d.ts.map +1 -0
- package/dist/Database/providers/postgresql/__tests__/PostgreSQLCodeGenProvider.materialization.test.js +119 -0
- package/dist/Database/providers/postgresql/__tests__/PostgreSQLCodeGenProvider.materialization.test.js.map +1 -0
- package/dist/Database/providers/postgresql/__tests__/PostgreSQLHierarchyFunctions.test.d.ts +2 -0
- package/dist/Database/providers/postgresql/__tests__/PostgreSQLHierarchyFunctions.test.d.ts.map +1 -0
- package/dist/Database/providers/postgresql/__tests__/PostgreSQLHierarchyFunctions.test.js +155 -0
- package/dist/Database/providers/postgresql/__tests__/PostgreSQLHierarchyFunctions.test.js.map +1 -0
- package/dist/Database/providers/postgresql/__tests__/SoftPrimaryKeyIndex.test.d.ts +2 -0
- package/dist/Database/providers/postgresql/__tests__/SoftPrimaryKeyIndex.test.d.ts.map +1 -0
- package/dist/Database/providers/postgresql/__tests__/SoftPrimaryKeyIndex.test.js +110 -0
- package/dist/Database/providers/postgresql/__tests__/SoftPrimaryKeyIndex.test.js.map +1 -0
- package/dist/Database/providers/postgresql/metadataSupportObjects.js +78 -10
- package/dist/Database/providers/postgresql/metadataSupportObjects.js.map +1 -1
- package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.d.ts +72 -1
- package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.d.ts.map +1 -1
- package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.js +322 -0
- package/dist/Database/providers/sqlserver/SQLServerCodeGenProvider.js.map +1 -1
- package/dist/Database/providers/sqlserver/__tests__/BaseViewEmissionGoldenMaster.test.d.ts +2 -0
- package/dist/Database/providers/sqlserver/__tests__/BaseViewEmissionGoldenMaster.test.d.ts.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/BaseViewEmissionGoldenMaster.test.js +547 -0
- package/dist/Database/providers/sqlserver/__tests__/BaseViewEmissionGoldenMaster.test.js.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/BaseViewRegenDecision.test.d.ts +2 -0
- package/dist/Database/providers/sqlserver/__tests__/BaseViewRegenDecision.test.d.ts.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/BaseViewRegenDecision.test.js +721 -0
- package/dist/Database/providers/sqlserver/__tests__/BaseViewRegenDecision.test.js.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/SQLServerCodeGenProvider.materialization.test.d.ts +2 -0
- package/dist/Database/providers/sqlserver/__tests__/SQLServerCodeGenProvider.materialization.test.d.ts.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/SQLServerCodeGenProvider.materialization.test.js +78 -0
- package/dist/Database/providers/sqlserver/__tests__/SQLServerCodeGenProvider.materialization.test.js.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/SQLServerHierarchyTVF.test.d.ts +2 -0
- package/dist/Database/providers/sqlserver/__tests__/SQLServerHierarchyTVF.test.d.ts.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/SQLServerHierarchyTVF.test.js +155 -0
- package/dist/Database/providers/sqlserver/__tests__/SQLServerHierarchyTVF.test.js.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/SoftPrimaryKeyIndex.test.d.ts +2 -0
- package/dist/Database/providers/sqlserver/__tests__/SoftPrimaryKeyIndex.test.d.ts.map +1 -0
- package/dist/Database/providers/sqlserver/__tests__/SoftPrimaryKeyIndex.test.js +195 -0
- package/dist/Database/providers/sqlserver/__tests__/SoftPrimaryKeyIndex.test.js.map +1 -0
- package/dist/Database/schema-filters.d.ts +23 -0
- package/dist/Database/schema-filters.d.ts.map +1 -0
- package/dist/Database/schema-filters.js +42 -0
- package/dist/Database/schema-filters.js.map +1 -0
- package/dist/Database/schema-scope.d.ts.map +1 -1
- package/dist/Database/schema-scope.js +4 -0
- package/dist/Database/schema-scope.js.map +1 -1
- package/dist/Database/sql_codegen.d.ts +39 -5
- package/dist/Database/sql_codegen.d.ts.map +1 -1
- package/dist/Database/sql_codegen.js +176 -67
- package/dist/Database/sql_codegen.js.map +1 -1
- package/dist/EntityNameScanner/EntityNameScanner.d.ts.map +1 -1
- package/dist/EntityNameScanner/EntityNameScanner.js +33 -2
- package/dist/EntityNameScanner/EntityNameScanner.js.map +1 -1
- package/dist/Manifest/GenerateClassRegistrationsManifest.d.ts +8 -4
- package/dist/Manifest/GenerateClassRegistrationsManifest.d.ts.map +1 -1
- package/dist/Manifest/GenerateClassRegistrationsManifest.js +63 -20
- package/dist/Manifest/GenerateClassRegistrationsManifest.js.map +1 -1
- package/dist/Misc/action_subclasses_codegen.d.ts.map +1 -1
- package/dist/Misc/action_subclasses_codegen.js +4 -4
- package/dist/Misc/action_subclasses_codegen.js.map +1 -1
- package/dist/Misc/entity_subclasses_codegen.d.ts +61 -0
- package/dist/Misc/entity_subclasses_codegen.d.ts.map +1 -1
- package/dist/Misc/entity_subclasses_codegen.js +437 -158
- package/dist/Misc/entity_subclasses_codegen.js.map +1 -1
- package/dist/Misc/graphql_server_codegen.d.ts +4 -58
- package/dist/Misc/graphql_server_codegen.d.ts.map +1 -1
- package/dist/Misc/graphql_server_codegen.js +22 -236
- package/dist/Misc/graphql_server_codegen.js.map +1 -1
- package/dist/Misc/sql_logging.d.ts +25 -0
- package/dist/Misc/sql_logging.d.ts.map +1 -1
- package/dist/Misc/sql_logging.js +51 -8
- package/dist/Misc/sql_logging.js.map +1 -1
- package/dist/Misc/system_integrity.d.ts.map +1 -1
- package/dist/Misc/system_integrity.js +5 -0
- package/dist/Misc/system_integrity.js.map +1 -1
- package/package.json +30 -30
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntityInfo, EntityFieldInfo } from '@memberjunction/core';
|
|
2
|
-
import { CodeGenDatabaseProvider, CRUDType, BaseViewGenerationContext, CascadeDeleteContext, FullTextSearchResult, PhasedExecutionResult, DataSourceResult } from '../../codeGenDatabaseProvider.js';
|
|
2
|
+
import { CodeGenDatabaseProvider, CRUDType, BaseViewGenerationContext, CascadeDeleteContext, FullTextSearchResult, MaterializedColumnSpec, PhasedExecutionResult, DataSourceResult } from '../../codeGenDatabaseProvider.js';
|
|
3
3
|
import { DatabasePlatform, SQLDialect } from '@memberjunction/sql-dialect';
|
|
4
4
|
/**
|
|
5
5
|
* PostgreSQL implementation of the CodeGen database provider.
|
|
@@ -96,6 +96,38 @@ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
|
|
|
96
96
|
* Permissions are handled separately by sql_codegen.ts via generateViewPermissions().
|
|
97
97
|
*/
|
|
98
98
|
generateBaseView(context: BaseViewGenerationContext): string;
|
|
99
|
+
/**
|
|
100
|
+
* PostgreSQL materialized-table DDL. The create is **conditional** (`CREATE TABLE IF NOT
|
|
101
|
+
* EXISTS`) so a migration-provided `materialized_<name>` table with bespoke indexing is
|
|
102
|
+
* detected and reused rather than clobbered (plan §12). Emits the single-column surrogate
|
|
103
|
+
* PRIMARY KEY, which is itself the required unique index.
|
|
104
|
+
*
|
|
105
|
+
* PG dialect vs. SQL Server: double-quoted identifiers, `CREATE TABLE IF NOT EXISTS` in
|
|
106
|
+
* place of the `IF OBJECT_ID(...) IS NULL` guard, and the surrogate column carries PG's
|
|
107
|
+
* `GENERATED ALWAYS AS IDENTITY` clause (see {@link getMaterializedSurrogateColumnType}).
|
|
108
|
+
*/
|
|
109
|
+
generateMaterializedTableSQL(schema: string, tableName: string, columns: MaterializedColumnSpec[]): string;
|
|
110
|
+
/**
|
|
111
|
+
* PostgreSQL wrapper-view DDL — the stable read contract over the materialized table.
|
|
112
|
+
* Uses `CREATE OR REPLACE VIEW` so the same statement both creates the view and atomically
|
|
113
|
+
* repoints it at a freshly-built table during refresh (plan §11.2). The body is always
|
|
114
|
+
* `SELECT * FROM <table>` and the shadow table shares the column shape, so PG's
|
|
115
|
+
* `CREATE OR REPLACE` column-compatibility rule is satisfied on the swap.
|
|
116
|
+
*/
|
|
117
|
+
generateMaterializedWrapperViewSQL(schema: string, viewName: string, tableName: string): string;
|
|
118
|
+
/**
|
|
119
|
+
* PostgreSQL synthetic surrogate key: a SQL-standard auto-assigned identity column
|
|
120
|
+
* (`GENERATED ALWAYS AS IDENTITY`), `bigint` for headroom on large materialized sets.
|
|
121
|
+
* v1 full-rebuild only; the deterministic combined-key hashing in §5 replaces this in Phase 3.
|
|
122
|
+
*/
|
|
123
|
+
getMaterializedSurrogateColumnType(): string;
|
|
124
|
+
/**
|
|
125
|
+
* PostgreSQL KEYED surrogate key type: the combined-key SHA-256 hash the refresh writes comes from
|
|
126
|
+
* `encode(digest(…), 'hex')`, whose type is `text`, and the full rebuild's `CREATE TABLE AS` infers
|
|
127
|
+
* exactly that. Typing the minted entity's PK column `text` MATCHES the post-refresh physical column,
|
|
128
|
+
* avoiding the int-vs-hash divergence between CodeGen metadata and the rebuilt table.
|
|
129
|
+
*/
|
|
130
|
+
getMaterializedHashSurrogateColumnType(): string;
|
|
99
131
|
/**
|
|
100
132
|
* Emits a `DO` block that drops every existing overload of `<schema>.<fnName>`.
|
|
101
133
|
* Run before each `CREATE OR REPLACE FUNCTION` to prevent PG's "function name is
|
|
@@ -207,6 +239,15 @@ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
|
|
|
207
239
|
protected tableToken(entity: EntityInfo): string;
|
|
208
240
|
protected columnToken(f: EntityFieldInfo): string;
|
|
209
241
|
protected formatIndexStatement(entity: EntityInfo, f: EntityFieldInfo, indexName: string): string;
|
|
242
|
+
protected softPrimaryKeyIndexPrefix(): string;
|
|
243
|
+
/**
|
|
244
|
+
* PostgreSQL will happily accept an unbounded `text` column in a btree key and then fail at
|
|
245
|
+
* INSERT time if a value exceeds roughly an eighth of a page — an error that surfaces long
|
|
246
|
+
* after the index was created, on whichever row happens to be too long. Treating unbounded
|
|
247
|
+
* columns as unindexable keeps the failure at generation time, where it names the column.
|
|
248
|
+
*/
|
|
249
|
+
protected isIndexableKeyColumn(f: EntityFieldInfo): boolean;
|
|
250
|
+
protected formatCompositeIndexStatement(entity: EntityInfo, fields: EntityFieldInfo[], indexName: string): string;
|
|
210
251
|
/**
|
|
211
252
|
* Generates a complete PostgreSQL full-text search infrastructure for an entity.
|
|
212
253
|
* This includes:
|
|
@@ -227,6 +268,33 @@ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
|
|
|
227
268
|
* the parent FK upward, capped at 100 levels to prevent infinite loops. Returns the
|
|
228
269
|
* root record's primary key value.
|
|
229
270
|
*/
|
|
271
|
+
/**
|
|
272
|
+
* Generates a PostgreSQL function returning a table of hierarchy metadata
|
|
273
|
+
* (RootID, Depth, Path, IsLeaf, ChildCount) for a self-referencing foreign key.
|
|
274
|
+
*/
|
|
275
|
+
generateHierarchyMetaFunction(entity: EntityInfo, field: EntityFieldInfo): string;
|
|
276
|
+
/**
|
|
277
|
+
* Generates a PostgreSQL table-valued function returning all descendant records of a root node.
|
|
278
|
+
*/
|
|
279
|
+
generateDescendantsFunction(entity: EntityInfo, field: EntityFieldInfo): string;
|
|
280
|
+
/**
|
|
281
|
+
* Generates a PostgreSQL table-valued function returning all ancestors of a node walking upward.
|
|
282
|
+
*/
|
|
283
|
+
generateAncestorsFunction(entity: EntityInfo, field: EntityFieldInfo): string;
|
|
284
|
+
getHierarchyMetaFunctionName(entity: EntityInfo, field: EntityFieldInfo): string;
|
|
285
|
+
getDescendantsFunctionName(entity: EntityInfo, field: EntityFieldInfo): string;
|
|
286
|
+
getAncestorsFunctionName(entity: EntityInfo, field: EntityFieldInfo): string;
|
|
287
|
+
/** @inheritdoc */
|
|
288
|
+
generateHierarchyFieldSelect(_entity: EntityInfo, field: EntityFieldInfo, alias: string): string;
|
|
289
|
+
/**
|
|
290
|
+
* Generates a `LEFT JOIN LATERAL` clause that invokes the hierarchy metadata function
|
|
291
|
+
* for a self-referencing field.
|
|
292
|
+
*/
|
|
293
|
+
generateHierarchyFieldJoin(entity: EntityInfo, field: EntityFieldInfo, alias: string): string;
|
|
294
|
+
/**
|
|
295
|
+
* Generates a PostgreSQL function that recursively calculates the root record ID for a
|
|
296
|
+
* self-referencing foreign key.
|
|
297
|
+
*/
|
|
230
298
|
generateRootIDFunction(entity: EntityInfo, field: EntityFieldInfo): string;
|
|
231
299
|
/**
|
|
232
300
|
* Produces the canonical name for the recursive root-finder helper function
|
|
@@ -241,7 +309,7 @@ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
|
|
|
241
309
|
* function`. The snake_case scalar form is codegen's own naming space and
|
|
242
310
|
* is consistent with how downstream views are emitted.
|
|
243
311
|
*/
|
|
244
|
-
|
|
312
|
+
getRootIDFunctionName(entity: EntityInfo, field: EntityFieldInfo): string;
|
|
245
313
|
/** @inheritdoc */
|
|
246
314
|
generateRootFieldSelect(_entity: EntityInfo, field: EntityFieldInfo, alias: string): string;
|
|
247
315
|
/**
|
|
@@ -370,22 +438,26 @@ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
|
|
|
370
438
|
/** @inheritdoc */
|
|
371
439
|
getSystemSchemasToExclude(): string[];
|
|
372
440
|
/**
|
|
373
|
-
* PostgreSQL has no
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
* only when the view itself is recreated. CodeGen gets away without a refresh step because it
|
|
378
|
-
* emits every generated view with an explicit column list and re-issues `CREATE OR REPLACE` on
|
|
379
|
-
* every run, so the definition it controls is always current.
|
|
380
|
-
*
|
|
381
|
-
* That holds only for views CodeGen writes. A view CodeGen does not own — such as the
|
|
382
|
-
* application-owned outer view of a layered entity — has no mechanism here to re-resolve it, and
|
|
383
|
-
* `generateViewRefreshSQL` returning empty is a genuine no-op rather than a cheap one. This is
|
|
384
|
-
* why {@link generateBaseView} refuses layered entities outright on PostgreSQL.
|
|
441
|
+
* PostgreSQL has no `sp_refreshview`. Generated views are re-issued with
|
|
442
|
+
* `CREATE OR REPLACE` (or the 42P16 capture/DROP CASCADE path) every run, so
|
|
443
|
+
* they do not need a separate refresh step. Layered *outer* views are rebound
|
|
444
|
+
* via {@link generateLayeredOuterRebindSQL}, not this flag.
|
|
385
445
|
*/
|
|
386
446
|
get NeedsViewRefresh(): boolean;
|
|
387
447
|
/** @inheritdoc */
|
|
388
448
|
generateViewRefreshSQL(_schema: string, _viewName: string): string;
|
|
449
|
+
/**
|
|
450
|
+
* Restar `g.*` on the application-owned outer view. Invokes the catalog
|
|
451
|
+
* function shipped by the PG layered-views migration; no-op if the function
|
|
452
|
+
* is not installed yet (bootstrap before that migration).
|
|
453
|
+
*/
|
|
454
|
+
generateLayeredOuterRebindSQL(entity: EntityInfo): string;
|
|
455
|
+
/**
|
|
456
|
+
* After the inner generated view is current, restar the application-owned
|
|
457
|
+
* outer wrapper so `g.*` re-expands. No-op when the entity is not layered
|
|
458
|
+
* or the outer view does not exist yet (bootstrap pass).
|
|
459
|
+
*/
|
|
460
|
+
private rebindLayeredOuterIfPresent;
|
|
389
461
|
/** @inheritdoc */
|
|
390
462
|
generateIfViewExistsSQL(schema: string, viewName: string, innerSQL: string): string;
|
|
391
463
|
/** @inheritdoc */
|
|
@@ -396,15 +468,15 @@ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
|
|
|
396
468
|
* `information_schema.columns`, so CodeGen must correct these after view creation.
|
|
397
469
|
*/
|
|
398
470
|
get NeedsVirtualFieldNullabilityFix(): boolean;
|
|
399
|
-
/**
|
|
400
|
-
* SQL keywords that should NOT be quoted even when they match PascalCase patterns.
|
|
401
|
-
*/
|
|
402
|
-
private static readonly _SQL_KEYWORDS;
|
|
403
471
|
/**
|
|
404
472
|
* Quotes mixed-case identifiers in a SQL string for PostgreSQL compatibility.
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
473
|
+
*
|
|
474
|
+
* The tokenizer lives in `@memberjunction/sql-dialect` and is shared with
|
|
475
|
+
* `PostgreSQLDataProvider.autoQuoteIdentifiers`, so codegen-time and runtime SQL are
|
|
476
|
+
* quoted by one implementation rather than two hand-synced copies. See
|
|
477
|
+
* {@link AutoQuotePostgreSQLIdentifiers} for the quoting rule and its rationale.
|
|
478
|
+
*
|
|
479
|
+
* @inheritdoc
|
|
408
480
|
*/
|
|
409
481
|
quoteSQLForExecution(sql: string): string;
|
|
410
482
|
/**
|
|
@@ -505,29 +577,6 @@ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
|
|
|
505
577
|
private mapSQLType;
|
|
506
578
|
/** Gets the base view name for an entity */
|
|
507
579
|
private getBaseViewName;
|
|
508
|
-
/**
|
|
509
|
-
* Refuses layered base views on PostgreSQL, where the arrangement cannot deliver what it
|
|
510
|
-
* promises.
|
|
511
|
-
*
|
|
512
|
-
* Layering exists so an application can add a computed column without inheriting — and then
|
|
513
|
-
* hand-maintaining — the generated view, the payoff being that a foreign key added later still
|
|
514
|
-
* shows up on its own. That payoff depends entirely on the application-owned outer view's
|
|
515
|
-
* `SELECT g.*` being re-resolved after the inner view regenerates. SQL Server does that with
|
|
516
|
-
* `sp_refreshview`. PostgreSQL expands `*` at creation and freezes it, offers no refresh
|
|
517
|
-
* equivalent, and CodeGen does not own the outer view, so nothing recreates it.
|
|
518
|
-
*
|
|
519
|
-
* The resulting behaviour is worse than plainly broken, it is intermittent: an ADDED column (the
|
|
520
|
-
* common case) leaves the outer view stale, because `CREATE OR REPLACE` on the inner view
|
|
521
|
-
* succeeds and never touches dependents. A column RENAME or type change raises 42P16, which
|
|
522
|
-
* sends CodeGen down the capture/`DROP CASCADE`/replay path — and that incidentally recreates
|
|
523
|
-
* the outer view, so it picks the new columns up. Same feature, opposite outcomes, decided by
|
|
524
|
-
* which kind of schema change happened to land that day.
|
|
525
|
-
*
|
|
526
|
-
* That is precisely the silent-staleness failure layering was built to eliminate, so this throws
|
|
527
|
-
* rather than documenting a footgun. Fully custom base views (`BaseViewGenerated = 0` with no
|
|
528
|
-
* `GeneratedBaseViewName`) are unaffected and keep working on PostgreSQL as before.
|
|
529
|
-
*/
|
|
530
|
-
private assertLayeredBaseViewSupported;
|
|
531
580
|
/** Builds the WHERE clause for soft-delete filtering */
|
|
532
581
|
private buildSoftDeleteWhereClause;
|
|
533
582
|
/** Assembles the SELECT parts for a base view */
|
|
@@ -570,18 +619,6 @@ export declare class PostgreSQLCodeGenProvider extends CodeGenDatabaseProvider {
|
|
|
570
619
|
getCompositeUniqueConstraintCheckSQL(schema: string, tableName: string, columnName: string): string;
|
|
571
620
|
/** @inheritdoc */
|
|
572
621
|
getForeignKeyIndexExistsSQL(schema: string, tableName: string, indexName: string): string;
|
|
573
|
-
/** Skips a single-quoted string literal, handling escaped quotes ('') */
|
|
574
|
-
private skipSingleQuotedString;
|
|
575
|
-
/** Skips a dollar-quoted block ($$ ... $$ or $tag$ ... $tag$) */
|
|
576
|
-
private skipDollarQuotedBlock;
|
|
577
|
-
/** Skips an already double-quoted identifier */
|
|
578
|
-
private skipDoubleQuotedIdentifier;
|
|
579
|
-
/** Skips a square-bracketed identifier (SQL Server style) */
|
|
580
|
-
private skipBracketedIdentifier;
|
|
581
|
-
/** Skips an @-prefixed parameter */
|
|
582
|
-
private skipAtParameter;
|
|
583
|
-
/** Processes a word token - quotes it if it's a PascalCase identifier, not a keyword */
|
|
584
|
-
private processWord;
|
|
585
622
|
/**
|
|
586
623
|
* Builds the full pending entity fields query for PostgreSQL.
|
|
587
624
|
* Uses CTEs for FK, PK, and UK caches, then joins against entity metadata
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgreSQLCodeGenProvider.d.ts","sourceRoot":"","sources":["../../../../src/Database/providers/postgresql/PostgreSQLCodeGenProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAyE,MAAM,sBAAsB,CAAC;AAE1I,OAAO,EACH,uBAAuB,EACvB,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACnB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAqB,gBAAgB,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"PostgreSQLCodeGenProvider.d.ts","sourceRoot":"","sources":["../../../../src/Database/providers/postgresql/PostgreSQLCodeGenProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAyE,MAAM,sBAAsB,CAAC;AAE1I,OAAO,EACH,uBAAuB,EACvB,QAAQ,EACR,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EACnB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAq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