PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / libraries / framework / Database / Schema / Definitions / ForeignKeyDefinition.php
kirki / libraries / framework / Database / Schema / Definitions Last commit date
Definition.php 3 weeks ago ForeignKeyDefinition.php 3 weeks ago
ForeignKeyDefinition.php
115 lines
1 <?php
2
3 /**
4 * Defines a foreign key constraint with configurable ON UPDATE and ON DELETE actions.
5 * Links local and referenced columns while expressing referential integrity rules in schema migrations.
6 * Integrates with the structure builder when declaring relational table constraints.
7 * Allows setting actions such as CASCADE, RESTRICT, SET NULL, and NO ACTION for both update and delete events.
8 *
9 * @package Framework
10 * @subpackage Database\Schema\Definitions
11 * @since 1.0.0
12 */
13 namespace Kirki\Framework\Database\Schema\Definitions;
14
15 \defined('ABSPATH') || exit;
16 /**
17 * Define the foreign key constraint of the database schema.
18 *
19 * @method $this on(string $table)
20 * @method $this on_update(string $action)
21 * @method $this on_delete(string $action)
22 * @method $this references(string $references)
23 */
24 class ForeignKeyDefinition extends Definition
25 {
26 /**
27 * Set ON UPDATE action to CASCADE.
28 *
29 * @return $this
30 *
31 * @since 1.0.0
32 */
33 public function cascade_on_update()
34 {
35 return $this->on_update('cascade');
36 }
37 /**
38 * Set ON DELETE action to CASCADE.
39 *
40 * @return $this
41 *
42 * @since 1.0.0
43 */
44 public function cascade_on_delete()
45 {
46 return $this->on_delete('cascade');
47 }
48 /**
49 * Set ON UPDATE action to RESTRICT.
50 *
51 * @return $this
52 *
53 * @since 1.0.0
54 */
55 public function restrict_on_update()
56 {
57 return $this->on_update('restrict');
58 }
59 /**
60 * Set ON DELETE action to RESTRICT.
61 *
62 * @return $this
63 *
64 * @since 1.0.0
65 */
66 public function restrict_on_delete()
67 {
68 return $this->on_delete('restrict');
69 }
70 /**
71 * Set ON UPDATE action to SET NULL.
72 *
73 * @return $this
74 *
75 * @since 1.0.0
76 */
77 public function null_on_update()
78 {
79 return $this->on_update('set null');
80 }
81 /**
82 * Set ON DELETE action to SET NULL.
83 *
84 * @return $this
85 *
86 * @since 1.0.0
87 */
88 public function null_on_delete()
89 {
90 return $this->on_delete('set null');
91 }
92 /**
93 * Set ON UPDATE action to NO ACTION.
94 *
95 * @return $this
96 *
97 * @since 1.0.0
98 */
99 public function no_action_on_update()
100 {
101 return $this->on_update('no action');
102 }
103 /**
104 * Set ON DELETE action to NO ACTION.
105 *
106 * @return $this
107 *
108 * @since 1.0.0
109 */
110 public function no_action_on_delete()
111 {
112 return $this->on_delete('no action');
113 }
114 }
115