record-action-result-model.php
2 years ago
record-error-model.php
2 years ago
record-field-model.php
2 years ago
record-model.php
2 years ago
record-model.php
60 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Modules\Form_Record\Models; |
| 5 | |
| 6 | use Jet_Form_Builder\Db_Queries\Base_Db_Model; |
| 7 | use Jet_Form_Builder\Migrations\Versions\Version_2_1_7; |
| 8 | use Jet_Form_Builder\Migrations\Versions\Version_3_1_7; |
| 9 | |
| 10 | // If this file is called directly, abort. |
| 11 | if ( ! defined( 'WPINC' ) ) { |
| 12 | die; |
| 13 | } |
| 14 | |
| 15 | class Record_Model extends Base_Db_Model { |
| 16 | |
| 17 | public static function table_name(): string { |
| 18 | return 'records'; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * @since 2.1.7 https://github.com/Crocoblock/issues-tracker/issues/1476 |
| 23 | * |
| 24 | * @return string[] |
| 25 | */ |
| 26 | public static function schema(): array { |
| 27 | return array( |
| 28 | 'id' => 'bigint(20) NOT NULL AUTO_INCREMENT', |
| 29 | 'form_id' => 'bigint(20) UNSIGNED NOT NULL', |
| 30 | 'user_id' => 'bigint(20)', |
| 31 | 'from_content_id' => 'bigint(20) NOT NULL', |
| 32 | 'from_content_type' => 'varchar(20) NOT NULL', |
| 33 | 'status' => 'varchar(255)', |
| 34 | 'ip_address' => 'varchar(255)', |
| 35 | 'user_agent' => 'text', |
| 36 | 'referrer' => 'text', |
| 37 | 'submit_type' => 'varchar(20)', |
| 38 | 'is_viewed' => 'tinyint(1)', |
| 39 | 'created_at' => 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP', |
| 40 | 'updated_at' => 'TIMESTAMP', |
| 41 | ); |
| 42 | } |
| 43 | |
| 44 | public static function schema_keys(): array { |
| 45 | return array( |
| 46 | 'id' => 'primary key', |
| 47 | 'form_id' => 'index', |
| 48 | 'user_id' => 'index', |
| 49 | ); |
| 50 | } |
| 51 | |
| 52 | public function related_migrations(): array { |
| 53 | return array( |
| 54 | new Version_2_1_7(), |
| 55 | new Version_3_1_7(), |
| 56 | ); |
| 57 | } |
| 58 | |
| 59 | } |
| 60 |