Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save serefercelik/847595a825ef74f8e396fbdf0a8c71e7 to your computer and use it in GitHub Desktop.
Save serefercelik/847595a825ef74f8e396fbdf0a8c71e7 to your computer and use it in GitHub Desktop.
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