60 lines
2.0 KiB
PHP
60 lines
2.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
/**
|
|
* The addresses CluPilot sends from.
|
|
*
|
|
* Previously there was one: the secret `mail.password`, pointing at
|
|
* mail.mailers.smtp.password. One password, one sender, and no way to say that
|
|
* an invoice comes from billing@ while a maintenance notice comes from
|
|
* no-reply@.
|
|
*
|
|
* The SERVER is not in here. All mailboxes live on one host, so it sits once in
|
|
* app_settings — a provider change is then one card, not five rows.
|
|
*/
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('mailboxes', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->uuid()->unique();
|
|
|
|
// The name a purpose points at. Free-form: the five seeded ones are
|
|
// a starting point, not a ceiling.
|
|
$table->string('key', 48)->unique();
|
|
|
|
$table->string('address');
|
|
$table->string('display_name')->nullable();
|
|
|
|
// Null means "same as address", which is the usual case and saves
|
|
// typing the address twice.
|
|
$table->string('username')->nullable();
|
|
|
|
// Ciphertext under SECRETS_KEY. Nullable so a mailbox can exist on
|
|
// the page before anyone has typed its password.
|
|
$table->text('password')->nullable();
|
|
|
|
// Suppresses Reply-To. A "no-reply" you can reply to is a lie in
|
|
// the sender.
|
|
$table->boolean('no_reply')->default(false);
|
|
|
|
$table->boolean('active')->default(true);
|
|
|
|
// When the test send last succeeded. Null is honest: it means
|
|
// nobody has proven these credentials work, not that they are bad.
|
|
$table->timestamp('last_verified_at')->nullable();
|
|
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('mailboxes');
|
|
}
|
|
};
|