Logs.php
55 lines
| 1 | <?php |
| 2 | /** |
| 3 | * GDPR compliance logs table. |
| 4 | * |
| 5 | * @package Tutor\GDPR\DB |
| 6 | * @author Themeum <support@themeum.com> |
| 7 | * @link https://themeum.com |
| 8 | * @since 4.0.0 |
| 9 | */ |
| 10 | |
| 11 | namespace Tutor\GDPR\DB; |
| 12 | |
| 13 | defined( 'ABSPATH' ) || exit; |
| 14 | |
| 15 | /** |
| 16 | * Consents table class. |
| 17 | */ |
| 18 | class Logs extends DB { |
| 19 | |
| 20 | /** |
| 21 | * Get table name. |
| 22 | * |
| 23 | * @since 4.0.0 |
| 24 | * |
| 25 | * @return string |
| 26 | */ |
| 27 | public static function get_table_name() { |
| 28 | global $wpdb; |
| 29 | return $wpdb->prefix . 'tutor_legal_consent_logs'; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Get create table schema. |
| 34 | * |
| 35 | * @since 4.0.0 |
| 36 | * |
| 37 | * @return string |
| 38 | */ |
| 39 | public static function get_schema() { |
| 40 | global $wpdb; |
| 41 | |
| 42 | $table_name = static::get_table_name(); |
| 43 | $charset_collate = $wpdb->get_charset_collate(); |
| 44 | |
| 45 | return "CREATE TABLE {$table_name} ( |
| 46 | id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, |
| 47 | legal_consent_id BIGINT UNSIGNED NOT NULL, |
| 48 | action VARCHAR(50), -- created, updated, deleted |
| 49 | old_data JSON NULL, |
| 50 | new_data JSON NULL, |
| 51 | created_at_gmt DATETIME NOT NULL |
| 52 | ) {$charset_collate};"; |
| 53 | } |
| 54 | } |
| 55 |