0

I have some functions for Mysql on test.sql file.
When I import this file on mysql from phpmyadmin everything is ok.
But I want import it dynamically from Laravel Seeder. When I use this on my seeder, does not import it on my Mysql.

public function run()
 {
    DB::unprepared(file_get_contents(base_path().'/myfolder/test.sql'));
 }

When I add insert command on test.sql work correctly like this

 INSERT INTO `users` (`id`, `name`, `family`) VALUES(1, 'test', 'test2');  

But When I use this command dose not work

DROP FUNCTION IF EXISTS `__mydiv`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `__mydiv`(`a` int, `b` int) 
RETURNS bigint(20)
BEGIN
   return FLOOR(a / b);
END;
paranoid
  • 6,799
  • 19
  • 49
  • 86

0 Answers0