kuvia/database/migrations/2021_01_21_162803_themes.php

60 lines
1.7 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Themes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table("users", function (Blueprint $table) {
$table->enum("typ", ["user", "admin"])->default("user");
});
Schema::create("themes", function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->enum("typ", ["tenant", "gallery"]);
$table->string("name");
$table->enum("status", ["public", "private"]);
$table->boolean("img_pixel")->default(false);
$table->boolean("img_small")->default(false);
$table->boolean("img_medium")->default(false);
$table->boolean("img_big")->default(false);
});
Schema::table("tenants", function (Blueprint $table) {
$table->string("gallery_default_theme")->default("default");
});
Schema::table("galleries", function (Blueprint $table) {
$table->string("theme")->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table("users", function (Blueprint $table) {
$table->dropColumn('typ');
});
Schema::table("tenants", function (Blueprint $table) {
$table->dropColumn('gallery_default_theme');
});
Schema::table("galleries", function (Blueprint $table) {
$table->dropColumn('theme');
});
Schema::dropIfExists("themes");
}
}