2025_03_24_215013_create_datatables_table.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('datatables', function (Blueprint $table) {
  13. $table->id();
  14. $table->string('name'); // Unique name for the DataTable
  15. $table->string('description')->nullable(); // Optional description
  16. $table->string('base_table'); // Base table name (e.g., 'employees')
  17. $table->json('columns'); // JSON structure for column configuration
  18. $table->json('joins')->nullable(); // JSON structure for joins
  19. $table->json('conditions')->nullable(); // JSON for WHERE conditions
  20. $table->json('default_sorting')->nullable(); // Default sorting rules
  21. $table->timestamps();
  22. });
  23. }
  24. /**
  25. * Reverse the migrations.
  26. */
  27. public function down(): void
  28. {
  29. Schema::dropIfExists('datatables');
  30. }
  31. };