Laravel 5.3 Schema :: create ENUM字段为VARCHAR [英] Laravel 5.3 Schema::create ENUM field is VARCHAR

查看:59
本文介绍了Laravel 5.3 Schema :: create ENUM字段为VARCHAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了新的迁移.运行它后,我看到我的字段 type 不是ENUM type .它具有 VARCHAR(255)类型

I just created fresh migration. After running it I see my field type not ENUM type. It has a VARCHAR(255) type instead

Schema::create('payments', function (Blueprint $table) {
          $table->increments('id');
          $table->text('response');
          $table->enum('type', ['apple', 'paypal']);
          $table->smallInteger('flags');
          $table->timestamps();

        });

有人可以告诉我原因吗?我是否缺少某些东西,我尝试了多次-获得相同的结果.

Can somebody tell me what can be the reason. Am I missing something, I tried multiple times - getting same result.

我正在使用PostgreSQL 9.5.4

I'm using PostgreSQL 9.5.4

推荐答案

从Laravel

它将创建一个 varchar(255)列,并添加一个约束,使其仅允许指定的字符串.

It will create a varchar(255) column and will add a constraint so that it allows only the specified strings.

这篇关于Laravel 5.3 Schema :: create ENUM字段为VARCHAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆