File tree 5 files changed +67
-4
lines changed
lib/internal/Magento/Framework/Setup 5 files changed +67
-4
lines changed Original file line number Diff line number Diff line change 1592
1592
<item name =" longblog" xsi : type =" object" >Magento\Framework\Setup\SchemaListenerDefinition\TextBlobDefinition</item >
1593
1593
<item name =" varbinary" xsi : type =" object" >Magento\Framework\Setup\SchemaListenerDefinition\TextBlobDefinition</item >
1594
1594
<item name =" varchar" xsi : type =" object" >Magento\Framework\Setup\SchemaListenerDefinition\TextBlobDefinition</item >
1595
+ <item name =" char" xsi : type =" object" >Magento\Framework\Setup\SchemaListenerDefinition\CharDefinition</item >
1595
1596
<item name =" timestamp" xsi : type =" object" >Magento\Framework\Setup\SchemaListenerDefinition\TimestampDefinition</item >
1596
1597
<item name =" datetime" xsi : type =" object" >Magento\Framework\Setup\SchemaListenerDefinition\TimestampDefinition</item >
1597
1598
<item name =" date" xsi : type =" object" >Magento\Framework\Setup\SchemaListenerDefinition\DateDefinition</item >
Original file line number Diff line number Diff line change 11
11
12
12
/**
13
13
* String or Binary column.
14
- * Declared in SQL, like VARCHAR(L), BINARY(L)
14
+ * Declared in SQL, like CHAR(L), VARCHAR(L), BINARY(L)
15
15
* where L - length.
16
16
*/
17
17
class StringBinary extends Column implements
@@ -73,10 +73,9 @@ public function isNullable()
73
73
}
74
74
75
75
/**
76
- * Return default value.
77
- * Note: default value should be string.
76
+ * Return default value, Note: default value should be string.
78
77
*
79
- * @return string | null
78
+ * @return string| null
80
79
*/
81
80
public function getDefault ()
82
81
{
Original file line number Diff line number Diff line change 20
20
<xs : include schemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/longtext.xsd" />
21
21
<xs : include schemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/mediumtext.xsd" />
22
22
<xs : include schemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/varchar.xsd" />
23
+ <xs : include schemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/char.xsd" />
23
24
<xs : include schemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/json.xsd" />
24
25
<xs : include schemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/blob.xsd" />
25
26
<xs : include schemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/mediumblob.xsd" />
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+ <xs : schema xmlns : xs =" http://www.w3.org/2001/XMLSchema" elementFormDefault =" qualified" >
9
+ <xs : include schemaLocation =" urn:magento:framework:Setup/Declaration/Schema/etc/types/column.xsd" />
10
+
11
+ <xs : complexType name =" char" >
12
+ <xs : complexContent >
13
+ <xs : extension base =" abstractColumnType" >
14
+ <xs : annotation >
15
+ <xs : documentation >
16
+ Here plain text can be persisted without trailing spaces. Length of this field can't be more than 255 characters
17
+ When CHAR values are retrieved, trailing spaces are removed unless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.
18
+ </xs : documentation >
19
+ </xs : annotation >
20
+
21
+ <xs : attribute name =" length" >
22
+ <xs : simpleType >
23
+ <xs : restriction base =" xs:integer" >
24
+ <xs : maxInclusive value =" 255" />
25
+ </xs : restriction >
26
+ </xs : simpleType >
27
+ </xs : attribute >
28
+ <xs : attribute name =" default" type =" xs:string" />
29
+ <xs : attribute name =" nullable" type =" xs:boolean" />
30
+ </xs : extension >
31
+ </xs : complexContent >
32
+ </xs : complexType >
33
+ </xs : schema >
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Framework \Setup \SchemaListenerDefinition ;
8
+
9
+ /**
10
+ * Char type definition.
11
+ */
12
+ class CharDefinition implements DefinitionConverterInterface
13
+ {
14
+ private const DEFAULT_TEXT_LENGTH = 255 ;
15
+
16
+ /**
17
+ * @inheritdoc
18
+ */
19
+ public function convertToDefinition (array $ definition )
20
+ {
21
+ return [
22
+ 'xsi:type ' => $ definition ['type ' ],
23
+ 'name ' => $ definition ['name ' ],
24
+ 'length ' => $ definition ['length ' ] ?? self ::DEFAULT_TEXT_LENGTH ,
25
+ 'default ' => isset ($ definition ['default ' ]) ? (bool ) $ definition ['default ' ] : null ,
26
+ 'nullable ' => $ definition ['nullable ' ] ?? true ,
27
+ ];
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments