Introduce search field metadata in 2 16 (#22055)
# Introduction The devpx wasn't prepare for an already existing entity becoming a syncable entity Though the search field metadata entity was dormant anw So considering it has been introduced starting from 2.16 is the quickest and easiest tradeoff we can get This PR is also reverting this one https://github.com/twentyhq/twenty/pull/22039 that was introducing a new way to decorate an entity at class level. But it did not fixed the issue <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/22055?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
+4
-19
@@ -4,8 +4,8 @@ import { InjectDataSource } from '@nestjs/typeorm';
|
||||
import { type ColumnMetadata } from 'typeorm/metadata/ColumnMetadata';
|
||||
import { type EntityMetadata } from 'typeorm/metadata/EntityMetadata';
|
||||
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { DataSource } from 'typeorm';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { UpgradeMigrationService } from 'src/engine/core-modules/upgrade/services/upgrade-migration.service';
|
||||
import { UpgradeSequenceReaderService } from 'src/engine/core-modules/upgrade/services/upgrade-sequence-reader.service';
|
||||
@@ -346,28 +346,13 @@ export class UpgradeAwareEntityMetadataAdapter implements OnModuleInit {
|
||||
}
|
||||
|
||||
private validateDecoratorsAgainstSequence(): void {
|
||||
const entityClasses: Function[] = [];
|
||||
const columnPropertyNamesByEntityClass = new Map<
|
||||
Function,
|
||||
ReadonlySet<string>
|
||||
>();
|
||||
|
||||
for (const metadata of this.coreDataSource.entityMetadatas) {
|
||||
if (typeof metadata.target !== 'function') {
|
||||
continue;
|
||||
}
|
||||
|
||||
entityClasses.push(metadata.target);
|
||||
columnPropertyNamesByEntityClass.set(
|
||||
metadata.target,
|
||||
new Set(metadata.columns.map((column) => column.propertyName)),
|
||||
);
|
||||
}
|
||||
const entityClasses = this.coreDataSource.entityMetadatas
|
||||
.map((metadata) => metadata.target)
|
||||
.filter((target): target is Function => typeof target === 'function');
|
||||
|
||||
const problems = validateUpgradeAwareEntityDecorators({
|
||||
entityClasses,
|
||||
stepNameToIndex: this.stepNameToIndex,
|
||||
columnPropertyNamesByEntityClass,
|
||||
});
|
||||
|
||||
if (problems.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user