Some checks failed
CI / Coding Standards (push) Failing after 2m31s
CI / PHPStan (push) Failing after 50s
CI / Tests (PHP 8.1) (push) Successful in 50s
CI / Tests (PHP 8.2) (push) Successful in 48s
CI / Tests (PHP 8.3) (push) Successful in 40s
CI / No Debug Code (push) Successful in 2s
- Custom DB tables for availability slots and lesson bookings - Instructor (wp-admin) and student (front-end) roles with custom capabilities - REST API under us-scheduler/v1 for availability CRUD and booking - [us_booking] and [us_student_login] shortcodes for student front end - PHPUnit + Brain\Monkey unit test suite (29 tests) - Gitea Actions CI: lint, PHPStan, tests on PHP 8.1/8.2/8.3, no-debug check - Feature docs under docs/features/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Unsupervised\Schedular\Data;
|
|
|
|
class Schema
|
|
{
|
|
/**
|
|
* Returns CREATE TABLE statements for dbDelta.
|
|
*
|
|
* @return list<string>
|
|
*/
|
|
public static function tables(string $prefix, string $charset): array
|
|
{
|
|
return [
|
|
"CREATE TABLE {$prefix}us_availability (
|
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
instructor_id BIGINT UNSIGNED NOT NULL,
|
|
start_dt DATETIME NOT NULL,
|
|
end_dt DATETIME NOT NULL,
|
|
is_booked TINYINT(1) NOT NULL DEFAULT 0,
|
|
created_at DATETIME NOT NULL,
|
|
PRIMARY KEY (id),
|
|
KEY instructor_id (instructor_id),
|
|
KEY start_dt (start_dt)
|
|
) {$charset};",
|
|
|
|
"CREATE TABLE {$prefix}us_lessons (
|
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
slot_id BIGINT UNSIGNED NOT NULL,
|
|
student_id BIGINT UNSIGNED NOT NULL,
|
|
instructor_id BIGINT UNSIGNED NOT NULL,
|
|
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
|
notes TEXT,
|
|
created_at DATETIME NOT NULL,
|
|
PRIMARY KEY (id),
|
|
KEY slot_id (slot_id),
|
|
KEY student_id (student_id),
|
|
KEY instructor_id (instructor_id)
|
|
) {$charset};",
|
|
];
|
|
}
|
|
}
|