Skip to content
Permalink
Browse files

Introduce CLI script getDatabaseSchema.php

This is helper php script to print expected thirtybees database schema.
It is intented mailny for developers, for example as a way to regenerate
database golden file
  • Loading branch information...
getdatakick committed Apr 1, 2019
1 parent 202e5af commit aefa1d8d4a34a464d3b3d163eb00e06c1a1fe92c
Showing with 36 additions and 0 deletions.
  1. +36 −0 tools/getDatabaseSchema.php
@@ -0,0 +1,36 @@
<?php
/**
* Copyright (C) 2019 thirty bees
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@thirtybees.com so we can send you a copy immediately.
*
* @author thirty bees <contact@thirtybees.com>
* @copyright 2019 thirty bees
* @license Open Software License (OSL 3.0)
*/
/**
* Helper script that prints expected database schema to standard output
*/
// this script is intented for cli mode only
if (php_sapi_name() !== 'cli') {
exit;
}
require_once(dirname(__FILE__).'/../config/settings.inc.php');
require_once(dirname(__FILE__).'/../config/config.inc.php');
require_once(_PS_MODULE_DIR_ . '/coreupdater/classes/schema/autoload.php');
$schemaBuilder = new \CoreUpdater\ObjectModelSchemaBuilder();
$schema = $schemaBuilder->getSchema();
echo str_replace('`' . _DB_PREFIX_, '`PREFIX_', $schema->getDDLStatement());

0 comments on commit aefa1d8

Please sign in to comment.
You can’t perform that action at this time.