From 745cf2431a71d0e6c5f08f8605839279b2f7496e Mon Sep 17 00:00:00 2001 From: Devian Date: Thu, 22 Apr 2021 17:03:46 +0800 Subject: Initiate commit --- database/migrations/create_scorm_tables.php.stub | 111 +++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 database/migrations/create_scorm_tables.php.stub (limited to 'database/migrations') diff --git a/database/migrations/create_scorm_tables.php.stub b/database/migrations/create_scorm_tables.php.stub new file mode 100644 index 0000000..60209b8 --- /dev/null +++ b/database/migrations/create_scorm_tables.php.stub @@ -0,0 +1,111 @@ +bigIncrements('id'); + $table->string('version'); + $table->string('hash_name'); + $table->string('origin_file')->nullable(); + $table->string('origin_file_mime')->nullable(); + $table->double('ratio')->nullable(); + $table->string('uuid'); + $table->timestamps(); + }); + + // scorm_sco_model + Schema::create($tableNames['scorm_sco_table'], function (Blueprint $table) use ($tableNames) { + $table->bigIncrements('id'); + $table->bigInteger('scorm_id'); + $table->string('uuid'); + $table->bigInteger('sco_parent_id')->nullable(); + $table->string('entry_url')->nullable(); + $table->string('identifier'); + $table->string('title'); + $table->tinyInteger('visible'); + $table->longText('sco_parameters')->nullable(); + $table->longText('launch_data')->nullable(); + $table->string('max_time_allowed')->nullable(); + $table->string('time_limit_action')->nullable(); + $table->tinyInteger('block'); + $table->integer('score_int')->nullable(); + $table->decimal('score_decimal', 10,7)->nullable(); + $table->decimal('completion_threshold', 10,7)->nullable(); + $table->string('prerequisites')->nullable(); + $table->timestamps(); + + $table->foreign('scorm_id')->references('id')->on($tableNames['scorm_table']); + }); + + // scorm_sco_tracking_model + Schema::create($tableNames['scorm_sco_tracking_table'], function (Blueprint $table) use ($tableNames) { + $table->bigIncrements('id'); + $table->bigInteger('user_id'); + $table->bigInteger('sco_id'); + $table->string('uuid'); + $table->double('progression'); + $table->integer('score_raw')->nullable(); + $table->integer('score_min')->nullable(); + $table->integer('score_max')->nullable(); + $table->decimal('score_scaled', 10,7)->nullable(); + $table->string('lesson_status')->nullable(); + $table->string('completion_status')->nullable(); + $table->integer('session_time')->nullable(); + $table->integer('total_time_int')->nullable(); + $table->string('total_time_string')->nullable(); + $table->string('entry')->nullable(); + $table->longText('suspend_data')->nullable(); + $table->string('credit')->nullable(); + $table->string('exit_mode')->nullable(); + $table->string('lesson_location')->nullable(); + $table->string('lesson_mode')->nullable(); + $table->tinyInteger('is_locked')->nullable(); + $table->longText('details')->comment('json_array')->nullable(); + $table->dateTime('latest_date')->nullable(); + $table->timestamps(); + + $table->foreign('user_id')->references('id')->on($tableNames['user_table']); + $table->foreign('sco_id')->references('id')->on($tableNames['scorm_sco_table']); + }); + + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $tableNames = config('permission.table_names'); + + if (empty($tableNames)) { + throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); + } + + Schema::drop($tableNames['role_has_permissions']); + Schema::drop($tableNames['model_has_roles']); + Schema::drop($tableNames['model_has_permissions']); + Schema::drop($tableNames['roles']); + Schema::drop($tableNames['permissions']); + } +} -- cgit v1.2.3