ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestSetupDeclarationModule8" setup_version="1.0.0" />
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestSetupDeclarationModule8') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestSetupDeclarationModule8', __DIR__);
}
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="test_table" resource="default">
<index referenceId="TEST_TABLE_INDEX_VARCHAR" disabled="1"/>
</table>
</schema>
@@ -0,0 +1,7 @@
{
"test_table": {
"index": {
"TEST_TABLE_VARCHAR": true
}
}
}
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestSetupDeclarationModule8">
<sequence>
<module name="Magento_TestSetupDeclarationModule1" />
</sequence>
</module>
</config>
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="reference_table" resource="default">
<column xsi:type="tinyint" name="tinyint_ref" padding="7" nullable="false" identity="true" unsigned="false"/>
<column xsi:type="tinyint" name="tinyint_without_padding" default="0" nullable="false" unsigned="false"/>
<column xsi:type="bigint" name="bigint_without_padding" default="0" nullable="false" unsigned="false"/>
<column xsi:type="smallint" name="smallint_without_padding" default="0" nullable="false" unsigned="false"/>
<column xsi:type="int" name="integer_without_padding" default="0" nullable="false" unsigned="false"/>
<column xsi:type="smallint" name="smallint_with_big_padding" padding="254" default="0" nullable="false"
unsigned="false"/>
<constraint xsi:type="primary" referenceId="tinyint_primary">
<column name="tinyint_ref"/>
</constraint>
<index referenceId="COMPLEX_INDEX" indexType="btree">
<column name="tinyint_without_padding"/>
<column name="bigint_without_padding"/>
</index>
</table>
<table name="auto_increment_test" resource="default">
<column xsi:type="int" name="int_auto_increment_with_nullable" identity="true" padding="12" unsigned="true"
nullable="true"/>
<column xsi:type="smallint" name="int_disabled_auto_increment" default="0" identity="false" padding="12"
unsigned="true" nullable="true"/>
<constraint xsi:type="unique" referenceId="AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE">
<column name="int_auto_increment_with_nullable"/>
</constraint>
</table>
</schema>
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="test_table" resource="default" comment="Test Table">
<column xsi:type="int" name="page_id" nullable="true" unsigned="true" identity="true"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="page_id"/>
</constraint>
</table>
<table name="dependent" resource="default" comment="Lol">
<column xsi:type="float" name="page_id_on" nullable="true" unsigned="true"/>
<constraint xsi:type="foreign" referenceId="FOREIGN" table="dependent" column="page_id_on" referenceColumn="page_id"
referenceTable="test_table"/>
</table>
</schema>
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="test_table" resource="default" comment="Test Table">
<column xsi:type="int" name="page_id" nullable="false" unsigned="false" identity="true"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="page_id"/>
</constraint>
</table>
<table name="dependent" resource="default" comment="Lol">
<column xsi:type="int" name="page_id_on" nullable="true" unsigned="true"/>
<constraint xsi:type="foreign" referenceId="FOREIGN" table="dependent" column="page_id_on" referenceColumn="page_id"
referenceTable="test_table"/>
</table>
</schema>
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="test_table" resource="default" comment="Test Table">
<column xsi:type="int" name="page_id" nullable="false" identity="true" />
</table>
</schema>
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="test_table" resource="default" comment="Test Table">
<column xsi:type="int" name="page_id" nullable="false" identity="true" />
<column xsi:type="varchar" name="email" nullable="true" />
<column xsi:type="varchar" name="title" />
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="page_id" />
<column name="email" />
</constraint>
</table>
</schema>
@@ -0,0 +1,334 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestSetupDeclarationModule8\Setup;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Ddl\Table;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* Install schema script for the TestSetupDeclarationModule8 module.
*/
class InstallSchema implements InstallSchemaInterface
{
/**
* The name of the main table of Module8.
*/
const MAIN_TABLE = 'module8_test_main_table';
/**
* The name of the second table of Module8.
*/
const SECOND_TABLE = 'module8_test_second_table';
/**
* The name of the second table of Module8.
*/
const TEMP_TABLE = 'module8_test_install_temp_table';
/**
* @inheritdoc
* @throws \Zend_Db_Exception
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$this->createTables($setup);
$setup->endSetup();
}
/**
* Create tables.
*
* @param SchemaSetupInterface $installer
* @throws \Zend_Db_Exception
*/
private function createTables(SchemaSetupInterface $installer)
{
$mainTableName = $installer->getTable(self::MAIN_TABLE);
$this->dropTableIfExists($installer, $mainTableName);
$mainTable = $installer->getConnection()->newTable($mainTableName);
$mainTable->setComment('Main Test Table for Module8');
$this->addColumnsToMainTable($mainTable);
$this->addIndexesToMainTable($mainTable);
$installer->getConnection()->createTable($mainTable);
$secondTableName = $installer->getTable(self::SECOND_TABLE);
$this->dropTableIfExists($installer, $secondTableName);
$secondTable = $installer->getConnection()->newTable($secondTableName);
$secondTable->setComment('Second Test Table for Module8');
$this->addColumnsToSecondTable($secondTable);
$this->addIndexesToSecondTable($secondTable);
$this->addConstraintsToSecondTable($secondTable);
$installer->getConnection()->createTable($secondTable);
$this->createSimpleTable($installer, self::TEMP_TABLE);
}
/**
* Drop existing tables.
*
* @param SchemaSetupInterface $installer
* @param string $table
*/
private function dropTableIfExists($installer, $table)
{
$connection = $installer->getConnection();
if ($connection->isTableExists($installer->getTable($table))) {
$connection->dropTable(
$installer->getTable($table)
);
}
}
/**
* Add tables to main table.
*
* @param Table $table
* @throws \Zend_Db_Exception
*/
private function addColumnsToMainTable($table)
{
$table
->addColumn(
'module8_email_contact_id',
Table::TYPE_INTEGER,
10,
[
'primary' => true,
'identity' => true,
'unsigned' => true,
'nullable' => false
],
'Email Contact ID'
)->addColumn(
'module8_contact_group_id',
Table::TYPE_INTEGER,
10,
[
'unsigned' => true,
'nullable' => false
],
'Contact Group ID'
)->addColumn(
'module8_is_guest',
Table::TYPE_SMALLINT,
null,
[
'unsigned' => true,
'nullable' => true
],
'Is Guest'
)->addColumn(
'module8_contact_id',
Table::TYPE_TEXT,
15,
[
'unsigned' => true,
'nullable' => true
],
'Contact ID'
)->addColumn(
'module8_content',
Table::TYPE_TEXT,
15,
[
'nullable' => false,
],
'Content'
);
}
/**
* Add indexes to main table.
*
* @param Table $table
* @throws \Zend_Db_Exception
*/
private function addIndexesToMainTable($table)
{
$table
->addIndex(
'MODULE8_INSTALL_INDEX_1',
['module8_email_contact_id']
)->addIndex(
'MODULE8_INSTALL_UNIQUE_INDEX_2',
['module8_email_contact_id', 'module8_is_guest'],
['type' => AdapterInterface::INDEX_TYPE_UNIQUE]
)->addIndex(
'MODULE8_INSTALL_INDEX_3',
['module8_is_guest']
)->addIndex(
'MODULE8_INSTALL_INDEX_4',
['module8_contact_id']
)->addIndex(
'MODULE8_INSTALL_INDEX_TEMP',
['module8_content']
)->addIndex(
'MODULE8_INSTALL_UNIQUE_INDEX_TEMP',
['module8_contact_group_id'],
['type' => AdapterInterface::INDEX_TYPE_UNIQUE]
);
}
/**
* Add tables to second table.
*
* @param Table $table
* @throws \Zend_Db_Exception
*/
private function addColumnsToSecondTable($table)
{
$table
->addColumn(
'module8_entity_id',
Table::TYPE_INTEGER,
10,
[
'primary' => true,
'identity' => true,
'unsigned' => true,
'nullable' => false
],
'Entity ID'
)->addColumn(
'module8_contact_id',
Table::TYPE_INTEGER,
null,
[],
'Contact ID'
)->addColumn(
'module8_address',
Table::TYPE_TEXT,
15,
[
'nullable' => false,
],
'Address'
)->addColumn(
'module8_counter_with_multiline_comment',
Table::TYPE_SMALLINT,
null,
[
'unsigned' => true,
'nullable' => true,
'default' => 0
],
'Empty
Counter
Multiline
Comment'
)->addColumn(
'module8_second_address',
Table::TYPE_TEXT,
15,
[
'unsigned' => true,
'nullable' => true
],
'Second Address'
)->addColumn(
'module8_temp_column',
Table::TYPE_TEXT,
15,
[
'unsigned' => true,
'nullable' => true
],
'Temp column for remove'
);
}
/**
* Add indexes to second table.
*
* @param Table $table
* @throws \Zend_Db_Exception
*/
private function addIndexesToSecondTable($table)
{
$table
->addIndex(
'MODULE8_INSTALL_SECOND_TABLE_INDEX_1',
['module8_entity_id']
)->addIndex(
'MODULE8_INSTALL_SECOND_TABLE_INDEX_2',
['module8_address']
)->addIndex(
'MODULE8_INSTALL_SECOND_TABLE_INDEX_3_TEMP',
['module8_second_address']
);
}
/**
* Add constraints to second table.
*
* @param Table $table
* @throws \Zend_Db_Exception
*/
private function addConstraintsToSecondTable($table)
{
$table
->addForeignKey(
'MODULE8_INSTALL_FK_ENTITY_ID_TEST_MAIN_TABLE_EMAIL_CONTACT_ID',
'module8_entity_id',
self::MAIN_TABLE,
'module8_email_contact_id'
)->addForeignKey(
'MODULE8_INSTALL_FK_ADDRESS_TEST_MAIN_TABLE_CONTACT_ID',
'module8_address',
self::MAIN_TABLE,
'module8_contact_id'
)->addForeignKey(
'MODULE8_INSTALL_FK_ADDRESS_TEST_MAIN_TABLE_MODULE8_CONTENT_TEMP',
'module8_address',
self::MAIN_TABLE,
'module8_content'
);
}
/**
* Create a simple table.
*
* @param SchemaSetupInterface $setup
* @param $tableName
* @throws \Zend_Db_Exception
*/
private function createSimpleTable(SchemaSetupInterface $setup, $tableName): void
{
$table = $setup->getConnection()->newTable($tableName);
$table
->addColumn(
'module8_entity_id',
Table::TYPE_INTEGER,
null,
[
'primary' => true,
'identity' => true,
'nullable' => false,
'unsigned' => true,
],
'Entity ID'
)->addColumn(
'module8_counter',
Table::TYPE_INTEGER,
null,
[
'unsigned' => true,
'nullable' => true,
'default' => 100
],
'Counter'
);
$setup->getConnection()->createTable($table);
}
}
@@ -0,0 +1,242 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestSetupDeclarationModule8\Setup;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Ddl\Table;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\UpgradeSchemaInterface;
/**
* Upgrade schema script for the TestSetupDeclarationModule8 module.
*/
class UpgradeSchema implements UpgradeSchemaInterface
{
/**
* The name of the main table of the Module8.
*/
const UPDATE_TABLE = 'module8_test_update_table';
/**
* The name of the temporary table of the Module8.
*/
const TEMP_TABLE = 'module8_test_temp_table';
/**
* @inheritdoc
* @throws \Zend_Db_Exception
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.1', '<')) {
$tableName = $setup->getTable(self::UPDATE_TABLE);
$table = $setup->getConnection()->newTable($tableName);
$table->setComment('Update Test Table for Module8');
$this->addColumns($setup, $table);
$this->addIndexes($table);
$this->addConstraints($table);
$setup->getConnection()->createTable($table);
$this->createSimpleTable($setup, $setup->getTable(self::TEMP_TABLE));
}
if (version_compare($context->getVersion(), '1.0.2', '<')) {
$connection = $setup->getConnection();
$connection
->dropTable(
InstallSchema::TEMP_TABLE
);
$connection
->dropColumn(
InstallSchema::SECOND_TABLE,
'module8_temp_column'
);
$connection
->dropForeignKey(
InstallSchema::SECOND_TABLE,
'MODULE8_INSTALL_FK_ADDRESS_TEST_MAIN_TABLE_MODULE8_CONTENT_TEMP'
);
$connection
->dropIndex(
InstallSchema::MAIN_TABLE,
'MODULE8_INSTALL_INDEX_TEMP'
);
$connection
->dropIndex(
InstallSchema::MAIN_TABLE,
'MODULE8_INSTALL_UNIQUE_INDEX_TEMP'
);
}
$setup->endSetup();
}
/**
* Create columns for tables.
*
* @param SchemaSetupInterface $setup
* @param Table $table
* @throws \Zend_Db_Exception
*/
private function addColumns(SchemaSetupInterface $setup, Table $table): void
{
$table
->addColumn(
'module8_entity_id',
Table::TYPE_INTEGER,
10,
[
'primary' => true,
'unsigned' => true,
'nullable' => false
],
'Entity ID'
)->addColumn(
'module8_entity_row_id',
Table::TYPE_INTEGER,
null,
[
'unsigned' => true,
'nullable' => false
]
)->addColumn(
'module8_is_guest',
Table::TYPE_SMALLINT,
null,
[
'unsigned' => true,
'nullable' => true
],
'Is Guest'
)->addColumn(
'module8_guest_browser_id',
Table::TYPE_SMALLINT,
null,
[
'unsigned' => true,
'nullable' => true
],
'Guest Browser ID'
)->addColumn(
'module8_column_for_remove',
Table::TYPE_SMALLINT,
null,
[
'unsigned' => true,
'nullable' => true
],
'For remove'
);
$setup->getConnection()->addColumn(
InstallSchema::MAIN_TABLE,
'module8_update_column',
[
'type' => Table::TYPE_INTEGER,
'nullable' => false,
'comment' => 'Module_8 Update Column',
]
);
}
/**
* Add indexes.
*
* @param Table $table
* @throws \Zend_Db_Exception
*/
private function addIndexes(Table $table): void
{
$table
->addIndex(
'MODULE8_UPDATE_IS_GUEST_INDEX',
[
'module8_is_guest'
]
)->addIndex(
'MODULE8_UPDATE_UNIQUE_INDEX_TEMP',
[
'module8_entity_id',
'module8_is_guest',
],
['type' => AdapterInterface::INDEX_TYPE_UNIQUE]
)->addIndex(
'MODULE8_UPDATE_TEMP_INDEX',
[
'module8_column_for_remove',
'module8_guest_browser_id'
]
);
}
/**
* Add constraints.
*
* @param Table $table
* @throws \Zend_Db_Exception
*/
private function addConstraints(Table $table): void
{
$table
->addForeignKey(
'MODULE8_UPDATE_FK_MODULE8_IS_GUEST',
'module8_is_guest',
InstallSchema::MAIN_TABLE,
'module8_is_guest',
Table::ACTION_CASCADE
)->addForeignKey(
'MODULE8_UPDATE_FK_TEMP',
'module8_column_for_remove',
InstallSchema::MAIN_TABLE,
'module8_is_guest',
Table::ACTION_CASCADE
);
}
/**
* Create a simple table.
*
* @param SchemaSetupInterface $setup
* @param $tableName
* @throws \Zend_Db_Exception
*/
private function createSimpleTable(SchemaSetupInterface $setup, $tableName): void
{
$table = $setup->getConnection()->newTable($tableName);
$table
->addColumn(
'module8_entity_id',
Table::TYPE_INTEGER,
null,
[
'primary' => true,
'identity' => true,
'nullable' => false,
'unsigned' => true,
],
'Entity ID'
)->addColumn(
'module8_counter',
Table::TYPE_INTEGER,
null,
[
'unsigned' => true,
'nullable' => true,
'default' => 100
],
'Counter'
);
$setup->getConnection()->createTable($table);
}
}
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestSetupDeclarationModule8" setup_version="1.0.2"/>
</config>
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="test_table" resource="default" comment="Test Table">
<column xsi:type="int" name="page_id" nullable="false" unsigned="false" identity="true"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="page_id"/>
</constraint>
</table>
<table name="test_scope_table" resource="default" comment="Test Scope Table">
<column xsi:type="int" name="scope_id" nullable="false" unsigned="false" identity="true"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="scope_id"/>
</constraint>
</table>
<table name="dependent" resource="default" comment="Lol">
<column xsi:type="int" name="page_id_on" nullable="false" unsigned="false"/>
<column xsi:type="int" name="scope_id_on" nullable="false" unsigned="false"/>
<!-- Expected name in DB: DEPENDENT_PAGE_ID_ON_TEST_TABLE_PAGE_ID -->
<constraint xsi:type="foreign" referenceId="DEPENDENT_PAGE_ID_ON_TEST_TABLE_PAGE_ID" table="dependent" column="page_id_on" referenceColumn="page_id"
referenceTable="test_table"/>
<!-- Expected name in DB: DEPENDENT_SCOPE_ID_ON_TEST_SCOPE_TABLE_SCOPE_ID -->
<constraint xsi:type="foreign" referenceId="ScopeIDOnTOScopeTableAndScopeId" table="dependent" column="scope_id_on" referenceColumn="scope_id"
referenceTable="test_scope_table"/>
</table>
</schema>
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="reference_test" resource="default">
<column xsi:type="smallint" identity="true" name="entity_id" padding="3" nullable="true"/>
<column xsi:type="smallint" identity="true" name="product_id" padding="3" nullable="true"/>
<index referenceId="ENTITY_ID_INDEX" indexType="btree">
<column name="entity_id"/>
</index>
<constraint xsi:type="unique" referenceId="UNIQUE_PAIR">
<column name="entity_id"/>
<column name="product_id"/>
</constraint>
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE"
column="entity_id" table="reference_test"
referenceTable="test_table" referenceColumn="smallint" onDelete="NO ACTION"/>
</table>
<table name="auto_increment_test" resource="default">
<column xsi:type="int" name="int_counter" padding="12" unsigned="true"
nullable="true"/>
</table>
</schema>