PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.3
ShopBuilder – WooCommerce Builder For Elementor v3.2.3
3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.3.0 All 62 releases
shopbuilder / app / AI / DB / CreateTableForAi.php

CreateTableForAi.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.3, at app/AI/DB/CreateTableForAi.php

47 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * AI Initialization Class.
4 *
5 * Handles AI-related module setup, including meta boxes, assets, and AJAX actions.
6 *
7 * @package RadiusTheme\SB
8 */
9
10 namespace RadiusTheme\SB\AI\DB;
11
12 use RadiusTheme\SB\AI\AIFns;
13 use RadiusTheme\SB\Helpers\Fns;
14 use RadiusTheme\SB\Traits\SingletonTrait;
15
16 defined( 'ABSPATH' ) || exit();
17
18 /**
19 * Initializes AI module components.
20 */
21 class CreateTableForAi {
22 /**
23 * Use Singleton trait.
24 */
25 use SingletonTrait;
26
27 /**
28 * @return void
29 */
30 public function create_ai_embeddings_table() {
31 global $wpdb;
32 $is_table_exist = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->prefix . AIFns::$ai_embeddings_table ) ); //phpcs:ignore
33 if ( ! empty( $is_table_exist ) ) {
34 return;
35 }
36 Fns::DB()::create( AIFns::$ai_embeddings_table )->column( 'id' )->bigInt( 20 )->unsigned()->autoIncrement()->primary()->required()
37 ->column( 'product_id' )->bigInt( 20 )->unsigned()->required()
38 ->column( 'title' )->text()->required()
39 ->column( 'embedding' )->longText()->required()
40 ->column( 'info' )->string()->nullable()
41 ->column( 'created_at' )->dateTime()
42 ->column( 'updated_at' )->dateTime()
43 ->index( [ 'product_id' ] )
44 ->execute();
45 }
46 }
47