Created
July 18, 2020 18:44
-
-
Save serefercelik/847595a825ef74f8e396fbdf0a8c71e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function up() | |
{ | |
Schema::create('tags', function($table){ | |
$table->increments('id'); | |
$table->string('name')->unique(); | |
}); | |
$sql = <<<SQL | |
DROP PROCEDURE IF EXISTS sp_insert_tag; | |
CREATE PROCEDURE sp_insert_tag(IN _name VARCHAR(32)) | |
BEGIN | |
INSERT INTO `tags`(`name`) VALUES(_name); | |
END | |
SQL; | |
DB::connection()->getPdo()->exec($sql); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
$sql = "DROP PROCEDURE IF EXISTS sp_insert_tag"; | |
DB::connection()->getPdo()->exec($sql); | |
Schema::drop('tags'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment