1
I need to create a field like Numeric existing in postgres using migrations
from the Laravel, can anyone tell me how I do?
I tried that, but it didn’t roll:
public function up()
{
Schema::create('complementos', function (Blueprint $table) {
$table->increments('id');
$table->numeric('comprimento');
$table->timestamps();
});
}
I need to store values like 50.00, with the decimal places so set keeping the zeros after the point. If it is not really possible to create the Numeric, what other kind I could use?
Error while running migrate:
[Symfony Component Debug Exception Fatalerrorexception]
Call to Undefined method Illuminate Database Schema Blueprint::Umeric ()
How you passed the 'length'?
– rray
I pass exactly like this: 50.00. but the float type and real simply do not consider the . 00, and store only the 50.
– Raylan Soares
Try it like this
$table->numeric('15,2');
– rray
this in "Schema::create"? And how do I define the field name?
– Raylan Soares
Exactly, you need to pass the size and scale
– rray
postgres does not have innodb is all one engine only.
– rray
ok put as said, but returns the msm error.
– Raylan Soares
What is the error message?
– rray
I put in the question @rray
– Raylan Soares
Dude, Numeric() doesn’t exist, try bigInteger()
– Raphael Caldas
but if bigInteger does not accept 50.00, it error because of the point @Raphaelcaldas
– Raylan Soares
you do not value, it already has a value and 8bytes if I am not mistaken, you use: $table->bigInteger('NAME');
– Raphael Caldas
Yes, I did that and it was created all right, the problem is that I can’t store data that contains punctuation in it.
– Raylan Soares
Tell me the mistake you make, so I understand better
– Raphael Caldas
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "50.00"
– Raylan Soares
Let’s go continue this discussion in chat.
– Raphael Caldas