I want to create a table with a float column.
$table->float('TaxRate',5,5)->default(0.00000);
But Mysql Taking this as a DOUBLE.
How this working ?.
It because Illuminate\Database\Schema\Grammars\MySqlGrammar
converts float
into double
. I don't know the reason why they enforce it to use double
.
Overriding the MySqlGrammar
will be troublesome, since you will have to override more classes.
You can use raw mysql query to create table like below
public function up() {
DB::unprepared('CREATE TABLE `temp`(
`id` INT NOT NULL AUTO_INCREMENT,
`tax_rate` FLOAT(5, 5) NOT NULL DEFAULT 0.00000,
...
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8'
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With