14 use Illuminate\Database\Migrations\Migration;
15 use Illuminate\Database\Schema\Builder;
16 use Illuminate\Database\Schema\Blueprint;
17 use Illuminate\Database\Capsule\Manager as Capsule;
24 public function up() {
26 Capsule::schema()->create(
'metrics',
function (Blueprint $table) {
27 $table->string(
'load_id', 255);
28 $table->bigInteger(
'context_id');
29 $table->bigInteger(
'pkp_section_id')->nullable();
30 $table->bigInteger(
'assoc_object_type')->nullable();
31 $table->bigInteger(
'assoc_object_id')->nullable();
32 $table->bigInteger(
'submission_id')->nullable();
33 $table->bigInteger(
'representation_id')->nullable();
34 $table->bigInteger(
'assoc_type');
35 $table->bigInteger(
'assoc_id');
36 $table->string(
'day', 8)->nullable();
37 $table->string(
'month', 6)->nullable();
38 $table->smallInteger(
'file_type')->nullable();
39 $table->string(
'country_id', 2)->nullable();
40 $table->string(
'region', 2)->nullable();
41 $table->string(
'city', 255)->nullable();
42 $table->string(
'metric_type', 255);
43 $table->integer(
'metric');
44 $table->index([
'load_id'],
'metrics_load_id');
45 $table->index([
'metric_type',
'context_id'],
'metrics_metric_type_context_id');
46 $table->index([
'metric_type',
'submission_id',
'assoc_type'],
'metrics_metric_type_submission_id_assoc_type');
47 $table->index([
'metric_type',
'context_id',
'assoc_type',
'assoc_id'],
'metrics_metric_type_submission_id_assoc');
56 Capsule::schema()->drop(
'metrics');