Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert type column change #1582

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/Http/Resources/V1/IndependentActivityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function toArray($request)
$data = [
'id' => $this->id,
'title' => $this->title,
'type' => $this->h5p_content->library->title,
'type' => $this->type,
'library_item_title' => $this->h5p_content->library->title,
'content' => $this->content,
'description' => $this->description,
'shared' => $this->shared,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Artisan::call('db:seed', [
'--class' => ChangeTypeFromActivities::class,
'--force' => true
]);
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('activities', function (Blueprint $table) {
//
});
}
};
19 changes: 19 additions & 0 deletions database/seeders/ChangeTypeFromActivities.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class ChangeTypeFromActivities extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\DB::table('activities')->whereNotIn('type', ["h5p_standalone", "h5p"])->update(['type' => "h5p"]);
}
}