mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Merge pull request #4903 from BookStackApp/laravel10
Framework: Upgrade from Laravel 9 to 10
This commit is contained in:
commit
85dd71507e
@ -19,20 +19,25 @@ class MfaTotpController extends Controller
|
|||||||
|
|
||||||
protected const SETUP_SECRET_SESSION_KEY = 'mfa-setup-totp-secret';
|
protected const SETUP_SECRET_SESSION_KEY = 'mfa-setup-totp-secret';
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
protected TotpService $totp
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a view that generates and displays a TOTP QR code.
|
* Show a view that generates and displays a TOTP QR code.
|
||||||
*/
|
*/
|
||||||
public function generate(TotpService $totp)
|
public function generate()
|
||||||
{
|
{
|
||||||
if (session()->has(static::SETUP_SECRET_SESSION_KEY)) {
|
if (session()->has(static::SETUP_SECRET_SESSION_KEY)) {
|
||||||
$totpSecret = decrypt(session()->get(static::SETUP_SECRET_SESSION_KEY));
|
$totpSecret = decrypt(session()->get(static::SETUP_SECRET_SESSION_KEY));
|
||||||
} else {
|
} else {
|
||||||
$totpSecret = $totp->generateSecret();
|
$totpSecret = $this->totp->generateSecret();
|
||||||
session()->put(static::SETUP_SECRET_SESSION_KEY, encrypt($totpSecret));
|
session()->put(static::SETUP_SECRET_SESSION_KEY, encrypt($totpSecret));
|
||||||
}
|
}
|
||||||
|
|
||||||
$qrCodeUrl = $totp->generateUrl($totpSecret, $this->currentOrLastAttemptedUser());
|
$qrCodeUrl = $this->totp->generateUrl($totpSecret, $this->currentOrLastAttemptedUser());
|
||||||
$svg = $totp->generateQrCodeSvg($qrCodeUrl);
|
$svg = $this->totp->generateQrCodeSvg($qrCodeUrl);
|
||||||
|
|
||||||
$this->setPageTitle(trans('auth.mfa_gen_totp_title'));
|
$this->setPageTitle(trans('auth.mfa_gen_totp_title'));
|
||||||
|
|
||||||
@ -56,7 +61,7 @@ class MfaTotpController extends Controller
|
|||||||
'code' => [
|
'code' => [
|
||||||
'required',
|
'required',
|
||||||
'max:12', 'min:4',
|
'max:12', 'min:4',
|
||||||
new TotpValidationRule($totpSecret),
|
new TotpValidationRule($totpSecret, $this->totp),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -87,7 +92,7 @@ class MfaTotpController extends Controller
|
|||||||
'code' => [
|
'code' => [
|
||||||
'required',
|
'required',
|
||||||
'max:12', 'min:4',
|
'max:12', 'min:4',
|
||||||
new TotpValidationRule($totpSecret),
|
new TotpValidationRule($totpSecret, $this->totp),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -2,36 +2,26 @@
|
|||||||
|
|
||||||
namespace BookStack\Access\Mfa;
|
namespace BookStack\Access\Mfa;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\Rule;
|
use Closure;
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
|
|
||||||
class TotpValidationRule implements Rule
|
class TotpValidationRule implements ValidationRule
|
||||||
{
|
{
|
||||||
protected $secret;
|
|
||||||
protected $totpService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new rule instance.
|
* Create a new rule instance.
|
||||||
* Takes the TOTP secret that must be system provided, not user provided.
|
* Takes the TOTP secret that must be system provided, not user provided.
|
||||||
*/
|
*/
|
||||||
public function __construct(string $secret)
|
public function __construct(
|
||||||
{
|
protected string $secret,
|
||||||
$this->secret = $secret;
|
protected TotpService $totpService,
|
||||||
$this->totpService = app()->make(TotpService::class);
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||||
* Determine if the validation rule passes.
|
|
||||||
*/
|
|
||||||
public function passes($attribute, $value)
|
|
||||||
{
|
{
|
||||||
return $this->totpService->verifyCode($value, $this->secret);
|
$passes = $this->totpService->verifyCode($value, $this->secret);
|
||||||
}
|
if (!$passes) {
|
||||||
|
$fail(trans('validation.totp'));
|
||||||
/**
|
}
|
||||||
* Get the validation error message.
|
|
||||||
*/
|
|
||||||
public function message()
|
|
||||||
{
|
|
||||||
return trans('validation.totp');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
* Custom container bindings to register.
|
* Custom container bindings to register.
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
public $bindings = [
|
public array $bindings = [
|
||||||
ExceptionRenderer::class => BookStackExceptionHandlerPage::class,
|
ExceptionRenderer::class => BookStackExceptionHandlerPage::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
* Custom singleton bindings to register.
|
* Custom singleton bindings to register.
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
public $singletons = [
|
public array $singletons = [
|
||||||
'activity' => ActivityLogger::class,
|
'activity' => ActivityLogger::class,
|
||||||
SettingService::class => SettingService::class,
|
SettingService::class => SettingService::class,
|
||||||
SocialDriverManager::class => SocialDriverManager::class,
|
SocialDriverManager::class => SocialDriverManager::class,
|
||||||
@ -42,11 +42,19 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap any application services.
|
* Register any application services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->app->singleton(PermissionApplicator::class, function ($app) {
|
||||||
|
return new PermissionApplicator(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
{
|
{
|
||||||
// Set root URL
|
// Set root URL
|
||||||
$appUrl = config('app.url');
|
$appUrl = config('app.url');
|
||||||
@ -67,16 +75,4 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
'page' => Page::class,
|
'page' => Page::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Register any application services.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
$this->app->singleton(PermissionApplicator::class, function ($app) {
|
|
||||||
return new PermissionApplicator(null);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,8 @@ class AuthServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Bootstrap the application services.
|
* Bootstrap the application services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
// Password Configuration
|
// Password Configuration
|
||||||
// Changes here must be reflected in ApiDocsGenerate@getValidationAsString.
|
// Changes here must be reflected in ApiDocsGenerate@getValidationAsString.
|
||||||
@ -58,10 +56,8 @@ class AuthServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the application services.
|
* Register the application services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register(): void
|
||||||
{
|
{
|
||||||
Auth::provider('external-users', function ($app, array $config) {
|
Auth::provider('external-users', function ($app, array $config) {
|
||||||
return new ExternalBaseUserProvider($config['model']);
|
return new ExternalBaseUserProvider($config['model']);
|
||||||
|
@ -29,20 +29,16 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Register any events for your application.
|
* Register any events for your application.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if events and listeners should be automatically discovered.
|
* Determine if events and listeners should be automatically discovered.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function shouldDiscoverEvents()
|
public function shouldDiscoverEvents(): bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,8 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Define your route model bindings, pattern filters, etc.
|
* Define your route model bindings, pattern filters, etc.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
$this->configureRateLimiting();
|
$this->configureRateLimiting();
|
||||||
|
|
||||||
@ -41,10 +39,8 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
* Define the "web" routes for the application.
|
* Define the "web" routes for the application.
|
||||||
*
|
*
|
||||||
* These routes all receive session state, CSRF protection, etc.
|
* These routes all receive session state, CSRF protection, etc.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function mapWebRoutes()
|
protected function mapWebRoutes(): void
|
||||||
{
|
{
|
||||||
Route::group([
|
Route::group([
|
||||||
'middleware' => 'web',
|
'middleware' => 'web',
|
||||||
@ -65,10 +61,8 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
* Define the "api" routes for the application.
|
* Define the "api" routes for the application.
|
||||||
*
|
*
|
||||||
* These routes are typically stateless.
|
* These routes are typically stateless.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function mapApiRoutes()
|
protected function mapApiRoutes(): void
|
||||||
{
|
{
|
||||||
Route::group([
|
Route::group([
|
||||||
'middleware' => 'api',
|
'middleware' => 'api',
|
||||||
@ -81,10 +75,8 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the rate limiters for the application.
|
* Configure the rate limiters for the application.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function configureRateLimiting()
|
protected function configureRateLimiting(): void
|
||||||
{
|
{
|
||||||
RateLimiter::for('api', function (Request $request) {
|
RateLimiter::for('api', function (Request $request) {
|
||||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||||
|
@ -10,10 +10,8 @@ class ThemeServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Register services.
|
* Register services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register(): void
|
||||||
{
|
{
|
||||||
// Register the ThemeService as a singleton
|
// Register the ThemeService as a singleton
|
||||||
$this->app->singleton(ThemeService::class, fn ($app) => new ThemeService());
|
$this->app->singleton(ThemeService::class, fn ($app) => new ThemeService());
|
||||||
@ -21,10 +19,8 @@ class ThemeServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap services.
|
* Bootstrap services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
// Boot up the theme system
|
// Boot up the theme system
|
||||||
$themeService = $this->app->make(ThemeService::class);
|
$themeService = $this->app->make(ThemeService::class);
|
||||||
|
@ -11,10 +11,8 @@ class TranslationServiceProvider extends BaseProvider
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Register the service provider.
|
* Register the service provider.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register(): void
|
||||||
{
|
{
|
||||||
$this->registerLoader();
|
$this->registerLoader();
|
||||||
|
|
||||||
@ -41,10 +39,8 @@ class TranslationServiceProvider extends BaseProvider
|
|||||||
/**
|
/**
|
||||||
* Register the translation line loader.
|
* Register the translation line loader.
|
||||||
* Overrides the default register action from Laravel so a custom loader can be used.
|
* Overrides the default register action from Laravel so a custom loader can be used.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
protected function registerLoader()
|
protected function registerLoader(): void
|
||||||
{
|
{
|
||||||
$this->app->singleton('translation.loader', function ($app) {
|
$this->app->singleton('translation.loader', function ($app) {
|
||||||
return new FileLoader($app['files'], $app['path.lang']);
|
return new FileLoader($app['files'], $app['path.lang']);
|
||||||
|
@ -12,10 +12,8 @@ class ViewTweaksServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Bootstrap services.
|
* Bootstrap services.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
// Set paginator to use bootstrap-style pagination
|
// Set paginator to use bootstrap-style pagination
|
||||||
Paginator::useBootstrap();
|
Paginator::useBootstrap();
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
@ -113,46 +114,22 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
// Application Service Providers
|
// Application Service Providers
|
||||||
'providers' => [
|
'providers' => ServiceProvider::defaultProviders()->merge([
|
||||||
|
|
||||||
// Laravel Framework Service Providers...
|
|
||||||
Illuminate\Auth\AuthServiceProvider::class,
|
|
||||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
|
||||||
Illuminate\Bus\BusServiceProvider::class,
|
|
||||||
Illuminate\Cache\CacheServiceProvider::class,
|
|
||||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
|
||||||
Illuminate\Cookie\CookieServiceProvider::class,
|
|
||||||
Illuminate\Database\DatabaseServiceProvider::class,
|
|
||||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
|
||||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
|
||||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
|
||||||
Illuminate\Hashing\HashServiceProvider::class,
|
|
||||||
Illuminate\Mail\MailServiceProvider::class,
|
|
||||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
|
||||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
|
||||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
|
||||||
Illuminate\Queue\QueueServiceProvider::class,
|
|
||||||
Illuminate\Redis\RedisServiceProvider::class,
|
|
||||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
|
||||||
Illuminate\Session\SessionServiceProvider::class,
|
|
||||||
Illuminate\Validation\ValidationServiceProvider::class,
|
|
||||||
Illuminate\View\ViewServiceProvider::class,
|
|
||||||
|
|
||||||
// Third party service providers
|
// Third party service providers
|
||||||
Barryvdh\DomPDF\ServiceProvider::class,
|
Barryvdh\DomPDF\ServiceProvider::class,
|
||||||
Barryvdh\Snappy\ServiceProvider::class,
|
Barryvdh\Snappy\ServiceProvider::class,
|
||||||
SocialiteProviders\Manager\ServiceProvider::class,
|
SocialiteProviders\Manager\ServiceProvider::class,
|
||||||
|
|
||||||
// BookStack custom service providers
|
// BookStack custom service providers
|
||||||
\BookStack\App\Providers\ThemeServiceProvider::class,
|
BookStack\App\Providers\ThemeServiceProvider::class,
|
||||||
\BookStack\App\Providers\AppServiceProvider::class,
|
BookStack\App\Providers\AppServiceProvider::class,
|
||||||
\BookStack\App\Providers\AuthServiceProvider::class,
|
BookStack\App\Providers\AuthServiceProvider::class,
|
||||||
\BookStack\App\Providers\EventServiceProvider::class,
|
BookStack\App\Providers\EventServiceProvider::class,
|
||||||
\BookStack\App\Providers\RouteServiceProvider::class,
|
BookStack\App\Providers\RouteServiceProvider::class,
|
||||||
\BookStack\App\Providers\TranslationServiceProvider::class,
|
BookStack\App\Providers\TranslationServiceProvider::class,
|
||||||
\BookStack\App\Providers\ValidationRuleServiceProvider::class,
|
BookStack\App\Providers\ValidationRuleServiceProvider::class,
|
||||||
\BookStack\App\Providers\ViewTweaksServiceProvider::class,
|
BookStack\App\Providers\ViewTweaksServiceProvider::class,
|
||||||
],
|
])->toArray(),
|
||||||
|
|
||||||
// Class Aliases
|
// Class Aliases
|
||||||
// This array of class aliases to be registered on application start.
|
// This array of class aliases to be registered on application start.
|
||||||
|
@ -53,7 +53,8 @@ return [
|
|||||||
|
|
||||||
'file' => [
|
'file' => [
|
||||||
'driver' => 'file',
|
'driver' => 'file',
|
||||||
'path' => storage_path('framework/cache'),
|
'path' => storage_path('framework/cache/data'),
|
||||||
|
'lock_path' => storage_path('framework/cache/data'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'memcached' => [
|
'memcached' => [
|
||||||
|
@ -21,7 +21,8 @@ return [
|
|||||||
// passwords are hashed using the Bcrypt algorithm. This will allow you
|
// passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||||
// to control the amount of time it takes to hash the given password.
|
// to control the amount of time it takes to hash the given password.
|
||||||
'bcrypt' => [
|
'bcrypt' => [
|
||||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
'rounds' => env('BCRYPT_ROUNDS', 12),
|
||||||
|
'verify' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
// Argon Options
|
// Argon Options
|
||||||
|
@ -4,6 +4,7 @@ use Monolog\Formatter\LineFormatter;
|
|||||||
use Monolog\Handler\ErrorLogHandler;
|
use Monolog\Handler\ErrorLogHandler;
|
||||||
use Monolog\Handler\NullHandler;
|
use Monolog\Handler\NullHandler;
|
||||||
use Monolog\Handler\StreamHandler;
|
use Monolog\Handler\StreamHandler;
|
||||||
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logging configuration options.
|
* Logging configuration options.
|
||||||
@ -49,6 +50,7 @@ return [
|
|||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
'days' => 14,
|
'days' => 14,
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'daily' => [
|
'daily' => [
|
||||||
@ -56,6 +58,7 @@ return [
|
|||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
'days' => 7,
|
'days' => 7,
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'stderr' => [
|
'stderr' => [
|
||||||
@ -65,16 +68,20 @@ return [
|
|||||||
'with' => [
|
'with' => [
|
||||||
'stream' => 'php://stderr',
|
'stream' => 'php://stderr',
|
||||||
],
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
],
|
],
|
||||||
|
|
||||||
'syslog' => [
|
'syslog' => [
|
||||||
'driver' => 'syslog',
|
'driver' => 'syslog',
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
|
'facility' => LOG_USER,
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'errorlog' => [
|
'errorlog' => [
|
||||||
'driver' => 'errorlog',
|
'driver' => 'errorlog',
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
// Custom errorlog implementation that logs out a plain,
|
// Custom errorlog implementation that logs out a plain,
|
||||||
@ -88,6 +95,7 @@ return [
|
|||||||
'formatter_with' => [
|
'formatter_with' => [
|
||||||
'format' => '%message%',
|
'format' => '%message%',
|
||||||
],
|
],
|
||||||
|
'replace_placeholders' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
'null' => [
|
'null' => [
|
||||||
|
@ -40,6 +40,12 @@ return [
|
|||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Job batching
|
||||||
|
'batching' => [
|
||||||
|
'database' => 'mysql',
|
||||||
|
'table' => 'job_batches',
|
||||||
|
],
|
||||||
|
|
||||||
// Failed queue job logging
|
// Failed queue job logging
|
||||||
'failed' => [
|
'failed' => [
|
||||||
'driver' => 'database-uuids',
|
'driver' => 'database-uuids',
|
||||||
|
@ -85,4 +85,11 @@ return [
|
|||||||
// do not enable this as other CSRF protection services are in place.
|
// do not enable this as other CSRF protection services are in place.
|
||||||
// Options: lax, strict, none
|
// Options: lax, strict, none
|
||||||
'same_site' => 'lax',
|
'same_site' => 'lax',
|
||||||
|
|
||||||
|
|
||||||
|
// Partitioned Cookies
|
||||||
|
// Setting this value to true will tie the cookie to the top-level site for
|
||||||
|
// a cross-site context. Partitioned cookies are accepted by the browser
|
||||||
|
// when flagged "secure" and the Same-Site attribute is set to "none".
|
||||||
|
'partitioned' => false,
|
||||||
];
|
];
|
||||||
|
@ -45,11 +45,11 @@ class Kernel extends HttpKernel
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The application's route middleware.
|
* The application's middleware aliases.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $routeMiddleware = [
|
protected $middlewareAliases = [
|
||||||
'auth' => \BookStack\Http\Middleware\Authenticate::class,
|
'auth' => \BookStack\Http\Middleware\Authenticate::class,
|
||||||
'can' => \BookStack\Http\Middleware\CheckUserHasPermission::class,
|
'can' => \BookStack\Http\Middleware\CheckUserHasPermission::class,
|
||||||
'guest' => \BookStack\Http\Middleware\RedirectIfAuthenticated::class,
|
'guest' => \BookStack\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
@ -6,19 +6,16 @@ use BookStack\App\Providers\RouteServiceProvider;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class RedirectIfAuthenticated
|
class RedirectIfAuthenticated
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Closure(Request): (Response) $next
|
||||||
* @param \Closure $next
|
|
||||||
* @param string|null ...$guards
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next, ...$guards)
|
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||||
{
|
{
|
||||||
$guards = empty($guards) ? [null] : $guards;
|
$guards = empty($guards) ? [null] : $guards;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class ThrottleApiRequests extends Middleware
|
|||||||
/**
|
/**
|
||||||
* Resolve the number of attempts if the user is authenticated or not.
|
* Resolve the number of attempts if the user is authenticated or not.
|
||||||
*/
|
*/
|
||||||
protected function resolveMaxAttempts($request, $maxAttempts)
|
protected function resolveMaxAttempts($request, $maxAttempts): int
|
||||||
{
|
{
|
||||||
return (int) config('api.requests_per_minute');
|
return (int) config('api.requests_per_minute');
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,9 @@ class TrustHosts extends Middleware
|
|||||||
/**
|
/**
|
||||||
* Get the host patterns that should be trusted.
|
* Get the host patterns that should be trusted.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array<int, string|null>
|
||||||
*/
|
*/
|
||||||
public function hosts()
|
public function hosts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
$this->allSubdomainsOfApplicationUrl(),
|
$this->allSubdomainsOfApplicationUrl(),
|
||||||
|
@ -8,16 +8,22 @@ class FileLoader extends BaseLoader
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Load the messages for the given locale.
|
* Load the messages for the given locale.
|
||||||
|
*
|
||||||
* Extends Laravel's translation FileLoader to look in multiple directories
|
* Extends Laravel's translation FileLoader to look in multiple directories
|
||||||
* so that we can load in translation overrides from the theme file if wanted.
|
* so that we can load in translation overrides from the theme file if wanted.
|
||||||
*
|
*
|
||||||
|
* Note: As of using Laravel 10, this may now be redundant since Laravel's
|
||||||
|
* file loader supports multiple paths. This needs further testing though
|
||||||
|
* to confirm if Laravel works how we expect, since we specifically need
|
||||||
|
* the theme folder to be able to partially override core lang files.
|
||||||
|
*
|
||||||
* @param string $locale
|
* @param string $locale
|
||||||
* @param string $group
|
* @param string $group
|
||||||
* @param string|null $namespace
|
* @param string|null $namespace
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function load($locale, $group, $namespace = null)
|
public function load($locale, $group, $namespace = null): array
|
||||||
{
|
{
|
||||||
if ($group === '*' && $namespace === '*') {
|
if ($group === '*' && $namespace === '*') {
|
||||||
return $this->loadJsonPaths($locale);
|
return $this->loadJsonPaths($locale);
|
||||||
@ -25,8 +31,8 @@ class FileLoader extends BaseLoader
|
|||||||
|
|
||||||
if (is_null($namespace) || $namespace === '*') {
|
if (is_null($namespace) || $namespace === '*') {
|
||||||
$themePath = theme_path('lang');
|
$themePath = theme_path('lang');
|
||||||
$themeTranslations = $themePath ? $this->loadPath($themePath, $locale, $group) : [];
|
$themeTranslations = $themePath ? $this->loadPaths([$themePath], $locale, $group) : [];
|
||||||
$originalTranslations = $this->loadPath($this->path, $locale, $group);
|
$originalTranslations = $this->loadPaths($this->paths, $locale, $group);
|
||||||
|
|
||||||
return array_merge($originalTranslations, $themeTranslations);
|
return array_merge($originalTranslations, $themeTranslations);
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,12 @@ use BookStack\Exceptions\ImageUploadException;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use GuzzleHttp\Psr7\Utils;
|
use GuzzleHttp\Psr7\Utils;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Intervention\Image\Gd\Driver;
|
use Intervention\Image\Decoders\BinaryImageDecoder;
|
||||||
use Intervention\Image\Image as InterventionImage;
|
use Intervention\Image\Drivers\Gd\Driver;
|
||||||
|
use Intervention\Image\Encoders\AutoEncoder;
|
||||||
|
use Intervention\Image\Encoders\PngEncoder;
|
||||||
|
use Intervention\Image\Interfaces\ImageInterface as InterventionImage;
|
||||||
|
use Intervention\Image\ImageManager;
|
||||||
|
|
||||||
class ImageResizer
|
class ImageResizer
|
||||||
{
|
{
|
||||||
@ -124,15 +128,17 @@ class ImageResizer
|
|||||||
$this->orientImageToOriginalExif($thumb, $imageData);
|
$this->orientImageToOriginalExif($thumb, $imageData);
|
||||||
|
|
||||||
if ($keepRatio) {
|
if ($keepRatio) {
|
||||||
$thumb->resize($width, $height, function ($constraint) {
|
$thumb->scaleDown($width, $height);
|
||||||
$constraint->aspectRatio();
|
|
||||||
$constraint->upsize();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$thumb->fit($width, $height);
|
$thumb->cover($width, $height);
|
||||||
}
|
}
|
||||||
|
|
||||||
$thumbData = (string) $thumb->encode($format);
|
$encoder = match ($format) {
|
||||||
|
'png' => new PngEncoder(),
|
||||||
|
default => new AutoEncoder(),
|
||||||
|
};
|
||||||
|
|
||||||
|
$thumbData = (string) $thumb->encode($encoder);
|
||||||
|
|
||||||
// Use original image data if we're keeping the ratio
|
// Use original image data if we're keeping the ratio
|
||||||
// and the resizing does not save any space.
|
// and the resizing does not save any space.
|
||||||
@ -150,8 +156,9 @@ class ImageResizer
|
|||||||
*/
|
*/
|
||||||
protected function interventionFromImageData(string $imageData): InterventionImage
|
protected function interventionFromImageData(string $imageData): InterventionImage
|
||||||
{
|
{
|
||||||
$driver = new Driver();
|
$manager = new ImageManager(new Driver());
|
||||||
return $driver->decoder->initFromBinary($imageData);
|
|
||||||
|
return $manager->read($imageData, BinaryImageDecoder::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
"barryvdh/laravel-snappy": "^1.0",
|
"barryvdh/laravel-snappy": "^1.0",
|
||||||
"doctrine/dbal": "^3.5",
|
"doctrine/dbal": "^3.5",
|
||||||
"guzzlehttp/guzzle": "^7.4",
|
"guzzlehttp/guzzle": "^7.4",
|
||||||
"intervention/image": "^2.7",
|
"intervention/image": "^3.5",
|
||||||
"laravel/framework": "^9.0",
|
"laravel/framework": "^10.10",
|
||||||
"laravel/socialite": "^5.10",
|
"laravel/socialite": "^5.10",
|
||||||
"laravel/tinker": "^2.6",
|
"laravel/tinker": "^2.8",
|
||||||
"league/commonmark": "^2.3",
|
"league/commonmark": "^2.3",
|
||||||
"league/flysystem-aws-s3-v3": "^3.0",
|
"league/flysystem-aws-s3-v3": "^3.0",
|
||||||
"league/html-to-markdown": "^5.0.0",
|
"league/html-to-markdown": "^5.0.0",
|
||||||
@ -39,17 +39,17 @@
|
|||||||
"socialiteproviders/okta": "^4.2",
|
"socialiteproviders/okta": "^4.2",
|
||||||
"socialiteproviders/twitch": "^5.3",
|
"socialiteproviders/twitch": "^5.3",
|
||||||
"ssddanbrown/htmldiff": "^1.0.2",
|
"ssddanbrown/htmldiff": "^1.0.2",
|
||||||
"ssddanbrown/symfony-mailer": "6.0.x-dev"
|
"ssddanbrown/symfony-mailer": "6.4.x-dev"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.21",
|
"fakerphp/faker": "^1.21",
|
||||||
"itsgoingd/clockwork": "^5.1",
|
"itsgoingd/clockwork": "^5.1",
|
||||||
"mockery/mockery": "^1.5",
|
"mockery/mockery": "^1.5",
|
||||||
"nunomaduro/collision": "^6.4",
|
"nunomaduro/collision": "^7.0",
|
||||||
"larastan/larastan": "^2.7",
|
"larastan/larastan": "^2.7",
|
||||||
"phpunit/phpunit": "^9.5",
|
"phpunit/phpunit": "^10.0",
|
||||||
"squizlabs/php_codesniffer": "^3.7",
|
"squizlabs/php_codesniffer": "^3.7",
|
||||||
"ssddanbrown/asserthtml": "^2.0"
|
"ssddanbrown/asserthtml": "^3.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
1099
composer.lock
generated
1099
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -26,17 +27,15 @@ return new class extends Migration
|
|||||||
'name' => 'Admin',
|
'name' => 'Admin',
|
||||||
'email' => 'admin@admin.com',
|
'email' => 'admin@admin.com',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('users');
|
Schema::drop('users');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('password_resets', function (Blueprint $table) {
|
Schema::create('password_resets', function (Blueprint $table) {
|
||||||
$table->string('email')->index();
|
$table->string('email')->index();
|
||||||
@ -21,10 +20,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('password_resets');
|
Schema::drop('password_resets');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('books', function (Blueprint $table) {
|
Schema::create('books', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -23,10 +22,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('books');
|
Schema::drop('books');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('pages', function (Blueprint $table) {
|
Schema::create('pages', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -27,10 +26,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('pages');
|
Schema::drop('pages');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('images', function (Blueprint $table) {
|
Schema::create('images', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -22,10 +21,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('images');
|
Schema::drop('images');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('chapters', function (Blueprint $table) {
|
Schema::create('chapters', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -25,10 +24,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('chapters');
|
Schema::drop('chapters');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->integer('created_by');
|
$table->integer('created_by');
|
||||||
@ -32,10 +31,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->dropColumn('created_by');
|
$table->dropColumn('created_by');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('page_revisions', function (Blueprint $table) {
|
Schema::create('page_revisions', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -25,10 +24,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('page_revisions');
|
Schema::drop('page_revisions');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('activities', function (Blueprint $table) {
|
Schema::create('activities', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -26,10 +25,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('activities');
|
Schema::drop('activities');
|
||||||
}
|
}
|
||||||
|
@ -10,17 +10,18 @@
|
|||||||
* @url https://github.com/Zizaco/entrust
|
* @url https://github.com/Zizaco/entrust
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Create table for storing roles
|
// Create table for storing roles
|
||||||
Schema::create('roles', function (Blueprint $table) {
|
Schema::create('roles', function (Blueprint $table) {
|
||||||
@ -71,22 +72,22 @@ return new class extends Migration
|
|||||||
'name' => 'admin',
|
'name' => 'admin',
|
||||||
'display_name' => 'Admin',
|
'display_name' => 'Admin',
|
||||||
'description' => 'Administrator of the whole application',
|
'description' => 'Administrator of the whole application',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
$editorId = DB::table('roles')->insertGetId([
|
$editorId = DB::table('roles')->insertGetId([
|
||||||
'name' => 'editor',
|
'name' => 'editor',
|
||||||
'display_name' => 'Editor',
|
'display_name' => 'Editor',
|
||||||
'description' => 'User can edit Books, Chapters & Pages',
|
'description' => 'User can edit Books, Chapters & Pages',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
$viewerId = DB::table('roles')->insertGetId([
|
$viewerId = DB::table('roles')->insertGetId([
|
||||||
'name' => 'viewer',
|
'name' => 'viewer',
|
||||||
'display_name' => 'Viewer',
|
'display_name' => 'Viewer',
|
||||||
'description' => 'User can view books & their content behind authentication',
|
'description' => 'User can view books & their content behind authentication',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Create default CRUD permissions and allocate to admins and editors
|
// Create default CRUD permissions and allocate to admins and editors
|
||||||
@ -97,8 +98,8 @@ return new class extends Migration
|
|||||||
$newPermId = DB::table('permissions')->insertGetId([
|
$newPermId = DB::table('permissions')->insertGetId([
|
||||||
'name' => strtolower($entity) . '-' . strtolower($op),
|
'name' => strtolower($entity) . '-' . strtolower($op),
|
||||||
'display_name' => $op . ' ' . $entity . 's',
|
'display_name' => $op . ' ' . $entity . 's',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
DB::table('permission_role')->insert([
|
DB::table('permission_role')->insert([
|
||||||
['permission_id' => $newPermId, 'role_id' => $adminId],
|
['permission_id' => $newPermId, 'role_id' => $adminId],
|
||||||
@ -115,8 +116,8 @@ return new class extends Migration
|
|||||||
$newPermId = DB::table('permissions')->insertGetId([
|
$newPermId = DB::table('permissions')->insertGetId([
|
||||||
'name' => strtolower($entity) . '-' . strtolower($op),
|
'name' => strtolower($entity) . '-' . strtolower($op),
|
||||||
'display_name' => $op . ' ' . $entity,
|
'display_name' => $op . ' ' . $entity,
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
DB::table('permission_role')->insert([
|
DB::table('permission_role')->insert([
|
||||||
'permission_id' => $newPermId,
|
'permission_id' => $newPermId,
|
||||||
@ -138,10 +139,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('permission_role');
|
Schema::drop('permission_role');
|
||||||
Schema::drop('permissions');
|
Schema::drop('permissions');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('settings', function (Blueprint $table) {
|
Schema::create('settings', function (Blueprint $table) {
|
||||||
$table->string('setting_key')->primary()->indexed();
|
$table->string('setting_key')->primary()->indexed();
|
||||||
@ -21,10 +20,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('settings');
|
Schema::drop('settings');
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
@ -23,15 +22,13 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||||
$pages = $sm->listTableDetails('pages');
|
$pages = $sm->introspectTable('pages');
|
||||||
$books = $sm->listTableDetails('books');
|
$books = $sm->introspectTable('books');
|
||||||
$chapters = $sm->listTableDetails('chapters');
|
$chapters = $sm->introspectTable('chapters');
|
||||||
|
|
||||||
if ($pages->hasIndex('search')) {
|
if ($pages->hasIndex('search')) {
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('social_accounts', function (Blueprint $table) {
|
Schema::create('social_accounts', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -24,10 +23,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('social_accounts');
|
Schema::drop('social_accounts');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->boolean('email_confirmed')->default(true);
|
$table->boolean('email_confirmed')->default(true);
|
||||||
@ -26,10 +25,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn('email_confirmed');
|
$table->dropColumn('email_confirmed');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('views', function (Blueprint $table) {
|
Schema::create('views', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -24,10 +23,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('views');
|
Schema::drop('views');
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('books', function (Blueprint $table) {
|
Schema::table('books', function (Blueprint $table) {
|
||||||
$table->index('slug');
|
$table->index('slug');
|
||||||
@ -48,10 +47,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('books', function (Blueprint $table) {
|
Schema::table('books', function (Blueprint $table) {
|
||||||
$table->dropIndex('books_slug_index');
|
$table->dropIndex('books_slug_index');
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
@ -23,15 +22,13 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||||
$pages = $sm->listTableDetails('pages');
|
$pages = $sm->introspectTable('pages');
|
||||||
$books = $sm->listTableDetails('books');
|
$books = $sm->introspectTable('books');
|
||||||
$chapters = $sm->listTableDetails('chapters');
|
$chapters = $sm->introspectTable('chapters');
|
||||||
|
|
||||||
if ($pages->hasIndex('name_search')) {
|
if ($pages->hasIndex('name_search')) {
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
|
@ -3,15 +3,14 @@
|
|||||||
use BookStack\Uploads\Image;
|
use BookStack\Uploads\Image;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('images', function (Blueprint $table) {
|
Schema::table('images', function (Blueprint $table) {
|
||||||
$table->string('path', 400);
|
$table->string('path', 400);
|
||||||
@ -27,10 +26,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('images', function (Blueprint $table) {
|
Schema::table('images', function (Blueprint $table) {
|
||||||
$table->dropColumn('type');
|
$table->dropColumn('type');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->integer('image_id')->default(0);
|
$table->integer('image_id')->default(0);
|
||||||
@ -19,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn('image_id');
|
$table->dropColumn('image_id');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('external_auth_id')->index();
|
$table->string('external_auth_id')->index();
|
||||||
@ -19,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn('external_auth_id');
|
$table->dropColumn('external_auth_id');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('page_revisions', function (Blueprint $table) {
|
Schema::table('page_revisions', function (Blueprint $table) {
|
||||||
$table->string('slug');
|
$table->string('slug');
|
||||||
@ -22,10 +21,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('page_revisions', function (Blueprint $table) {
|
Schema::table('page_revisions', function (Blueprint $table) {
|
||||||
$table->dropColumn('slug');
|
$table->dropColumn('slug');
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Get roles with permissions we need to change
|
// Get roles with permissions we need to change
|
||||||
$adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id;
|
$adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id;
|
||||||
@ -30,8 +30,8 @@ return new class extends Migration
|
|||||||
$permissionId = DB::table('permissions')->insertGetId([
|
$permissionId = DB::table('permissions')->insertGetId([
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'display_name' => $displayName,
|
'display_name' => $displayName,
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
DB::table('permission_role')->insert([
|
DB::table('permission_role')->insert([
|
||||||
'role_id' => $adminRoleId,
|
'role_id' => $adminRoleId,
|
||||||
@ -47,8 +47,8 @@ return new class extends Migration
|
|||||||
$permissionId = DB::table('permissions')->insertGetId([
|
$permissionId = DB::table('permissions')->insertGetId([
|
||||||
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
|
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
|
||||||
'display_name' => $op . ' ' . $entity . 's',
|
'display_name' => $op . ' ' . $entity . 's',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
DB::table('permission_role')->insert([
|
DB::table('permission_role')->insert([
|
||||||
'role_id' => $adminRoleId,
|
'role_id' => $adminRoleId,
|
||||||
@ -66,10 +66,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Get roles with permissions we need to change
|
// Get roles with permissions we need to change
|
||||||
$adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id;
|
$adminRoleId = DB::table('roles')->where('name', '=', 'admin')->first()->id;
|
||||||
@ -85,8 +83,8 @@ return new class extends Migration
|
|||||||
$permissionId = DB::table('permissions')->insertGetId([
|
$permissionId = DB::table('permissions')->insertGetId([
|
||||||
'name' => strtolower($entity) . '-' . strtolower($op),
|
'name' => strtolower($entity) . '-' . strtolower($op),
|
||||||
'display_name' => $op . ' ' . $entity . 's',
|
'display_name' => $op . ' ' . $entity . 's',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
DB::table('permission_role')->insert([
|
DB::table('permission_role')->insert([
|
||||||
'role_id' => $adminRoleId,
|
'role_id' => $adminRoleId,
|
||||||
@ -103,8 +101,8 @@ return new class extends Migration
|
|||||||
$permissionId = DB::table('permissions')->insertGetId([
|
$permissionId = DB::table('permissions')->insertGetId([
|
||||||
'name' => strtolower($entity) . '-' . strtolower($op),
|
'name' => strtolower($entity) . '-' . strtolower($op),
|
||||||
'display_name' => $op . ' ' . $entity,
|
'display_name' => $op . ' ' . $entity,
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
DB::table('permission_role')->insert([
|
DB::table('permission_role')->insert([
|
||||||
'role_id' => $adminRoleId,
|
'role_id' => $adminRoleId,
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('images', function (Blueprint $table) {
|
Schema::table('images', function (Blueprint $table) {
|
||||||
$table->integer('uploaded_to')->default(0);
|
$table->integer('uploaded_to')->default(0);
|
||||||
@ -46,10 +45,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('images', function (Blueprint $table) {
|
Schema::table('images', function (Blueprint $table) {
|
||||||
$table->dropColumn('uploaded_to');
|
$table->dropColumn('uploaded_to');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('page_revisions', function (Blueprint $table) {
|
Schema::table('page_revisions', function (Blueprint $table) {
|
||||||
$table->string('type')->default('version');
|
$table->string('type')->default('version');
|
||||||
@ -20,10 +19,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('page_revisions', function (Blueprint $table) {
|
Schema::table('page_revisions', function (Blueprint $table) {
|
||||||
$table->dropColumn('type');
|
$table->dropColumn('type');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->boolean('draft')->default(false);
|
$table->boolean('draft')->default(false);
|
||||||
@ -20,10 +19,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->dropColumn('draft');
|
$table->dropColumn('draft');
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->longText('markdown')->default('');
|
$table->longText('markdown')->default('');
|
||||||
@ -23,10 +22,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->dropColumn('markdown');
|
$table->dropColumn('markdown');
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
$currentRoles = DB::table('roles')->get();
|
$currentRoles = DB::table('roles')->get();
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ return new class extends Migration
|
|||||||
$permId = DB::table('permissions')->insertGetId([
|
$permId = DB::table('permissions')->insertGetId([
|
||||||
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
|
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
|
||||||
'display_name' => $op . ' ' . $entity . 's',
|
'display_name' => $op . ' ' . $entity . 's',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
// Assign view permission to all current roles
|
// Assign view permission to all current roles
|
||||||
foreach ($currentRoles as $role) {
|
foreach ($currentRoles as $role) {
|
||||||
@ -37,10 +37,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Delete the new view permission
|
// Delete the new view permission
|
||||||
$entities = ['Book', 'Page', 'Chapter'];
|
$entities = ['Book', 'Page', 'Chapter'];
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('joint_permissions', function (Blueprint $table) {
|
Schema::create('joint_permissions', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -48,8 +49,8 @@ return new class extends Migration
|
|||||||
'description' => 'The role given to public visitors if allowed',
|
'description' => 'The role given to public visitors if allowed',
|
||||||
'system_name' => 'public',
|
'system_name' => 'public',
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Ensure unique name
|
// Ensure unique name
|
||||||
@ -79,10 +80,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('joint_permissions');
|
Schema::drop('joint_permissions');
|
||||||
|
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('tags', function (Blueprint $table) {
|
Schema::create('tags', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -30,10 +29,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('tags');
|
Schema::drop('tags');
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('page_revisions', function ($table) {
|
Schema::table('page_revisions', function ($table) {
|
||||||
$table->string('summary')->nullable();
|
$table->string('summary')->nullable();
|
||||||
@ -18,10 +17,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('page_revisions', function ($table) {
|
Schema::table('page_revisions', function ($table) {
|
||||||
$table->dropColumn('summary');
|
$table->dropColumn('summary');
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Remove the hidden property from roles
|
// Remove the hidden property from roles
|
||||||
Schema::table('roles', function (Blueprint $table) {
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
@ -29,8 +29,8 @@ return new class extends Migration
|
|||||||
'name' => 'Guest',
|
'name' => 'Guest',
|
||||||
'system_name' => 'public',
|
'system_name' => 'public',
|
||||||
'email_confirmed' => true,
|
'email_confirmed' => true,
|
||||||
'created_at' => \Carbon\Carbon::now(),
|
'created_at' => Carbon::now(),
|
||||||
'updated_at' => \Carbon\Carbon::now(),
|
'updated_at' => Carbon::now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Get the public role
|
// Get the public role
|
||||||
@ -45,10 +45,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', function (Blueprint $table) {
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
$table->boolean('hidden')->default(false);
|
$table->boolean('hidden')->default(false);
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('attachments', function (Blueprint $table) {
|
Schema::create('attachments', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -40,8 +40,8 @@ return new class extends Migration
|
|||||||
$permissionId = DB::table('role_permissions')->insertGetId([
|
$permissionId = DB::table('role_permissions')->insertGetId([
|
||||||
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
|
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
|
||||||
'display_name' => $op . ' ' . $entity . 's',
|
'display_name' => $op . ' ' . $entity . 's',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
DB::table('permission_role')->insert([
|
DB::table('permission_role')->insert([
|
||||||
'role_id' => $adminRoleId,
|
'role_id' => $adminRoleId,
|
||||||
@ -52,10 +52,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('attachments');
|
Schema::dropIfExists('attachments');
|
||||||
|
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('cache', function (Blueprint $table) {
|
Schema::create('cache', function (Blueprint $table) {
|
||||||
$table->string('key')->unique();
|
$table->string('key')->unique();
|
||||||
@ -22,10 +20,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('cache');
|
Schema::dropIfExists('cache');
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('sessions', function (Blueprint $table) {
|
Schema::create('sessions', function (Blueprint $table) {
|
||||||
$table->string('id')->unique();
|
$table->string('id')->unique();
|
||||||
@ -25,10 +23,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('sessions');
|
Schema::dropIfExists('sessions');
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('search_terms', function (Blueprint $table) {
|
Schema::create('search_terms', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -27,9 +25,9 @@ return new class extends Migration
|
|||||||
});
|
});
|
||||||
|
|
||||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||||
$pages = $sm->listTableDetails('pages');
|
$pages = $sm->introspectTable('pages');
|
||||||
$books = $sm->listTableDetails('books');
|
$books = $sm->introspectTable('books');
|
||||||
$chapters = $sm->listTableDetails('chapters');
|
$chapters = $sm->introspectTable('chapters');
|
||||||
|
|
||||||
if ($pages->hasIndex('search')) {
|
if ($pages->hasIndex('search')) {
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
@ -55,10 +53,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// This was removed for v0.24 since these indexes are removed anyway
|
// This was removed for v0.24 since these indexes are removed anyway
|
||||||
// and will cause issues for db engines that don't support such indexes.
|
// and will cause issues for db engines that don't support such indexes.
|
||||||
|
@ -2,16 +2,15 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->integer('revision_count');
|
$table->integer('revision_count');
|
||||||
@ -29,10 +28,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->dropColumn('revision_count');
|
$table->dropColumn('revision_count');
|
||||||
|
@ -6,8 +6,6 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
@ -18,8 +16,6 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('comments', function (Blueprint $table) {
|
Schema::create('comments', function (Blueprint $table) {
|
||||||
$table->increments('id')->unsigned();
|
$table->increments('id')->unsigned();
|
||||||
@ -37,8 +37,8 @@ return new class extends Migration
|
|||||||
$permissionId = DB::table('role_permissions')->insertGetId([
|
$permissionId = DB::table('role_permissions')->insertGetId([
|
||||||
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
|
'name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)),
|
||||||
'display_name' => $op . ' ' . $entity . 's',
|
'display_name' => $op . ' ' . $entity . 's',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
DB::table('permission_role')->insert([
|
DB::table('permission_role')->insert([
|
||||||
'role_id' => $adminRoleId,
|
'role_id' => $adminRoleId,
|
||||||
@ -50,10 +50,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('comments');
|
Schema::dropIfExists('comments');
|
||||||
// Delete comment role permissions
|
// Delete comment role permissions
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('books', function (Blueprint $table) {
|
Schema::table('books', function (Blueprint $table) {
|
||||||
$table->integer('image_id')->nullable()->default(null);
|
$table->integer('image_id')->nullable()->default(null);
|
||||||
@ -20,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('books', function (Blueprint $table) {
|
Schema::table('books', function (Blueprint $table) {
|
||||||
$table->dropColumn('image_id');
|
$table->dropColumn('image_id');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', function (Blueprint $table) {
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
$table->string('external_auth_id', 180)->default('');
|
$table->string('external_auth_id', 180)->default('');
|
||||||
@ -21,10 +19,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', function (Blueprint $table) {
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
$table->dropColumn('external_auth_id');
|
$table->dropColumn('external_auth_id');
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@ -9,10 +10,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
// Convert the existing entity tables to InnoDB.
|
// Convert the existing entity tables to InnoDB.
|
||||||
@ -83,8 +82,8 @@ return new class extends Migration
|
|||||||
$permId = DB::table('role_permissions')->insertGetId([
|
$permId = DB::table('role_permissions')->insertGetId([
|
||||||
'name' => 'bookshelf-' . $dbOpName,
|
'name' => 'bookshelf-' . $dbOpName,
|
||||||
'display_name' => $op . ' ' . 'BookShelves',
|
'display_name' => $op . ' ' . 'BookShelves',
|
||||||
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rowsToInsert = $roleIdsWithBookPermission->filter(function ($roleId) {
|
$rowsToInsert = $roleIdsWithBookPermission->filter(function ($roleId) {
|
||||||
@ -103,10 +102,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Drop created permissions
|
// Drop created permissions
|
||||||
$ops = ['bookshelf-create-all', 'bookshelf-create-own', 'bookshelf-delete-all', 'bookshelf-delete-own', 'bookshelf-update-all', 'bookshelf-update-own', 'bookshelf-view-all', 'bookshelf-view-own'];
|
$ops = ['bookshelf-create-all', 'bookshelf-create-own', 'bookshelf-delete-all', 'bookshelf-delete-own', 'bookshelf-update-all', 'bookshelf-update-own', 'bookshelf-view-all', 'bookshelf-view-own'];
|
||||||
|
@ -3,16 +3,15 @@
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->boolean('template')->default(false);
|
$table->boolean('template')->default(false);
|
||||||
@ -35,10 +34,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->dropColumn('template');
|
$table->dropColumn('template');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('user_invites', function (Blueprint $table) {
|
Schema::create('user_invites', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -23,10 +21,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('user_invites');
|
Schema::dropIfExists('user_invites');
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,15 @@
|
|||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
// Add API tokens table
|
// Add API tokens table
|
||||||
@ -42,10 +41,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Remove API tokens table
|
// Remove API tokens table
|
||||||
Schema::dropIfExists('api_tokens');
|
Schema::dropIfExists('api_tokens');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('joint_permissions', function (Blueprint $table) {
|
Schema::table('joint_permissions', function (Blueprint $table) {
|
||||||
$table->dropColumn('id');
|
$table->dropColumn('id');
|
||||||
@ -21,10 +19,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('joint_permissions', function (Blueprint $table) {
|
Schema::table('joint_permissions', function (Blueprint $table) {
|
||||||
$table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']);
|
$table->dropPrimary(['role_id', 'entity_type', 'entity_id', 'action']);
|
||||||
|
@ -9,10 +9,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', function (Blueprint $table) {
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
$table->dropColumn('name');
|
$table->dropColumn('name');
|
||||||
@ -21,10 +19,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', function (Blueprint $table) {
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
$table->string('name')->index();
|
$table->string('name')->index();
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('activities', function (Blueprint $table) {
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
$table->index('key');
|
$table->index('key');
|
||||||
@ -21,10 +19,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('activities', function (Blueprint $table) {
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
$table->dropIndex('activities_key_index');
|
$table->dropIndex('activities_key_index');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('bookshelves', function (Blueprint $table) {
|
Schema::table('bookshelves', function (Blueprint $table) {
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
@ -29,10 +27,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('bookshelves', function (Blueprint $table) {
|
Schema::table('bookshelves', function (Blueprint $table) {
|
||||||
$table->dropSoftDeletes();
|
$table->dropSoftDeletes();
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('deletions', function (Blueprint $table) {
|
Schema::create('deletions', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -28,10 +26,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('deletions');
|
Schema::dropIfExists('deletions');
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('activities', function (Blueprint $table) {
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
$table->renameColumn('key', 'type');
|
$table->renameColumn('key', 'type');
|
||||||
@ -32,10 +30,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
DB::table('activities')
|
DB::table('activities')
|
||||||
->whereNull('entity_id')
|
->whereNull('entity_id')
|
||||||
|
@ -9,10 +9,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
$tables = ['pages', 'books', 'chapters', 'bookshelves'];
|
$tables = ['pages', 'books', 'chapters', 'bookshelves'];
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
@ -30,10 +28,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
$tables = ['pages', 'books', 'chapters', 'bookshelves'];
|
$tables = ['pages', 'books', 'chapters', 'bookshelves'];
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('settings', function (Blueprint $table) {
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
$table->string('type', 50)->default('string');
|
$table->string('type', 50)->default('string');
|
||||||
@ -20,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('settings', function (Blueprint $table) {
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
$table->dropColumn('type');
|
$table->dropColumn('type');
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@ -9,10 +10,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('slug', 180);
|
$table->string('slug', 180);
|
||||||
@ -38,10 +37,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn('slug');
|
$table->dropColumn('slug');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('favourites', function (Blueprint $table) {
|
Schema::create('favourites', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -26,10 +24,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('favourites');
|
Schema::dropIfExists('favourites');
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('mfa_values', function (Blueprint $table) {
|
Schema::create('mfa_values', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -24,10 +22,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('mfa_values');
|
Schema::dropIfExists('mfa_values');
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', function (Blueprint $table) {
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
$table->boolean('mfa_enforced');
|
$table->boolean('mfa_enforced');
|
||||||
@ -20,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('roles', function (Blueprint $table) {
|
Schema::table('roles', function (Blueprint $table) {
|
||||||
$table->dropColumn('mfa_enforced');
|
$table->dropColumn('mfa_enforced');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Create new templates-manage permission and assign to admin role
|
// Create new templates-manage permission and assign to admin role
|
||||||
$roles = DB::table('roles')->get('id');
|
$roles = DB::table('roles')->get('id');
|
||||||
@ -34,10 +32,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Remove content-export permission
|
// Remove content-export permission
|
||||||
$contentExportPermission = DB::table('role_permissions')
|
$contentExportPermission = DB::table('role_permissions')
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('activities', function (Blueprint $table) {
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
$table->string('ip', 45)->after('user_id');
|
$table->string('ip', 45)->after('user_id');
|
||||||
@ -20,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('activities', function (Blueprint $table) {
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
$table->dropColumn('ip');
|
$table->dropColumn('ip');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('activities', function (Blueprint $table) {
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
$table->index('ip', 'activities_ip_index');
|
$table->index('ip', 'activities_ip_index');
|
||||||
@ -20,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('activities', function (Blueprint $table) {
|
Schema::table('activities', function (Blueprint $table) {
|
||||||
$table->dropIndex('activities_ip_index');
|
$table->dropIndex('activities_ip_index');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('webhooks', function (Blueprint $table) {
|
Schema::create('webhooks', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
@ -37,10 +35,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('webhooks');
|
Schema::dropIfExists('webhooks');
|
||||||
Schema::dropIfExists('webhook_tracked_events');
|
Schema::dropIfExists('webhook_tracked_events');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('jobs', function (Blueprint $table) {
|
Schema::create('jobs', function (Blueprint $table) {
|
||||||
$table->bigIncrements('id');
|
$table->bigIncrements('id');
|
||||||
@ -26,10 +24,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('jobs');
|
Schema::dropIfExists('jobs');
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@ -26,10 +24,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('failed_jobs');
|
Schema::dropIfExists('failed_jobs');
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('webhooks', function (Blueprint $table) {
|
Schema::table('webhooks', function (Blueprint $table) {
|
||||||
$table->unsignedInteger('timeout')->default(3);
|
$table->unsignedInteger('timeout')->default(3);
|
||||||
@ -23,10 +21,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('webhooks', function (Blueprint $table) {
|
Schema::table('webhooks', function (Blueprint $table) {
|
||||||
$table->dropColumn('timeout');
|
$table->dropColumn('timeout');
|
||||||
|
@ -10,10 +10,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Add the new 'editor' column to the pages table
|
// Add the new 'editor' column to the pages table
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
@ -46,10 +44,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Drop the new column from the pages table
|
// Drop the new column from the pages table
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
|
@ -32,10 +32,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
foreach ($this->columnsByTable as $table => $column) {
|
foreach ($this->columnsByTable as $table => $column) {
|
||||||
foreach ($this->changeMap as $oldVal => $newVal) {
|
foreach ($this->changeMap as $oldVal => $newVal) {
|
||||||
@ -48,10 +46,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
foreach ($this->columnsByTable as $table => $column) {
|
foreach ($this->columnsByTable as $table => $column) {
|
||||||
foreach ($this->changeMap as $oldVal => $newVal) {
|
foreach ($this->changeMap as $oldVal => $newVal) {
|
||||||
|
@ -9,10 +9,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
DB::table('joint_permissions')
|
DB::table('joint_permissions')
|
||||||
->where('action', '!=', 'view')
|
->where('action', '!=', 'view')
|
||||||
@ -27,10 +25,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('joint_permissions', function (Blueprint $table) {
|
Schema::table('joint_permissions', function (Blueprint $table) {
|
||||||
$table->string('action');
|
$table->string('action');
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('references', function (Blueprint $table) {
|
Schema::create('references', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@ -24,10 +22,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('references');
|
Schema::dropIfExists('references');
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// This updates the 'type' field for images, uploaded as shelf cover images,
|
// This updates the 'type' field for images, uploaded as shelf cover images,
|
||||||
// to be cover_bookshelf instead of cover_book.
|
// to be cover_bookshelf instead of cover_book.
|
||||||
@ -32,10 +30,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
DB::table('images')
|
DB::table('images')
|
||||||
->where('type', '=', 'cover_bookshelf')
|
->where('type', '=', 'cover_bookshelf')
|
||||||
|
@ -10,10 +10,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Remove entries for non-existing roles (Caused by previous lack of deletion handling)
|
// Remove entries for non-existing roles (Caused by previous lack of deletion handling)
|
||||||
$roleIds = DB::table('roles')->pluck('id');
|
$roleIds = DB::table('roles')->pluck('id');
|
||||||
@ -63,10 +61,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Create old table structure for entity_permissions
|
// Create old table structure for entity_permissions
|
||||||
Schema::create('old_entity_permissions', function (Blueprint $table) {
|
Schema::create('old_entity_permissions', function (Blueprint $table) {
|
||||||
|
@ -11,10 +11,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Remove entity-permissions on non-restricted entities
|
// Remove entity-permissions on non-restricted entities
|
||||||
$deleteInactiveEntityPermissions = function (string $table, string $morphClass) {
|
$deleteInactiveEntityPermissions = function (string $table, string $morphClass) {
|
||||||
@ -61,10 +59,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Create restricted columns
|
// Create restricted columns
|
||||||
$createRestrictedColumn = fn(Blueprint $table) => $table->boolean('restricted')->index()->default(0);
|
$createRestrictedColumn = fn(Blueprint $table) => $table->boolean('restricted')->index()->default(0);
|
||||||
|
@ -10,10 +10,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Truncate before schema changes to avoid performance issues
|
// Truncate before schema changes to avoid performance issues
|
||||||
// since we'll need to rebuild anyway.
|
// since we'll need to rebuild anyway.
|
||||||
@ -34,10 +32,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
DB::table('joint_permissions')->truncate();
|
DB::table('joint_permissions')->truncate();
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
$colorSettings = [
|
$colorSettings = [
|
||||||
'app-color',
|
'app-color',
|
||||||
@ -45,10 +43,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
$colorSettings = [
|
$colorSettings = [
|
||||||
'app-color-dark',
|
'app-color-dark',
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('attachments', function (Blueprint $table) {
|
Schema::table('attachments', function (Blueprint $table) {
|
||||||
$table->text('path')->change();
|
$table->text('path')->change();
|
||||||
@ -20,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('attachments', function (Blueprint $table) {
|
Schema::table('attachments', function (Blueprint $table) {
|
||||||
$table->string('path')->change();
|
$table->string('path')->change();
|
||||||
|
@ -8,10 +8,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->index('updated_at', 'pages_updated_at_index');
|
$table->index('updated_at', 'pages_updated_at_index');
|
||||||
@ -20,10 +18,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('pages', function (Blueprint $table) {
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
$table->dropIndex('pages_updated_at_index');
|
$table->dropIndex('pages_updated_at_index');
|
||||||
|
@ -7,10 +7,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
$guestUserId = DB::table('users')
|
$guestUserId = DB::table('users')
|
||||||
->where('system_name', '=', 'public')
|
->where('system_name', '=', 'public')
|
||||||
@ -36,8 +34,6 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
|
@ -7,8 +7,6 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
@ -20,8 +18,6 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// Create new receive-notifications permission and assign to admin role
|
// Create new receive-notifications permission and assign to admin role
|
||||||
$permissionId = DB::table('role_permissions')->insertGetId([
|
$permissionId = DB::table('role_permissions')->insertGetId([
|
||||||
@ -29,10 +28,8 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
$permission = DB::table('role_permissions')
|
$permission = DB::table('role_permissions')
|
||||||
->where('name', '=', 'receive-notifications')
|
->where('name', '=', 'receive-notifications')
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user