Initial commit - Event Planner application
This commit is contained in:
23
node_modules/@mikro-orm/postgresql/PostgreSqlEntityManager.js
generated
vendored
Normal file
23
node_modules/@mikro-orm/postgresql/PostgreSqlEntityManager.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { SqlEntityManager } from '@mikro-orm/sql';
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
export class PostgreSqlEntityManager extends SqlEntityManager {
|
||||
/**
|
||||
* Refreshes a materialized view.
|
||||
*
|
||||
* @param entityName - The entity name or class of the materialized view
|
||||
* @param options - Optional settings
|
||||
* @param options.concurrently - If true, refreshes the view concurrently (requires a unique index on the view)
|
||||
*/
|
||||
async refreshMaterializedView(entityName, options) {
|
||||
const meta = this.getMetadata(entityName);
|
||||
if (!meta.view || !meta.materialized) {
|
||||
throw new Error(`Entity ${meta.className} is not a materialized view`);
|
||||
}
|
||||
const helper = this.getDriver().getPlatform().getSchemaHelper();
|
||||
const schema = meta.schema ?? this.config.get('schema');
|
||||
const sql = helper.refreshMaterializedView(meta.tableName, schema, options?.concurrently);
|
||||
await this.execute(sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user