PluginProbe
Booking for Appointments and Events Calendar – Amelia / 2.4.9
Booking for Appointments and Events Calendar – Amelia v2.4.9
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 All 59 releases
ameliabooking / src / Infrastructure / WP / InstallActions / DB / User / UsersTable.php
UsersTable.php
76 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AmeliaBooking\Infrastructure\WP\InstallActions\DB\User;
4
5 use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException;
6 use AmeliaBooking\Domain\ValueObjects\Picture;
7 use AmeliaBooking\Domain\ValueObjects\String\Description;
8 use AmeliaBooking\Domain\ValueObjects\String\Email;
9 use AmeliaBooking\Domain\ValueObjects\String\Name;
10 use AmeliaBooking\Domain\ValueObjects\String\Password;
11 use AmeliaBooking\Domain\ValueObjects\String\Phone;
12 use AmeliaBooking\Infrastructure\WP\InstallActions\DB\AbstractDatabaseTable;
13
14 /**
15 * Class UsersTable
16 *
17 * @package AmeliaBooking\Infrastructure\WP\InstallActions\DB\User
18 */
19 class UsersTable extends AbstractDatabaseTable
20 {
21 public const TABLE = 'users';
22
23 /**
24 * @return string
25 * @throws InvalidArgumentException
26 */
27 public static function buildTable()
28 {
29 $table = self::getTableName();
30
31 $charsetCollate = self::getCharsetCollate();
32
33 $name = Name::MAX_LENGTH;
34 $email = Email::MAX_LENGTH;
35 $phone = Phone::MAX_LENGTH;
36 $picture = Picture::MAX_LENGTH;
37 $password = Password::MAX_LENGTH;
38 $description = Description::MAX_LENGTH;
39
40 return "CREATE TABLE {$table} (
41 `id` int(11) NOT NULL AUTO_INCREMENT,
42 `status` ENUM('hidden', 'visible', 'disabled', 'blocked') NOT NULL default 'visible',
43 `type` ENUM('customer', 'provider', 'manager', 'admin') NOT NULL,
44 `externalId` bigint(20) DEFAULT NULL,
45 `firstName` varchar({$name}) NOT NULL DEFAULT '',
46 `lastName` varchar({$name}) NOT NULL DEFAULT '',
47 `email` varchar({$email}) DEFAULT NULL,
48 `birthday` date DEFAULT NULL,
49 `phone` varchar({$phone}) DEFAULT NULL,
50 `gender` ENUM('male', 'female') DEFAULT NULL,
51 `note` text,
52 `description` text NULL DEFAULT NULL,
53 `pictureFullPath` varchar ({$picture}) NULL,
54 `pictureThumbPath` varchar ({$picture}) NULL,
55 `password` varchar ({$password}) NULL,
56 `usedTokens` text NULL,
57 `zoomUserId` varchar({$name}) DEFAULT NULL,
58 `stripeConnect` varchar({$name}) DEFAULT NULL,
59 `countryPhoneIso` varchar(2) DEFAULT NULL,
60 `translations` TEXT NULL DEFAULT NULL,
61 `customFields` TEXT NULL DEFAULT NULL,
62 `timeZone` varchar({$name}) DEFAULT NULL,
63 `appleCalendarId` varchar({$name}) DEFAULT NULL,
64 `employeeAppleCalendar` TEXT NULL DEFAULT NULL,
65 `googleCalendarId` varchar({$name}) DEFAULT NULL,
66 `outlookCalendarId` varchar({$name}) DEFAULT NULL,
67 `badgeId` int(11) DEFAULT NULL,
68 `error` TEXT({$description}) DEFAULT NULL,
69 `show` TINYINT(1) DEFAULT 1,
70 PRIMARY KEY (`id`),
71 UNIQUE KEY `email` (`email`),
72 UNIQUE KEY `id` (`id`)
73 ) {$charsetCollate}";
74 }
75 }
76