Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how change column type with laravel migration

  public function up()
  {
	// !!  
    //if error => Unknown database type enum requested
    // add this line
    Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
    
    Schema::table('building', function (Blueprint $table) {
      $table->float('height' , 10, 2)->change();
    });
  }

 //don't forget reverse
public function down()
{
  Schema::table('building', function (Blueprint $table) {
    $table->bigInteger('epaisseur')->change();
  });
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #change #column #type #laravel #migration
ADD COMMENT
Topic
Name
7+7 =