Skip to content

Commit a27c01e

Browse files
committed
added convenience attibutes
1 parent e8b472e commit a27c01e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1346
-43
lines changed

.wiki

Submodule .wiki updated from f22c558 to 07b7f9b

Readme.md

Lines changed: 305 additions & 0 deletions
Large diffs are not rendered by default.

src/Attributes/BigIncrements.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Toramanlis\ImplicitMigrations\Attributes;
4+
5+
use Attribute;
6+
7+
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
8+
class BigIncrements extends Increments
9+
{
10+
protected const TYPE = 'bigInteger';
11+
}

src/Attributes/BigInteger.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Toramanlis\ImplicitMigrations\Attributes;
4+
5+
use Attribute;
6+
7+
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
8+
class BigInteger extends Integer
9+
{
10+
protected const TYPE = 'bigInteger';
11+
}

src/Attributes/Binary.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Toramanlis\ImplicitMigrations\Attributes;
4+
5+
use Attribute;
6+
7+
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
8+
class Binary extends ColumnAlias
9+
{
10+
protected const TYPE = 'binary';
11+
12+
public function __construct(
13+
protected ?string $name = null,
14+
protected ?bool $nullable = null,
15+
protected $default = null,
16+
protected ?bool $fixed = null,
17+
protected ?string $comment = null,
18+
protected ?string $virtualAs = null,
19+
protected ?string $storedAs = null,
20+
protected ?string $after = null
21+
) {
22+
parent::__construct(
23+
static::TYPE,
24+
$name,
25+
$nullable,
26+
$default,
27+
fixed: $fixed,
28+
comment: $comment,
29+
virtualAs: $virtualAs,
30+
storedAs: $storedAs,
31+
after: $after
32+
);
33+
}
34+
}

src/Attributes/CFloat.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Toramanlis\ImplicitMigrations\Attributes;
4+
5+
use Attribute;
6+
7+
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
8+
class CFloat extends ColumnAlias
9+
{
10+
protected const TYPE = 'float';
11+
12+
public function __construct(
13+
protected ?string $name = null,
14+
protected ?bool $nullable = null,
15+
protected $default = null,
16+
protected ?int $precision = null,
17+
protected ?string $comment = null,
18+
protected ?string $virtualAs = null,
19+
protected ?string $storedAs = null,
20+
protected ?string $after = null
21+
) {
22+
parent::__construct(
23+
static::TYPE,
24+
$name,
25+
$nullable,
26+
$default,
27+
precision: $precision,
28+
comment: $comment,
29+
virtualAs: $virtualAs,
30+
storedAs: $storedAs,
31+
after: $after
32+
);
33+
}
34+
}

src/Attributes/CString.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Toramanlis\ImplicitMigrations\Attributes;
4+
5+
use Attribute;
6+
7+
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
8+
class CString extends Char
9+
{
10+
protected const TYPE = 'string';
11+
}

src/Attributes/Char.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace Toramanlis\ImplicitMigrations\Attributes;
4+
5+
use Attribute;
6+
7+
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
8+
class Char extends ColumnAlias
9+
{
10+
protected const TYPE = 'char';
11+
12+
public function __construct(
13+
protected ?string $name = null,
14+
protected ?bool $nullable = null,
15+
protected $default = null,
16+
protected ?int $length = null,
17+
protected ?string $collation = null,
18+
protected ?string $comment = null,
19+
protected ?string $virtualAs = null,
20+
protected ?string $storedAs = null,
21+
protected ?string $after = null
22+
) {
23+
parent::__construct(
24+
$name,
25+
$nullable,
26+
$default,
27+
$length,
28+
collation: $collation,
29+
comment: $comment,
30+
virtualAs: $virtualAs,
31+
storedAs: $storedAs,
32+
after: $after
33+
);
34+
}
35+
}

src/Attributes/ColumnAlias.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
namespace Toramanlis\ImplicitMigrations\Attributes;
4+
5+
abstract class ColumnAlias extends Column
6+
{
7+
protected const TYPE = null;
8+
9+
public function __construct(
10+
protected ?string $name = null,
11+
protected ?bool $nullable = null,
12+
protected $default = null,
13+
protected ?int $length = null,
14+
protected ?bool $unsigned = null,
15+
protected ?bool $autoIncrement = null,
16+
protected ?int $precision = null,
17+
protected ?int $total = null,
18+
protected ?int $places = null,
19+
protected ?array $allowed = null,
20+
protected ?bool $fixed = null,
21+
protected ?string $subtype = null,
22+
protected ?int $srid = null,
23+
protected ?string $expression = null,
24+
protected ?string $collation = null,
25+
protected ?string $comment = null,
26+
protected ?string $virtualAs = null,
27+
protected ?string $storedAs = null,
28+
protected ?string $after = null
29+
) {
30+
parent::__construct(
31+
static::TYPE,
32+
$name,
33+
$nullable,
34+
$default,
35+
$length,
36+
$unsigned,
37+
$autoIncrement,
38+
$precision,
39+
$total,
40+
$places,
41+
$allowed,
42+
$fixed,
43+
$subtype,
44+
$srid,
45+
$expression,
46+
$collation,
47+
$comment,
48+
$virtualAs,
49+
$storedAs,
50+
$after
51+
);
52+
}
53+
}

src/Attributes/Computed.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Toramanlis\ImplicitMigrations\Attributes;
4+
5+
use Attribute;
6+
7+
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
8+
class Computed extends ColumnAlias
9+
{
10+
protected const TYPE = 'computed';
11+
12+
public function __construct(
13+
protected ?string $name = null,
14+
protected ?bool $nullable = null,
15+
protected $default = null,
16+
protected ?string $expression = null,
17+
protected ?string $comment = null,
18+
protected ?string $virtualAs = null,
19+
protected ?string $storedAs = null,
20+
protected ?string $after = null
21+
) {
22+
parent::__construct(
23+
static::TYPE,
24+
$name,
25+
$nullable,
26+
$default,
27+
expression: $expression,
28+
comment: $comment,
29+
virtualAs: $virtualAs,
30+
storedAs: $storedAs,
31+
after: $after
32+
);
33+
}
34+
}

0 commit comments

Comments
 (0)