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,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="store">
<column name="store_owner" xsi:type="varchar" length="255" comment="Store Owner Name" />
</table>
</schema>
@@ -0,0 +1,126 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestSetupDeclarationModule1\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallSchema implements InstallSchemaInterface
{
/**
* {@inheritdoc}
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
//Create first table
$table = $installer->getConnection()
->newTable($installer->getTable('reference_table'))
->addColumn(
'smallint_ref',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
3,
['primary' => true, 'identity' => true, 'nullable' => false],
'Smallint'
)
->setComment('Reference table');
$installer->getConnection()->createTable($table);
$testTable = $installer->getConnection()->newTable($installer->getTable('test_table'))
->addColumn(
'smallint',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
2,
['nullable' => true, 'default' => 0],
'Smallint'
)
->addColumn(
'bigint',
\Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
10,
['nullable' => true, 'unsigned' => false, 'default' => 0],
'Bigint'
)
->addColumn(
'float',
\Magento\Framework\DB\Ddl\Table::TYPE_FLOAT,
null,
['default' => 0],
'Float'
)
->addColumn(
'date',
\Magento\Framework\DB\Ddl\Table::TYPE_DATE,
null,
[],
'Date'
)
->addColumn(
'timestamp',
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
null,
['default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
'Timestamp'
)
->addColumn(
'mediumtext',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
11222222,
[],
'Mediumtext'
)
->addColumn(
'varchar',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
254,
['nullable' => true],
'Varchar'
)
->addColumn(
'boolean',
\Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN,
1,
[],
'Boolean'
)
->addIndex(
$installer->getIdxName('test_table', ['smallint', 'bigint']),
['smallint', 'bigint'],
['type' => \Magento\Framework\DB\Adapter\Pdo\Mysql::INDEX_TYPE_UNIQUE]
)
->addIndex(
$installer->getIdxName('test_table', ['bigint']),
['bigint']
)
->addForeignKey(
$installer->getFkName(
$installer->getTable('test_table'),
'smallint',
'reference_table',
'smallint_ref'
),
'smallint',
$installer->getTable('reference_table'),
'smallint_ref',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)
->setComment('Test Table');
$installer->getConnection()->createTable($testTable);
$installer->endSetup();
}
}
@@ -0,0 +1,36 @@
<?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" comment="Reference table">
<column xsi:type="smallint" name="smallint_ref" padding="6" nullable="false" unsigned="false" identity="true" comment="Smallint"/>
<constraint xsi:type="primary" referenceId="tinyint_primary">
<column name="smallint_ref"/>
</constraint>
</table>
<table name="test_table" resource="default" comment="Test Table">
<column xsi:type="smallint" name="smallint" default="0" padding="6" nullable="true" unsigned="false" comment="Smallint"/>
<column xsi:type="bigint" name="bigint" default="0" padding="20" nullable="true" unsigned="false" comment="Bigint"/>
<column xsi:type="float" name="float" default="0" scale="0" precision="10" comment="Float"/>
<column xsi:type="date" name="date" comment="Date"/>
<column xsi:type="timestamp" name="timestamp" default="CURRENT_TIMESTAMP" on_update="true" comment="Timestamp"/>
<column xsi:type="mediumtext" name="mediumtext" comment="Mediumtext"/>
<column xsi:type="varchar" name="varchar" length="254" nullable="true" comment="Varchar"/>
<column xsi:type="boolean" name="boolean" comment="Boolean"/>
<constraint xsi:type="unique" referenceId="TEST_TABLE_SMALLINT_BIGINT">
<column name="smallint"/>
<column name="bigint"/>
</constraint>
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF"
column="smallint" table="test_table"
referenceTable="reference_table" referenceColumn="smallint_ref" onDelete="CASCADE"/>
<index referenceId="TEST_TABLE_BIGINT" indexType="btree">
<column name="bigint"/>
</index>
</table>
</schema>
@@ -0,0 +1,27 @@
<?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="store">
<column name="store_owner_id" xsi:type="smallint" nullable="true" comment="Store Owner Reference" />
<constraint xsi:type="foreign"
name="STORE_STORE_OWNER_ID_STORE_OWNER_OWNER_ID"
column="store_owner_id"
table="store"
referenceTable="store_owner"
referenceColumn="owner_id"
onDelete="SET NULL" />
</table>
<table name="store_owner" comment="Store owner information" engine="innodb" resource="default">
<column name="owner_id" xsi:type="smallint" nullable="false" unsigned="false" identity="true" />
<column name="store_owner_name" onCreate="migrateDataFrom(label)" xsi:type="varchar" length="255" comment="Store Owner Name" />
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="owner_id" />
</constraint>
</table>
</schema>
@@ -0,0 +1,68 @@
<?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" 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"/>
<column xsi:type="smallint" name="smallint_without_default" padding="2" nullable="true" unsigned="false"/>
<column xsi:type="int" name="int_without_unsigned" padding="2" nullable="true"/>
<column xsi:type="int" name="int_unsigned" padding="2" nullable="true" unsigned="true"/>
<column xsi:type="bigint" name="bigint_default_nullable" padding="2" nullable="true" default="123"
unsigned="true"/>
<column xsi:type="bigint" name="bigint_not_default_not_nullable" nullable="false" unsigned="false"/>
<constraint xsi:type="primary" referenceId="tinyint_primary">
<column name="tinyint_ref"/>
</constraint>
</table>
<table name="auto_increment_test" resource="default">
<column xsi:type="int" name="int_auto_increment_with_nullable" padding="15" 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>
<table name="test_table" resource="default">
<!--Columns-->
<column xsi:type="smallint" identity="true" name="smallint" padding="3" nullable="true"/>
<column xsi:type="tinyint" name="tinyint" padding="7" nullable="true" unsigned="false"/>
<column xsi:type="bigint" name="bigint" default="0" padding="13" nullable="true" unsigned="false"/>
<column xsi:type="float" name="float" default="0" precision="12" scale="10"/>
<column xsi:type="double" name="double" precision="245" scale="10"/>
<column xsi:type="decimal" name="decimal" default="0" scale="4" precision="15"/>
<column xsi:type="date" name="date"/>
<column xsi:type="timestamp" name="timestamp" default="CURRENT_TIMESTAMP" on_update="false"/>
<column xsi:type="datetime" name="datetime" default="0"/>
<column xsi:type="longtext" name="longtext"/>
<column xsi:type="mediumtext" name="mediumtext"/>
<column xsi:type="varchar" name="varchar" length="100" nullable="true"/>
<column xsi:type="mediumblob" name="mediumblob"/>
<column xsi:type="blob" name="blob"/>
<column xsi:type="boolean" name="boolean" default="true"/>
<column xsi:type="varbinary" name="varbinary_rename" default="10101" disabled="true"/>
<!--Constraints-->
<constraint xsi:type="unique" referenceId="TEST_TABLE_SMALLINT_BIGINT">
<column name="smallint"/>
<column name="bigint"/>
</constraint>
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF"
column="tinyint" table="test_table"
referenceTable="reference_table" referenceColumn="tinyint_ref" onDelete="NO ACTION"/>
<!--Indexes-->
<index referenceId="TEST_TABLE_TINYINT_BIGINT" indexType="btree">
<column name="tinyint"/>
<column name="bigint"/>
</index>
</table>
</schema>
@@ -0,0 +1,66 @@
<?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="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"/>
<column xsi:type="smallint" name="smallint_without_default" padding="2" nullable="true" unsigned="false"/>
<column xsi:type="int" name="int_without_unsigned" padding="2" nullable="true"/>
<column xsi:type="int" name="int_unsigned" padding="2" nullable="true" unsigned="true"/>
<column xsi:type="bigint" name="bigint_default_nullable" padding="2" nullable="true" default="1"
unsigned="true"/>
<column xsi:type="bigint" name="bigint_not_default_not_nullable" padding="2" nullable="false" unsigned="true"/>
<constraint xsi:type="primary" referenceId="tinyint_primary">
<column name="tinyint_ref"/>
</constraint>
</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"/>
<constraint xsi:type="unique" referenceId="AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE">
<column name="int_auto_increment_with_nullable"/>
</constraint>
</table>
<table name="test_table" resource="default">
<!--Columns-->
<column xsi:type="smallint" identity="true" name="smallint" padding="3" nullable="true"/>
<column xsi:type="tinyint" name="tinyint" padding="7" nullable="true" unsigned="false"/>
<column xsi:type="bigint" name="bigint" default="0" padding="13" nullable="true" unsigned="false"/>
<column xsi:type="float" name="float" default="0" scale="10" precision="12"/>
<column xsi:type="double" name="double" default="11111111.111111" precision="245" scale="10"/>
<column xsi:type="decimal" name="decimal" default="0" scale="4" precision="15"/>
<column xsi:type="date" name="date"/>
<column xsi:type="timestamp" name="timestamp" default="CURRENT_TIMESTAMP" on_update="true"/>
<column xsi:type="datetime" name="datetime" default="0"/>
<column xsi:type="longtext" name="longtext"/>
<column xsi:type="mediumtext" name="mediumtext"/>
<column xsi:type="varchar" name="varchar" length="254" nullable="true"/>
<column xsi:type="mediumblob" name="mediumblob" disabled="true"/>
<column xsi:type="blob" name="blob"/>
<column xsi:type="boolean" name="boolean"/>
<column xsi:type="varbinary" name="varbinary_rename" default="10101" disabled="false"/>
<!--Constraints-->
<constraint xsi:type="unique" referenceId="TEST_TABLE_SMALLINT_BIGINT">
<column name="smallint"/>
<column name="bigint"/>
</constraint>
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF"
column="tinyint" table="test_table"
referenceTable="reference_table" referenceColumn="tinyint_ref" onDelete="NO ACTION"/>
<!--Indexes-->
<index referenceId="TEST_TABLE_TINYINT_BIGINT" indexType="btree">
<column name="tinyint"/>
<column name="bigint"/>
</index>
</table>
</schema>
@@ -0,0 +1,56 @@
{
"reference_table": {
"column": {
"tinyint_ref": true,
"tinyint_without_padding": true,
"bigint_without_padding": true,
"integer_without_padding": true,
"smallint_with_big_padding": true,
"smallint_without_default": true,
"int_without_unsigned": true,
"int_unsigned": true,
"bigint_default_nullable": true,
"bigint_not_default_not_nullable": true,
"smallint_without_padding": true
},
"constraint": {
"tinyint_primary": true
}
},
"auto_increment_test": {
"column": {
"int_auto_increment_with_nullable": true,
"int_disabled_auto_increment": true
},
"constraint": {
"AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE": true
}
},
"test_table": {
"column": {
"smallint": true,
"tinyint": true,
"bigint": true,
"float": true,
"double": true,
"decimal": true,
"date": true,
"timestamp": true,
"datetime": true,
"longtext": true,
"mediumtext": true,
"varchar": true,
"mediumblob": true,
"blob": true,
"boolean": true,
"varbinary_rename": true
},
"index": {
"TEST_TABLE_TINYINT_BIGINT": true
},
"constraint": {
"TEST_TABLE_SMALLINT_BIGINT": true,
"TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF": true
}
}
}
@@ -0,0 +1,84 @@
<?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"/>
<column xsi:type="smallint" name="smallint_ref" padding="254" default="0" nullable="false" unsigned="false"/>
<column xsi:type="smallint" name="smallint_without_default" padding="2" nullable="true" unsigned="false"/>
<column xsi:type="int" name="int_without_unsigned" padding="2" nullable="true"/>
<column xsi:type="int" name="int_unsigned" padding="2" nullable="true" unsigned="true"/>
<column xsi:type="bigint" name="bigint_default_nullable" padding="2" nullable="true" default="1"
unsigned="true"/>
<column xsi:type="bigint" name="bigint_not_default_not_nullable" padding="2" nullable="false" unsigned="true"/>
<constraint xsi:type="primary" referenceId="tinyint_primary">
<column name="tinyint_ref"/>
<column name="smallint_ref"/>
</constraint>
<constraint xsi:type="unique" referenceId="REFERENCE_TABLE_SMALLINT_REF">
<column name="smallint_ref"/>
</constraint>
</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>
<table name="test_table" resource="default">
<!--Columns-->
<column xsi:type="int" name="integer_main" padding="12" unsigned="true" nullable="true"/>
<column xsi:type="smallint" name="smallint" padding="3" nullable="true"/>
<column xsi:type="tinyint" name="tinyint" padding="7" nullable="true" unsigned="false"/>
<column xsi:type="bigint" name="bigint" default="0" padding="13" nullable="true" unsigned="false"/>
<column xsi:type="float" name="float" default="0" scale="10" precision="12"/>
<column xsi:type="smallint" name="smallint_main" padding="254" default="0" nullable="false" unsigned="false"/>
<column xsi:type="double" name="double" default="11111111.111111" precision="245" scale="10"/>
<column xsi:type="decimal" name="decimal" default="0" scale="4" precision="15"/>
<column xsi:type="date" name="date"/>
<column xsi:type="timestamp" name="timestamp" default="CURRENT_TIMESTAMP" on_update="true"/>
<column xsi:type="datetime" name="datetime" default="0"/>
<column xsi:type="longtext" name="longtext"/>
<column xsi:type="mediumtext" name="mediumtext"/>
<column xsi:type="varchar" name="varchar" length="254" nullable="true"/>
<column xsi:type="mediumblob" name="mediumblob"/>
<column xsi:type="blob" name="blob"/>
<column xsi:type="boolean" name="boolean"/>
<column xsi:type="varbinary" name="varbinary_rename" default="10101" disabled="true"/>
<!--Constraints-->
<constraint xsi:type="unique" referenceId="TEST_TABLE_SMALLINT_FLOAT">
<column name="smallint"/>
<column name="float"/>
</constraint>
<constraint xsi:type="unique" referenceId="TEST_TABLE_DOUBLE">
<column name="double"/>
</constraint>
<constraint xsi:type="foreign" referenceId="some_foreign_key_new" column="smallint_main" table="test_table"
referenceTable="reference_table" referenceColumn="smallint_ref" onDelete="CASCADE"/>
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF"
column="tinyint" table="test_table"
referenceTable="reference_table" referenceColumn="tinyint_ref" onDelete="SET NULL"/>
<constraint xsi:type="foreign" referenceId="FK_FB77604C299EB8612D01E4AF8D9931F2"
column="integer_main" table="test_table"
referenceTable="auto_increment_test" referenceColumn="int_auto_increment_with_nullable"/>
<!--Indexes-->
<index referenceId="TEST_TABLE_TINYINT_BIGINT" indexType="btree">
<column name="tinyint"/>
<column name="bigint"/>
</index>
</table>
</schema>
@@ -0,0 +1,56 @@
{
"reference_table": {
"column": {
"tinyint_ref": true,
"tinyint_without_padding": true,
"bigint_without_padding": true,
"integer_without_padding": true,
"smallint_with_big_padding": true,
"smallint_without_default": true,
"int_without_unsigned": true,
"int_unsigned": true,
"bigint_default_nullable": true,
"bigint_not_default_not_nullable": true,
"smallint_without_padding": true
},
"constraint": {
"PRIMARY": true
}
},
"auto_increment_test": {
"column": {
"int_auto_increment_with_nullable": true,
"int_disabled_auto_increment": true
},
"constraint": {
"AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE": true
}
},
"test_table": {
"column": {
"smallint": true,
"tinyint": true,
"bigint": true,
"float": true,
"double": true,
"decimal": true,
"date": true,
"timestamp": true,
"datetime": true,
"longtext": true,
"mediumtext": true,
"varchar": true,
"mediumblob": true,
"blob": true,
"boolean": true,
"varbinary_rename": true
},
"index": {
"TEST_TABLE_TINYINT_BIGINT": true
},
"constraint": {
"TEST_TABLE_SMALLINT_BIGINT": true,
"TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF": true
}
}
}
@@ -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="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,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_TestSetupDeclarationModule1" />
</config>
@@ -0,0 +1,14 @@
<?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">
<!--Columns-->
<column xsi:type="smallint" name="smallint" default="0" scale="1" padding="3"/>
</table>
</schema>
@@ -0,0 +1,14 @@
<?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">
<!--Columns-->
<column xsi:type="smallint" name="smallint" default="0" padding="3"/>
</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="reference_table" resource="default">
<column xsi:type="tinyint" name="tinyint_ref" default="0" padding="7" nullable="true" unsigned="false"/>
</table>
<table name="test_table" resource="default">
<column xsi:type="tinyint" name="tinyint" default="0" padding="7" nullable="true" unsigned="false"/>
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF"
column="tinyint" table="test_table"
referenceTable="reference_table" referenceColumn="tinyint_ref"/>
</table>
</schema>
@@ -0,0 +1,30 @@
<?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">
<!--Columns-->
<column xsi:type="smallint" identity="true" name="smallint" padding="3" nullable="true"/>
<column xsi:type="tinyint" name="tinyint" padding="7" nullable="true" unsigned="false"/>
<column xsi:type="bigint" name="bigint" default="0" padding="13" nullable="true" unsigned="false"/>
<column xsi:type="varchar" name="varchar" length="254" nullable="true"/>
<!--Constraints-->
<constraint xsi:type="unique" referenceId="TEST_TABLE_UNIQUE">
<column name="smallint"/>
<column name="bigint"/>
</constraint>
<!--Indexes-->
<index referenceId="TEST_TABLE_INDEX" indexType="btree">
<column name="tinyint"/>
<column name="bigint"/>
</index>
<index referenceId="TEST_TABLE_INDEX_VARCHAR" indexType="btree">
<column name="varchar"/>
</index>
</table>
</schema>
@@ -0,0 +1,125 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestSetupDeclarationModule1\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallSchema implements InstallSchemaInterface
{
/**
* {@inheritdoc}
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
//Create first table
$table = $installer->getConnection()
->newTable($installer->getTable('reference_table'))
->addColumn(
'smallint_ref',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
3,
['primary' => true, 'identity' => true, 'nullable' => false],
'Smallint'
)
->setComment('Reference table');
$installer->getConnection()->createTable($table);
$testTable = $installer->getConnection()->newTable('test_table')
->addColumn(
'smallint',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
2,
['nullable' => true, 'default' => 0],
'Smallint'
)
->addColumn(
'bigint',
\Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
10,
['nullable' => true, 'unsigned' => false, 'default' => 0],
'Bigint'
)
->addColumn(
'float',
\Magento\Framework\DB\Ddl\Table::TYPE_FLOAT,
null,
['default' => 0],
'Float'
)
->addColumn(
'date',
\Magento\Framework\DB\Ddl\Table::TYPE_DATE,
null,
[],
'Date'
)
->addColumn(
'timestamp',
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
null,
['default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE],
'Timestamp'
)
->addColumn(
'mediumtext',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
11222222,
[],
'Mediumtext'
)
->addColumn(
'varchar',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
254,
['nullable' => true],
'Varchar'
)
->addColumn(
'boolean',
\Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN,
1,
[],
'Boolean'
)
->addIndex(
$installer->getIdxName($installer->getTable('test_table'), ['smallint', 'bigint']),
['smallint', 'bigint'],
['type' => \Magento\Framework\DB\Adapter\Pdo\Mysql::INDEX_TYPE_UNIQUE]
)
->addIndex(
$installer->getIdxName($installer->getTable('test_table'), ['bigint']),
['bigint']
)
->addForeignKey(
$installer->getFkName(
$installer->getTable('test_table'),
'smallint',
$installer->getTable('reference_table'),
'smallint_ref'
),
'smallint',
$installer->getTable('reference_table'),
'smallint_ref',
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)
->setComment('Test Table');
$installer->getConnection()->createTable($testTable);
$installer->endSetup();
}
}
@@ -0,0 +1,36 @@
<?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" comment="Reference table">
<column xsi:type="smallint" name="smallint_ref" padding="6" nullable="false" unsigned="false" identity="true" comment="Smallint"/>
<constraint xsi:type="primary" referenceId="tinyint_primary">
<column name="smallint_ref"/>
</constraint>
</table>
<table name="test_table" resource="default" comment="Test Table">
<column xsi:type="smallint" name="smallint" default="0" padding="6" nullable="true" unsigned="false" comment="Smallint"/>
<column xsi:type="bigint" name="bigint" default="1" padding="20" nullable="true" unsigned="false" comment="Bigint"/>
<column xsi:type="float" name="float" default="0" scale="0" precision="10" comment="Float"/>
<column xsi:type="date" name="date" comment="Date"/>
<column xsi:type="timestamp" name="timestamp" default="CURRENT_TIMESTAMP" on_update="true" comment="Timestamp"/>
<column xsi:type="mediumtext" name="mediumtext" comment="Mediumtext"/>
<column xsi:type="varchar" name="varchar" length="254" nullable="true" comment="Varchar"/>
<column xsi:type="boolean" name="boolean" comment="Boolean"/>
<constraint xsi:type="unique" referenceId="TEST_TABLE_SMALLINT_BIGINT">
<column name="smallint"/>
<column name="bigint"/>
</constraint>
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF"
column="smallint" table="test_table"
referenceTable="reference_table" referenceColumn="smallint_ref" onDelete="CASCADE"/>
<index referenceId="TEST_TABLE_BIGINT" indexType="btree">
<column name="bigint"/>
</index>
</table>
</schema>
@@ -0,0 +1,10 @@
<?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">
</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="some_table">
<column name="some_column" xsi:type="varchar" length="255" comment="Some Column Name" />
</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="some_table_renamed" onCreate="migrateDataFromAnotherTable(some_table)">
<column name="some_column" xsi:type="varchar" length="255" comment="Some Column Name" />
</table>
</schema>
@@ -0,0 +1,60 @@
<?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"/>
<column xsi:type="smallint" name="smallint_without_default" padding="2" nullable="true" unsigned="false"/>
<column xsi:type="int" name="int_without_unsigned" padding="2" nullable="true"/>
<column xsi:type="int" name="int_unsigned" padding="2" nullable="true" unsigned="true"/>
<column xsi:type="bigint" name="bigint_default_nullable" padding="2" nullable="true" default="1"
unsigned="true"/>
<column xsi:type="bigint" name="bigint_not_default_not_nullable" padding="2" nullable="false" unsigned="true"/>
<constraint xsi:type="primary" referenceId="tinyint_primary">
<column name="tinyint_ref"/>
</constraint>
</table>
<table name="test_table" resource="default">
<!--Columns-->
<column xsi:type="smallint" identity="true" name="smallint" padding="3" nullable="true"/>
<column xsi:type="tinyint" name="tinyint" padding="7" nullable="true" unsigned="false"/>
<column xsi:type="bigint" name="bigint" default="0" padding="13" nullable="true" unsigned="false"/>
<column xsi:type="float" name="float" default="0" scale="4" precision="12"/>
<column xsi:type="decimal" name="double" default="11111111.111111" precision="14" scale="6"/>
<column xsi:type="decimal" name="decimal" default="0" scale="4" precision="15"/>
<column xsi:type="date" name="date"/>
<column xsi:type="timestamp" name="timestamp" default="CURRENT_TIMESTAMP" on_update="true"/>
<column xsi:type="datetime" name="datetime" default="0"/>
<column xsi:type="longtext" name="longtext"/>
<column xsi:type="mediumtext" name="mediumtext"/>
<column xsi:type="varchar" name="varchar" length="254" nullable="true"/>
<column xsi:type="mediumblob" name="mediumblob"/>
<column xsi:type="blob" name="blob"/>
<column xsi:type="boolean" name="boolean"/>
<column xsi:type="varbinary" name="varbinary_rename" default="10101" disabled="true"/>
<!--Constraints-->
<constraint xsi:type="unique" referenceId="TEST_TABLE_UNIQUE">
<column name="smallint"/>
<column name="bigint"/>
</constraint>
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE"
column="tinyint" table="test_table"
referenceTable="reference_table" referenceColumn="tinyint_ref" onDelete="NO ACTION"/>
<!--Indexes-->
<index referenceId="TEST_TABLE_INDEX" indexType="btree">
<column name="tinyint"/>
<column name="bigint"/>
</index>
</table>
</schema>
@@ -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_TestSetupDeclarationModule1"/>
</config>