Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/TermsOfUseVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
class TermsOfUseVersion extends Model {
use HasFactory;

protected $primaryKey = 'version';

protected $keyType = 'string';

public $incrementing = false;

protected $table = 'tou_versions';

const FIELDS = [
Expand Down
24 changes: 24 additions & 0 deletions database/migrations/2026_01_08_091559_tou_version.php
Comment thread
dati18 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void {
Schema::table('tou_versions', function (Blueprint $table) {
$table->dropColumn('id');
$table->string('version', 10)->primary()->change();
Comment thread
dati18 marked this conversation as resolved.
Outdated
});
}

/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('tou_versions');
}
};
28 changes: 28 additions & 0 deletions database/migrations/2026_01_08_113952_tou_acceptances.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void {
Schema::table('tou_acceptances', function (Blueprint $table) {
$table->string('tou_version', 10)->change();
$table->foreign('tou_version')
->references('version')
->on('tou_versions')
->cascadeOnUpdate()
->restrictOnDelete();
});
}

/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('tou_acceptances');
}
};
Loading