mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:54:05 +00:00
[1.7.0] Add DB storage driver (#82)
This commit is contained in:
parent
674f4b3f9a
commit
9df78eb9c2
13 changed files with 375 additions and 25 deletions
59
assets/config.php
Normal file
59
assets/config.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'storage_driver' => 'Stancl\Tenancy\StorageDrivers\DatabaseStorageDriver',
|
||||
'storage' => [
|
||||
'db' => [ // Stancl\Tenancy\StorageDrivers\DatabaseStorageDriver
|
||||
'data_column' => 'data',
|
||||
'custom_columns' => [
|
||||
// 'plan',
|
||||
],
|
||||
'connection' => 'central',
|
||||
],
|
||||
'redis' => [ // Stancl\Tenancy\StorageDrivers\RedisStorageDriver
|
||||
'connection' => 'tenancy',
|
||||
],
|
||||
],
|
||||
'tenant_route_namespace' => 'App\Http\Controllers',
|
||||
'exempt_domains' => [
|
||||
// 'localhost',
|
||||
],
|
||||
'database' => [
|
||||
'based_on' => 'sqlite',
|
||||
'prefix' => 'tenant',
|
||||
'suffix' => '',
|
||||
],
|
||||
'redis' => [
|
||||
'tenancy' => false,
|
||||
'prefix_base' => 'tenant',
|
||||
'prefixed_connections' => [
|
||||
'default',
|
||||
'cache',
|
||||
],
|
||||
],
|
||||
'cache' => [
|
||||
'tag_base' => 'tenant',
|
||||
],
|
||||
'filesystem' => [
|
||||
'suffix_base' => 'tenant',
|
||||
// Disks which should be suffixed with the suffix_base + tenant UUID.
|
||||
'disks' => [
|
||||
'local',
|
||||
'public',
|
||||
// 's3',
|
||||
],
|
||||
'root_override' => [
|
||||
// Disks whose roots should be overriden after storage_path() is suffixed.
|
||||
'local' => '%storage_path%/app/',
|
||||
'public' => '%storage_path%/app/public/',
|
||||
],
|
||||
],
|
||||
'database_managers' => [
|
||||
'sqlite' => 'Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager',
|
||||
'mysql' => 'Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager',
|
||||
'pgsql' => 'Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager',
|
||||
],
|
||||
'queue_database_creation' => false,
|
||||
'queue_database_deletion' => false,
|
||||
'database_name_key' => null,
|
||||
];
|
||||
35
assets/migrations/2019_08_08_000000_create_tenants_table.php
Normal file
35
assets/migrations/2019_08_08_000000_create_tenants_table.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTenantsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tenants', function (Blueprint $table) {
|
||||
$table->string('uuid', 36)->primary(); // don't change this
|
||||
$table->string('domain', 255)->index(); // don't change this
|
||||
|
||||
// your indexed columns go here
|
||||
|
||||
$table->json('data')->default('{}');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('tenants');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue