Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
|
||||
interface CharTypeInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLength(): int;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
interface ColumnInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var null|string[]
|
||||
*/
|
||||
public const DEFAULT_PARAMS = [
|
||||
'default' => null,
|
||||
'charset' => null,
|
||||
'collate' => null,
|
||||
'comment' => null,
|
||||
'nullable' => true,
|
||||
'extra' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getField(): string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions(): array;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isNullable() : bool;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
|
||||
interface ColumnTextInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
|
||||
interface DateAndTimeColumnInterface
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
interface DecimalTypeInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDecimals(): int;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
use Xentral\Components\Database\Exception\EscapingException;
|
||||
use Xentral\Components\SchemaCreator\Exception\LineGeneratorException;
|
||||
use Xentral\Components\SchemaCreator\Exception\SchemaCreatorTableException;
|
||||
use Xentral\Components\SchemaCreator\Schema\TableSchema;
|
||||
use Exception;
|
||||
|
||||
interface DriverInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param TableSchema $currentSchema
|
||||
* @param TableSchema $targetSchema
|
||||
*
|
||||
* @throws EscapingException
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateTableSchemaDiff(TableSchema $currentSchema, TableSchema $targetSchema): string;
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
*
|
||||
* @throws LineGeneratorException
|
||||
* @throws SchemaCreatorTableException
|
||||
* @throws Exception
|
||||
*
|
||||
* @return TableSchema
|
||||
*/
|
||||
public function loadFromTable(string $table): TableSchema;
|
||||
|
||||
/**
|
||||
* @param TableSchema $currentSchema
|
||||
*
|
||||
* @throws EscapingException
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTableDefinition(TableSchema $currentSchema): ?string;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
interface EnumAndSetInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getReferences(): string;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
interface IndexInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getReferences(): array;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isUnique(): bool;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
interface IntegerTypeInterface extends ColumnInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLength(): int;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
interface NumericTypeInterface
|
||||
{
|
||||
public const NON_NEGATIV = 'UNSIGNED';
|
||||
public const WITH_NEGATIV = 'SIGNED';
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isUnsigned(): bool;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
interface PrimaryKeyInterface extends UniqueIndexInterface
|
||||
{
|
||||
public const INDEX_NAME = 'PRIMARY';
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Components\SchemaCreator\Interfaces;
|
||||
|
||||
interface UniqueIndexInterface
|
||||
{
|
||||
/** @var string */
|
||||
public const TYPE = 'UNIQUE INDEX';
|
||||
}
|
||||
Reference in New Issue
Block a user