monday-factory/database-model-generator

0.0.1 2020-07-07 10:31 UTC

This package is auto-updated.

Last update: 2024-04-15 13:19:27 UTC


README

Add to composer.json

"repositories": {
		"database-model-generator": {
			"type": "vcs",
			"url": "ssh://git@gitlab.mondayfactory.cz:2222/mondayfactory/database-model-generator.git"
		}
	}

Install it & enjoy ;-)

composer require-dev --dev monday-factory/database-model-generator

Now you must write a simple neon recipe located lives in modelDefinition directory.

Recipe

/data/modelDefinition/rancherService.neon

namespace: T2p\Common\Rancher\Service
databaseTable: token_rancher_service_status
databaseTableId:
databaseCols:
	rw:
		token_uuid:
			type: \Ramsey\Uuid\UuidInterface
			toString: 'toString()'
			fromString: '\Ramsey\Uuid\Uuid::fromString(?)'
		type:
			type: string
		status:
			type: \T2p\Common\Rancher\Service\StatusEnum
			fromString: '\T2p\Common\Rancher\Service\StatusEnum::get(?)'
			toString: 'getValue()'
	ro:
		created:
			type: \DateTime
			fromString: '\DateTime(?)'
		updated:
			type: \DateTime
			fromString: '\DateTime(?)'
			nullable: true

Now you call the generator command.

vendor/bin/database-model-generator b rancherService -f app