src/app/n2n/impl/persistence/orm/property/hangar/relation/OneToManyPropDef.php
public function applyDbMeta(DbInfo $dbInfo, PropSourceDef $propSourceDef, EntityProperty $entityProperty, 
			AnnotationSet $annotationSet) {
		ArgUtils::assertTrue($entityProperty instanceof RelationEntityProperty);
		
		$propertyName = $propSourceDef->getPropertyName();
		$annoOneToMany = $annotationSet->getPropertyAnnotation($propertyName, AnnoOneToMany::class);
		CastUtils::assertTrue($annoOneToMany instanceof AnnoOneToMany);
		
		if (null === $annoOneToMany->getMappedBy()) {
			$idColumnSize = $this->columnDefaults->getDefaultIntegerSize();
			$idColumnSigned = $this->columnDefaults->getDefaultInterSigned();

			$joinMode = RelationFactory::detectJoinMode(RelationEntityProperty::TYPE_ONE_TO_MANY, 
					null !== $annotationSet->getPropertyAnnotation($propertyName, AnnoJoinColumn::class), 
					null !== $annotationSet->getPropertyAnnotation($propertyName, AnnoJoinTable::class));
			
			$relation = $entityProperty->getRelation();
			
			if ($joinMode == RelationFactory::JOIN_MODE_TABLE) {
				CastUtils::assertTrue($relation instanceof JoinTableRelation);

				$database = $dbInfo->getDatabase();
				$joinTable = null;
				$joinTableName = $relation->getJoinTableName();
				
				if ($database->containsMetaEntityName($joinTableName)) {
					$joinTable = $database->getMetaEntityByName($joinTableName);
					CastUtils::assertTrue($joinTable instanceof Table);
				} else {
					$joinTable = $database->createMetaEntityFactory()->createTable($joinTableName);
				}
				
				$columnFactory = $joinTable->createColumnFactory();
				$joinTable->removeAllColumns();
				
				$joinColumnName = $relation->getJoinColumnName();
				$inverseJoinColumnName = $relation->getInverseJoinColumnName();

				$columnFactory->createIntegerColumn($joinColumnName, $idColumnSize, $idColumnSigned);
				$columnFactory->createIntegerColumn($inverseJoinColumnName, $idColumnSize, $idColumnSigned);
				
				$joinTable->removeAllIndexes();
				$joinTable->createIndex(IndexType::PRIMARY, array($joinColumnName, $inverseJoinColumnName));
			} else {
				CastUtils::assertTrue($relation instanceof InverseJoinColumnOneToManyRelation);
				
				$targetTableName = $relation->getTargetEntityModel()->getTableName();
				$targetTable = null;

				if ($database->containsMetaEntityName($targetTableName)) {
					$targetTable = $database->getMetaEntityByName($targetTableName);
					CastUtils::assertTrue($joinTable instanceof Table);
				} else {
					$targetTable = $database->createMetaEntityFactory()->createTable($targetTableName);
				}
				
				$inverseJoinColumnName = $relation->getInverseJoinColumnName();
				if ($targetTable->containsColumnName($inverseJoinColumnName)) {
					$targetTable->removeColumnByName($inverseJoinColumnName);
				}
				
				$targetTable->createColumnFactory()->createIntegerColumn($inverseJoinColumnName, $idColumnSize, $idColumnSigned);
			}
		}
	}
public function applyDbMeta(DbInfo $dbInfo, PropSourceDef $propSourceDef, EntityProperty $entityProperty, 
			AnnotationSet $annotationSet) {
		ArgUtils::assertTrue($entityProperty instanceof RelationEntityProperty);
		
		$propertyName = $propSourceDef->getPropertyName();
		$annoOneToMany = $annotationSet->getPropertyAnnotation($propertyName, AnnoOneToMany::class);
		CastUtils::assertTrue($annoOneToMany instanceof AnnoOneToMany);
		
		if (null === $annoOneToMany->getMappedBy()) {
			$idColumnSize = $this->columnDefaults->getDefaultIntegerSize();
			$idColumnSigned = $this->columnDefaults->getDefaultInterSigned();

			$joinMode = RelationFactory::detectJoinMode(RelationEntityProperty::TYPE_ONE_TO_MANY, 
					null !== $annotationSet->getPropertyAnnotation($propertyName, AnnoJoinColumn::class), 
					null !== $annotationSet->getPropertyAnnotation($propertyName, AnnoJoinTable::class));
			
			$relation = $entityProperty->getRelation();
			
			if ($joinMode == RelationFactory::JOIN_MODE_TABLE) {
				CastUtils::assertTrue($relation instanceof JoinTableRelation);

				$database = $dbInfo->getDatabase();
				$joinTable = null;
				$joinTableName = $relation->getJoinTableName();
				
				if ($database->containsMetaEntityName($joinTableName)) {
					$joinTable = $database->getMetaEntityByName($joinTableName);
					CastUtils::assertTrue($joinTable instanceof Table);
				} else {
					$joinTable = $database->createMetaEntityFactory()->createTable($joinTableName);
				}
				
				$columnFactory = $joinTable->createColumnFactory();
				$joinTable->removeAllColumns();
				
				$joinColumnName = $relation->getJoinColumnName();
				$inverseJoinColumnName = $relation->getInverseJoinColumnName();

				$columnFactory->createIntegerColumn($joinColumnName, $idColumnSize, $idColumnSigned);
				$columnFactory->createIntegerColumn($inverseJoinColumnName, $idColumnSize, $idColumnSigned);
				
				$joinTable->removeAllIndexes();
				$joinTable->createIndex(IndexType::PRIMARY, array($joinColumnName, $inverseJoinColumnName));
			} else {
				CastUtils::assertTrue($relation instanceof InverseJoinColumnOneToManyRelation);
				
				$targetTableName = $relation->getTargetEntityModel()->getTableName();
				$targetTable = null;

				if ($database->containsMetaEntityName($targetTableName)) {
					$targetTable = $database->getMetaEntityByName($targetTableName);
					CastUtils::assertTrue($joinTable instanceof Table);
				} else {
					$targetTable = $database->createMetaEntityFactory()->createTable($targetTableName);
				}
				
				$inverseJoinColumnName = $relation->getInverseJoinColumnName();
				if ($targetTable->containsColumnName($inverseJoinColumnName)) {
					$targetTable->removeColumnByName($inverseJoinColumnName);
				}
				
				$targetTable->createColumnFactory()->createIntegerColumn($inverseJoinColumnName, $idColumnSize, $idColumnSigned);
			}
		}
	}
{@inheritDoc}
@see \hangar\api\HangarPropDef::applyDbMeta()