MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / getTablePartitioning

Function getTablePartitioning

packages/sql/src/schema/partitioning.ts:354–373  ·  view source on GitHub ↗
(
  meta: EntityMetadata,
  tableSchema: string | undefined,
  quoteIdentifier: (id: string) => string = id => id,
)

Source from the content-addressed store, hash-verified

352
353/** @internal */
354export const getTablePartitioning = (
355 meta: EntityMetadata,
356 tableSchema: string | undefined,
357 quoteIdentifier: (id: string) => string = id => id,
358): TablePartitioning | undefined => {
359 if (!meta.partitionBy) {
360 return undefined;
361 }
362
363 const definition = createPartitionDefinition(
364 meta.partitionBy.type,
365 resolvePartitionExpression(meta, meta.partitionBy.expression, quoteIdentifier),
366 );
367 const partitions =
368 meta.partitionBy.type === 'hash'
369 ? createHashPartitions(meta.tableName, tableSchema, meta.partitionBy.partitions)
370 : createExplicitPartitions(meta.tableName, tableSchema, meta.partitionBy.partitions);
371
372 return { definition, partitions };
373};
374
375/** @internal */
376export const diffPartitioning = (

Callers 2

fromMetadataMethod · 0.85

Calls 4

createHashPartitionsFunction · 0.85
createExplicitPartitionsFunction · 0.85

Tested by

no test coverage detected