diff --git a/src/migrations/2015_02_07_172633_create_role_user_table.php b/src/migrations/2015_02_07_172633_create_role_user_table.php index 44485a5..9c2c89e 100644 --- a/src/migrations/2015_02_07_172633_create_role_user_table.php +++ b/src/migrations/2015_02_07_172633_create_role_user_table.php @@ -27,12 +27,12 @@ public function up() $table->increments('id'); $table->integer('role_id')->unsigned()->index()->foreign()->references("id")->on("roles")->onDelete("cascade"); - $table->bigInteger('user_id') + $table->bigInteger($this->prefix . 'user_id') ->unsigned() ->index() ->foreign() ->references("id") - ->on(Config::usersTableName()) + ->on($this->prefix . Config::usersTableName()) ->onDelete("cascade"); $table->timestamps(); @@ -42,7 +42,7 @@ public function up() ->on($this->prefix . 'roles') ->onDelete('cascade'); - $table->foreign('user_id') + $table->foreign($this->prefix . 'user_id') ->references('id') ->on($this->prefix . Config::usersTableName()) ->onDelete('cascade'); diff --git a/src/migrations/2015_02_17_152439_create_permission_user_table.php b/src/migrations/2015_02_17_152439_create_permission_user_table.php index 48bbb59..1552d99 100644 --- a/src/migrations/2015_02_17_152439_create_permission_user_table.php +++ b/src/migrations/2015_02_17_152439_create_permission_user_table.php @@ -26,11 +26,11 @@ public function up() Schema::create($this->prefix . 'permission_user', function (Blueprint $table) { $table->increments('id'); $table->integer('permission_id')->unsigned()->index()->references('id')->on('permissions')->onDelete('cascade'); - $table->bigInteger('user_id') + $table->bigInteger($this->prefix . 'user_id') ->unsigned() ->index() ->references('id') - ->on(Config::usersTableName()) + ->on($this->prefix . Config::usersTableName()) ->onDelete('cascade'); $table->timestamps(); }); diff --git a/src/migrations/2015_11_30_232041_bigint_user_keys.php b/src/migrations/2015_11_30_232041_bigint_user_keys.php index b34bad7..c931421 100644 --- a/src/migrations/2015_11_30_232041_bigint_user_keys.php +++ b/src/migrations/2015_11_30_232041_bigint_user_keys.php @@ -2,9 +2,20 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; +use Kodeine\Acl\Helper\Config; class BigintUserKeys extends Migration { + /** + * @var string + */ + public $prefix; + + public function __construct() + { + $this->prefix = config('acl.db_prefix'); + } + /** * Run the migrations. * @@ -12,7 +23,7 @@ class BigintUserKeys extends Migration */ public function up() { - Schema::table('role_user', function (Blueprint $table) { + Schema::table($this->prefix . 'role_user', function (Blueprint $table) { $table->bigInteger("user_id")->unsigned()->change(); }); } @@ -24,7 +35,7 @@ public function up() */ public function down() { - Schema::table('role_user', function (Blueprint $table) { + Schema::table($this->prefix . 'role_user', function (Blueprint $table) { $table->integer("user_id")->unsigned()->change(); }); }