Skip to content

Commit

Permalink
new custom column
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzylka committed Feb 15, 2023
1 parent 92615cb commit d7291d2
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/Trait/TablePredefinedColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ public function addDateCreatedColumn(?string $name = 'date_created') : CreateTab
return $this;
}

/**
* Add date modify column
* @param ?string $name column name
* @return CreateTable
*/
public function addDateModifyColumn(?string $name = 'date_modify') : CreateTable {
$column = (new Column())
->setName($name)
Expand All @@ -133,4 +138,39 @@ public function addDateModifyColumn(?string $name = 'date_modify') : CreateTable
return $this;
}

/**
* Add simple varchar column
* @param ?string $name column name
* @param int $size varchar length, default 255
* @param bool $null allow null value
* @return CreateTable
*/
public function addSimpleVarcharColumn(?string $name, int $size = 255, bool $null = true) : CreateTable {
$column = (new Column())
->setName($name)
->setType(ColumnType::varchar, $size)
->setNull($null);

$this->addColumn($column);

return $this;
}

/**
* Add simple int column
* @param ?string $name column name
* @param bool $null allow null value
* @return CreateTable
*/
public function addSimpleIntColumn(?string $name, bool $null = true) : CreateTable {
$column = (new Column())
->setName($name)
->setType(ColumnType::int)
->setNull($null);

$this->addColumn($column);

return $this;
}

}

0 comments on commit d7291d2

Please sign in to comment.