-
Notifications
You must be signed in to change notification settings - Fork 348
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
Please allow table name to be configurable #427
Comments
Best solution for now is to fork the repository and have your project consume the fork's package. To edit the table name, refer to the patch below. In a nutshell:
diff --git a/src/Venturecraft/Revisionable/Revision.php b/src/Venturecraft/Revisionable/Revision.php
index 2fdc838..16c062b 100644
--- a/src/Venturecraft/Revisionable/Revision.php
+++ b/src/Venturecraft/Revisionable/Revision.php
@@ -19,7 +19,7 @@ class Revision extends Eloquent
/**
* @var string
*/
- public $table = 'revisions';
+ public $table = '<<TABLE NAME>>';
/**
* @var array
diff --git a/src/migrations/2013_04_09_062329_create_revisions_table.php b/src/migrations/2013_04_09_062329_create_revisions_table.php
index 8d3d2d2..04aa866 100644
--- a/src/migrations/2013_04_09_062329_create_revisions_table.php
+++ b/src/migrations/2013_04_09_062329_create_revisions_table.php
@@ -11,7 +11,7 @@ class CreateRevisionsTable extends Migration
*/
public function up()
{
- Schema::create('revisions', function ($table) {
+ Schema::create('<<TABLE NAME>>', function ($table) {
$table->bigIncrements('id');
$table->string('revisionable_type');
$table->unsignedBigInteger('revisionable_id');
@@ -32,6 +32,6 @@ class CreateRevisionsTable extends Migration
*/
public function down()
{
- Schema::dropIfExists('revisions');
+ Schema::dropIfExists('<<TABLE NAME>>');
}
}
diff --git a/tests/migrations/2020_01_02_062329_add_additional_field_to_revisions.php b/tests/migrations/2020_01_02_062329_add_additional_field_to_revisions.php
index 389ed10..94dc77e 100644
--- a/tests/migrations/2020_01_02_062329_add_additional_field_to_revisions.php
+++ b/tests/migrations/2020_01_02_062329_add_additional_field_to_revisions.php
@@ -12,7 +12,7 @@ class AddAdditionalFieldToRevisions extends Migration
*/
public function up()
{
- Schema::table('revisions', function (Blueprint $table) {
+ Schema::table('<<TABLE NAME>>', function (Blueprint $table) {
$table->string('additional_field')->nullable();
});
} |
@MirisWisdom Yeah, I can do that but I don't want to maintain a fork. It really seems to me that this SHOULD be configurable! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I really need my revisions table to be named something other than
revisions
and I am pretty sure that this is a common issue! Can this be made configurable via the config file? A lot of packages do that; see for instance https://github.com/plank/laravel-mediable , another package i use.The text was updated successfully, but these errors were encountered: