Closed coolamit closed 3 months ago
@tpetry Please take a look
Thanks for your contribution @coolamit but I won't merge this PR.
The PostgreSQL CREATE TYPE
command is creating more trouble than it benefits an application from my experience:
ENUM
is not really used in PG because it has one serious drawback: You can't remove any value from the enum anymore like in MySQL. That's the reason why ENUMs are not used with PG. Even Laravel doesn't use them with the ->enum()
type and prefers the better approach of using a string type with a CHECK
constraint. And you can also create types with check constraint: domain types!Composite
types are also a great idea in theory. But serializing and deserializing is quite complicated and can easily lead to SQL injections when not all cases are handled correctly and placeholders are not used.
This is a followup to #91.
This PR adds support for custom data types -
create
,alter
, anddrop
.Schema
facade gets these additions:Blueprint
class gets this additionThe
type()
method above is just syntactic sugar, a wrapper around thedomain()
method, to allow for expressive code when assigning a custom data type to a column.