As per Blueprint's README:
Blueprint is an open-source tool for rapidly generating multiple Laravel components from a single, human readable definition.
This add-on will read your existing database schema and create a Blueprint draft file based on said schema. It's ultimate goal is to port existing (legacy) projects to the Laravel framework with as little effort as possible.
As per the Laravel documentation the following column types are supported.
-
bigIncrements -
bigInteger -
binary -
boolean -
char -
date -
dateTime -
dateTimeTzDue to limitations it's rendered asdateTime -
decimal -
double -
enum -
float -
geometry -
geometryCollection -
increments -
integer -
ipAddressRendered asstring -
json -
jsonbRendered asjson -
lineStringDue to limitations in DBAL it's not supported -
longText -
macAddressRendered asstring -
mediumIncrements -
mediumInteger -
mediumText -
morphs -
uuidMorphs -
multiLineString -
multiPoint -
multiPolygon -
nullableMorphs -
nullableUuidMorphs -
point -
polygon -
set -
smallIncrements -
smallInteger -
string -
text -
time -
timeTzDue to limitations it's rendered astime -
timestamp -
timestampTz -
tinyIncrementsRendered asboolean -
tinyIntegerRendered asboolean -
unsignedBigIntegerRendered asbiginteger unsigned -
unsignedDecimal -
unsignedIntegerRendered asinteger unsigned -
unsignedMediumIntegerRendered asinteger unsigned -
unsignedSmallIntegerRendered assmallinteger unsigned -
unsignedTinyIntegerRendered asboolean unsigned -
uuidRendered asstring -
yearRendered asdate
-
idSeebigIncrements -
foreignIdSeeunsignedBigInteger -
nullableTimestampsSeetimestamp -
timestampsSeetimestamps -
timestampsTzSeetimestamp -
softDeletesSeetimestamp -
softDeletesTzSeetimestampTz -
rememberToken
- autoIncrement
- charset
- collation
- default
- nullable
- unsigned
- useCurrent
- always
- unique
- index
- primary
- foreign
CREATE TABLE `posts` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(400) NOT NULL,
`content` longtext NOT NULL,
`published_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;This YAML has been taken from Blueprint's README.
models:
Post:
title: string:400
content: longtext
published_at: nullable timestampCREATE TABLE `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `posts` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(400) NOT NULL,
`content` longtext NOT NULL,
`published_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `comments` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`author_id` bigint(20) unsigned NOT NULL,
`post_id` bigint(20) unsigned NOT NULL,
`content` longtext NOT NULL,
`published_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `comments_author_id_foreign` (`author_id`),
KEY `comments_post_id_foreign` (`post_id`),
CONSTRAINT `comments_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`),
CONSTRAINT `comments_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;models:
User:
name: string
timestamps
Post:
title: string:400
content: longtext
published_at: nullable timestamp
Comment:
author_id: id:user
post_id: id
content: longtext
published_at: nullable timestamp