Skip to content

Commit

Permalink
Merge pull request #5 from one2tek/2.x
Browse files Browse the repository at this point in the history
Removed dropMorph and AddForeignKey migration
  • Loading branch information
gent-fella-health authored Feb 11, 2021
2 parents 42b8d5e + 4ed8e05 commit eb6eda9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 88 deletions.
3 changes: 2 additions & 1 deletion migrations/create_logs_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class CreateLogsTable extends Migration
$table->bigIncrements('id');
$table->string('event_type')->nullable();
$table->nullableMorphs('subject', 'subject');
$table->nullableMorphs('causer', 'causer');
$table->bigInteger('causer_id')->unsigned()->nullable();
$table->foreign('causer_id')->references('id')->on('users');
$table->json('properties')->nullable();
$table->timestamps();
});
Expand Down
33 changes: 0 additions & 33 deletions migrations/drop_morph_from_logs_table.php.stub

This file was deleted.

34 changes: 0 additions & 34 deletions migrations/logs_table_causer_id_add.php.stub

This file was deleted.

24 changes: 4 additions & 20 deletions src/Providers/LaraLogServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ public function boot()
$this->publishes([
__DIR__. '/../../config/laralog.php' => config_path('laralog.php'),
]);

if (!class_exists('CreateLogsTable')) {
$timestamp = date('Y_m_d_His', time());

$this->publishes([
__DIR__.'/../../migrations/create_logs_table.php.stub' => database_path("/migrations/{$timestamp}_create_logs_table.php"),
], 'migrations');
}

if (!class_exists('CreateUsersTableOnLogsDb')) {
$timestamp = date('Y_m_d_His', time());
Expand All @@ -45,20 +37,12 @@ public function boot()
__DIR__.'/../../migrations/create_users_table_on_logs_db.php.stub' => database_path("/migrations/{$timestamp}_create_users_table_on_logs_db.php")
], 'migrations');
}

if(!class_exists('DropMorphFromLogsTable')){
$timestamp = date('Y_m_d_His', time());

$this->publishes([
__DIR__.'/../../migrations/drop_morph_from_logs_table.php.stub' => database_path("/migrations/{$timestamp}_drop_morph_from_logs_table.php")
], 'migrations');
}

if(!class_exists('LogsTableCauserIdAdd')){
$timestamp = date('Y_m_d_His', time());

if (!class_exists('CreateLogsTable')) {
$timestamp = date('Y_m_d_His', time() + 60);

$this->publishes([
__DIR__.'/../../migrations/logs_table_causer_id_add.php.stub' => database_path("/migrations/{$timestamp}_logs_table_causer_id_add.php")
__DIR__.'/../../migrations/create_logs_table.php.stub' => database_path("/migrations/{$timestamp}_create_logs_table.php"),
], 'migrations');
}
}
Expand Down

0 comments on commit eb6eda9

Please sign in to comment.