Skip to content

Commit 350379f

Browse files
committed
Finished refactoring of SQL generator command
1 parent 0d24301 commit 350379f

File tree

8 files changed

+299
-297
lines changed

8 files changed

+299
-297
lines changed

src/Attribute/Charset.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#[\Attribute(\Attribute::TARGET_CLASS)]
88
final class Charset
99
{
10+
public const DEFAULT = 'utf8mb4';
11+
1012
public function __construct(
1113
public string $charset,
1214
)

src/Attribute/CheckConstraint.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace CoolBeans\Attribute;
6+
7+
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::IS_REPEATABLE)]
8+
final class CheckConstraint
9+
{
10+
public function __construct(
11+
public string $expression,
12+
)
13+
{
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace CoolBeans\Attribute;
6+
7+
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
8+
final class ClassCheckConstraint
9+
{
10+
public function __construct(
11+
public string $expression,
12+
)
13+
{
14+
}
15+
}

src/Attribute/Collation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#[\Attribute(\Attribute::TARGET_CLASS)]
88
final class Collation
99
{
10+
public const DEFAULT = 'utf8mb4_general_ci';
11+
1012
public function __construct(
1113
public string $collation,
1214
)

src/Attribute/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
final class Index
99
{
1010
public function __construct(
11-
public ?\CoolBeans\Attribute\Types\Order $order = null,
11+
public \CoolBeans\Attribute\Types\Order $order = \CoolBeans\Attribute\Types\Order::ASC,
1212
)
1313
{
1414
}

src/Attribute/PrimaryKey.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ final class PrimaryKey
99
{
1010
public array $columns;
1111

12-
public function __construct(string ...$columns)
12+
public function __construct(
13+
string... $columns,
14+
)
1315
{
14-
if (\count($columns) > 1) {
15-
throw new \CoolBeans\Exception\PrimaryKeyMultipleColumnsNotImplemented('Multiple column PrimaryKey is not implemented yet.');
16-
}
17-
1816
$this->columns = $columns;
1917
}
2018
}

0 commit comments

Comments
 (0)