Skip to content

Commit 70ecadb

Browse files
committedDec 6, 2020
declarative db schema
1 parent 31bab30 commit 70ecadb

File tree

5 files changed

+57
-228
lines changed

5 files changed

+57
-228
lines changed
 

‎Controller/Adminhtml/Cache/CleanImages.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use Magento\Backend\App\Action;
1212
use Magento\Backend\App\Action\Context;
1313
use Magento\Backend\Model\View\Result\Redirect;
14-
use Magento\Framework\Exception\LocalizedException;
1514
use Magento\Framework\Controller\ResultFactory;
15+
use Magento\Framework\Exception\LocalizedException;
1616
use Magento\Framework\Phrase;
1717
use Opengento\Document\Model\Cache\Image;
1818

‎Model/File/ImageBuilder.php

-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
use Opengento\Document\Model\Document\Helper\File;
1616
use function array_slice;
1717
use function basename;
18-
use function dirname;
1918
use function implode;
20-
use function str_split;
2119
use function strtolower;
2220
use const DIRECTORY_SEPARATOR;
2321

‎Setup/InstallSchema.php

-218
This file was deleted.

‎etc/db_schema.xml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © OpenGento, All rights reserved.
5+
* See LICENSE bundled with this library for license details.
6+
*/
7+
-->
8+
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
9+
<table name="opengento_document_type" resource="default" engine="innodb" comment="opengento_document_type">
10+
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Document Type Entity ID"/>
11+
<column xsi:type="varchar" name="code" nullable="false" length="255" comment="Document Type Identifier"/>
12+
<column xsi:type="boolean" name="scheduled_import" nullable="false" comment="Document Type Schedule Import"/>
13+
<column xsi:type="text" name="name" nullable="false" comment="Document Type Title"/>
14+
<column xsi:type="text" name="file_source_path" nullable="false" comment="Files Source Path of the Document Type"/>
15+
<column xsi:type="text" name="file_dest_path" nullable="false" comment="Files Destination Path of the Document Type"/>
16+
<column xsi:type="int" name="sub_path_length" padding="11" unsigned="false" nullable="false" identity="false" comment="Destination Sub Path Length of the Document Type"/>
17+
<column xsi:type="text" name="file_pattern" nullable="false" comment="Document File Pattern"/>
18+
<column xsi:type="text" name="file_allowed_extensions" nullable="false" comment="Document Allowed Extensions"/>
19+
<column xsi:type="text" name="default_image_file_name" nullable="false" comment="Document Default Image File Name"/>
20+
<column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at"/>
21+
<column xsi:type="timestamp" name="updated_at" on_update="true" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at"/>
22+
<constraint xsi:type="primary" referenceId="PRIMARY">
23+
<column name="entity_id"/>
24+
</constraint>
25+
<constraint xsi:type="unique" referenceId="OPENGENTO_DOCUMENT_TYPE_CODE">
26+
<column name="code"/>
27+
</constraint>
28+
<index referenceId="OPENGENTO_DOCUMENT_TYPE_SCHEDULED_IMPORT" indexType="btree">
29+
<column name="scheduled_import"/>
30+
</index>
31+
</table>
32+
<table name="opengento_document" resource="default" engine="innodb" comment="opengento_document">
33+
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Document Entity ID"/>
34+
<column xsi:type="int" name="type_id" padding="10" unsigned="true" nullable="false" identity="false" comment="Document related Type ID"/>
35+
<column xsi:type="varchar" name="code" nullable="false" length="255" comment="Document Identifier"/>
36+
<column xsi:type="text" name="name" nullable="false" comment="Document Name"/>
37+
<column xsi:type="text" name="description" nullable="false" comment="Document Description"/>
38+
<column xsi:type="varchar" name="file_locale" nullable="true" length="8" comment="Document Locale"/>
39+
<column xsi:type="text" name="file_name" nullable="false" comment="Document File Name"/>
40+
<column xsi:type="text" name="file_path" nullable="false" comment="Document File Relative Path"/>
41+
<column xsi:type="text" name="image_file_name" nullable="true" comment="Document Image File Name"/>
42+
<column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Created_at"/>
43+
<column xsi:type="timestamp" name="updated_at" on_update="true" nullable="true" default="CURRENT_TIMESTAMP" comment="Updated_at"/>
44+
<constraint xsi:type="primary" referenceId="PRIMARY">
45+
<column name="entity_id"/>
46+
</constraint>
47+
<constraint xsi:type="foreign" referenceId="OPENGENTO_DOCUMENT_TYPE_ID_OPENGENTO_DOCUMENT_TYPE_ENTITY_ID" table="opengento_document" column="type_id" referenceTable="opengento_document_type" referenceColumn="entity_id" onDelete="CASCADE"/>
48+
<constraint xsi:type="unique" referenceId="OPENGENTO_DOCUMENT_CODE_TYPE_ID">
49+
<column name="code"/>
50+
<column name="type_id"/>
51+
</constraint>
52+
<index referenceId="OPENGENTO_DOCUMENT_NAME" indexType="fulltext">
53+
<column name="name"/>
54+
</index>
55+
</table>
56+
</schema>

‎todo.md

-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
Check cache management relation and with product for product link
2-
3-
check there is an index on code and name fields /doc type et doc entities
4-
51
see how many files are waiting for import
62
see how many available files for a type
73

8-
migrate setup to xml
9-
10-
114
target blank or download
125

136
visibility: Not visible, Visible in search

0 commit comments

Comments
 (0)
Please sign in to comment.