summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--database/migrations/create_scorm_tables.php.stub33
1 files changed, 21 insertions, 12 deletions
diff --git a/database/migrations/create_scorm_tables.php.stub b/database/migrations/create_scorm_tables.php.stub
index 319434c..c246365 100644
--- a/database/migrations/create_scorm_tables.php.stub
+++ b/database/migrations/create_scorm_tables.php.stub
@@ -22,7 +22,6 @@ class CreateScormTables extends Migration
// scorm_model
Schema::create($tableNames['scorm_table'], function (Blueprint $table) {
$table->bigIncrements('id');
- $table->morphs('resource');
$table->string('version');
$table->string('hash_name');
$table->string('origin_file')->nullable();
@@ -35,9 +34,9 @@ class CreateScormTables extends Migration
// scorm_sco_model
Schema::create($tableNames['scorm_sco_table'], function (Blueprint $table) use ($tableNames) {
$table->bigIncrements('id');
- $table->bigInteger('scorm_id');
+ $table->bigInteger('scorm_id')->unsigned();
$table->string('uuid');
- $table->bigInteger('sco_parent_id')->nullable();
+ $table->bigInteger('sco_parent_id')->unsigned()->nullable();
$table->string('entry_url')->nullable();
$table->string('identifier');
$table->string('title');
@@ -59,8 +58,8 @@ class CreateScormTables extends Migration
// 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->bigInteger('user_id')->unsigned();
+ $table->bigInteger('sco_id')->unsigned();
$table->string('uuid');
$table->double('progression');
$table->integer('score_raw')->nullable();
@@ -97,16 +96,26 @@ class CreateScormTables extends Migration
*/
public function down()
{
- $tableNames = config('permission.table_names');
+ $tableNames = config('scorm_sco_tracking_table');
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.');
+ throw new \Exception('Error: Table not found.');
}
- 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']);
+ $tableNames = config('scorm_sco_table');
+
+ if (empty($tableNames)) {
+ throw new \Exception('Error: Table not found.');
+ }
+
+ $tableNames = config('scorm_table');
+
+ if (empty($tableNames)) {
+ throw new \Exception('Error: Table not found.');
+ }
+
+ Schema::drop($tableNames['scorm_sco_tracking_table']);
+ Schema::drop($tableNames['scorm_sco_table']);
+ Schema::drop($tableNames['scorm_table']);
}
}