35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
/**
|
|
* Seats = the people who use a customer's cloud, managed from the portal.
|
|
* Counted against the plan's seat allowance. Invites are mocked for now.
|
|
*/
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('seats', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->uuid('uuid')->unique();
|
|
$table->foreignId('customer_id')->constrained()->cascadeOnDelete();
|
|
$table->string('email');
|
|
$table->string('name')->nullable();
|
|
$table->string('role')->default('member'); // owner | admin | member | readonly
|
|
$table->string('status')->default('invited'); // invited | active | revoked
|
|
$table->timestamp('invited_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['customer_id', 'email']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('seats');
|
|
}
|
|
};
|