Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/fluentform/database/Migrations/Forms.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
namespace FluentForm\Database\Migrations;
4
+
5
+
class Forms
6
+
{
7
+
/**
8
+
* Migrate the table.
9
+
*
10
+
* @return void
11
+
*/
12
+
public static function migrate()
13
+
{
14
+
global $wpdb;
15
+
16
+
$charsetCollate = $wpdb->get_charset_collate();
17
+
18
+
$table = $wpdb->prefix . 'fluentform_forms';
19
+
20
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Migration file, direct query needed
21
+
if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $table)) != $table) {
22
+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- Migration file, schema change is the purpose
23
+
$sql = "CREATE TABLE $table (
24
+
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
25
+
`title` VARCHAR(255) NOT NULL,
26
+
`status` VARCHAR(45) NULL DEFAULT 'Draft',
27
+
`appearance_settings` TEXT NULL,
28
+
`form_fields` LONGTEXT NULL,
29
+
`has_payment` TINYINT(1) NOT NULL DEFAULT 0,
30
+
`type` VARCHAR(45) NULL,
31
+
`conditions` TEXT NULL,
32
+
`created_by` INT NULL,
33
+
`created_at` TIMESTAMP NULL,
34
+
`updated_at` TIMESTAMP NULL,
35
+
PRIMARY KEY (`id`)) $charsetCollate;";
36
+
37
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
38
+
39
+
dbDelta($sql);
40
+
}
41
+
}
42
+
}
43
+