Closed sebaiturravaldes closed 6 years ago
I'm not sure about this.
The last section of the if..else
block handles the output for string values by trimming the default and wrapping it in quotes. In your case, you could end up with something like:
$table->string('column')->default(some default value);
... which is going to cause errors.
If there is a scenario that isn't exporting properly for you, can you paste the SQL dump that isn't working?
return:
$table->string('ambiente', 255)->default(''prod'');
return with (two simple quotes)
with this SQL:
CREATE TABLE `cuenta` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`nombre` varchar(128) NOT NULL,
`nombre_largo` varchar(256) NOT NULL,
`mensaje` text NOT NULL,
`logo` varchar(128) DEFAULT NULL,
`api_token` varchar(32) NOT NULL,
`descarga_masiva` tinyint(1) NOT NULL DEFAULT '1',
`client_id` varchar(64) DEFAULT NULL,
`client_secret` varchar(64) DEFAULT NULL,
`ambiente` varchar(255) NOT NULL DEFAULT 'prod',
`vinculo_produccion` int(10) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `nombre` (`nombre`),
KEY `vinculo_produccion_idx` (`vinculo_produccion`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
I just ran it again with the table schema you posted above, and the current 1.4.1 version of the plug-in, and it works for me:
Schema::create('cuenta', function (Blueprint $table) {
$table->increments('id');
$table->string('nombre', 128);
$table->string('nombre_largo', 256);
$table->text('mensaje');
$table->string('logo', 128)->nullable();
$table->string('api_token', 32);
$table->tinyInteger('descarga_masiva')->default(1);
$table->string('client_id', 64)->nullable();
$table->string('client_secret', 64)->nullable();
$table->string('ambiente', 255)->default('prod');
$table->integer('vinculo_produccion')->nullable();
$table->unique('nombre', 'nombre');
$table->index('vinculo_produccion', 'vinculo_produccion_idx');
});
Thank you for helping to make this package better!
Please make sure you've read CONTRIBUTING.md before submitting your pull request, and that you have:
README.md
, etc.)Thank you!