-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-85326: Tool for generating schema
--add staging schema
- Loading branch information
Sergii Kovalenko
committed
Jan 4, 2018
1 parent
86fb388
commit 9c4aa72
Showing
17 changed files
with
338 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Application entry point | ||
* | ||
* Example - run a particular store or website: | ||
* -------------------------------------------- | ||
* require __DIR__ . '/app/bootstrap.php'; | ||
* $params = $_SERVER; | ||
* $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2'; | ||
* $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website'; | ||
* $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params); | ||
* \/** @var \Magento\Framework\App\Http $app *\/ | ||
* $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class); | ||
* $bootstrap->run($app); | ||
* -------------------------------------------- | ||
* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
try { | ||
require __DIR__ . '/app/bootstrap.php'; | ||
} catch (\Exception $e) { | ||
echo <<<HTML | ||
<div style="font:12px/1.35em arial, helvetica, sans-serif;"> | ||
<div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"> | ||
<h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;"> | ||
Autoload error</h3> | ||
</div> | ||
<p>{$e->getMessage()}</p> | ||
</div> | ||
HTML; | ||
exit(1); | ||
} | ||
|
||
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); | ||
$om = $bootstrap->getObjectManager(); | ||
/** @var \Magento\Framework\Component\ComponentRegistrar $componentRegistrar */ | ||
$componentRegistrar = $om->get(\Magento\Framework\Component\ComponentRegistrar::class); | ||
/** @var \Magento\Framework\App\ResourceConnection $resourceConnection */ | ||
$resourceConnection = $om->get(Magento\Framework\App\ResourceConnection::class); | ||
|
||
$adapter = $resourceConnection->getConnection(); | ||
$adapter->query('DROP DATABASE ' . $resourceConnection->getSchemaName('default')); | ||
$adapter->query('CREATE DATABASE ' . $resourceConnection->getSchemaName('default')); | ||
|
||
foreach ($componentRegistrar->getPaths(\Magento\Framework\Component\ComponentRegistrar::MODULE) as $path) { | ||
if (strpos($path, 'magento2ee') !== false) { | ||
@unlink($path . DIRECTORY_SEPARATOR . 'etc/db_schema.xml'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
setup/src/Magento/Setup/Model/Declaration/Schema/etc/name.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> | ||
<xs:simpleType name="nameType"> | ||
<xs:annotation> | ||
<xs:documentation> | ||
We can`t create column index or constraint with name length more than 64 char | ||
</xs:documentation> | ||
</xs:annotation> | ||
<xs:restriction base="xs:string"> | ||
<xs:maxLength value="64" /> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.