mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implemented webhooks database structure and console command register webhooks
This commit is contained in:
@@ -25,28 +25,12 @@ class Migration extends YiiMigration {
|
||||
parent::createTable($table, $columns, $options);
|
||||
}
|
||||
|
||||
protected function primary(...$columns) {
|
||||
switch (count($columns)) {
|
||||
case 0:
|
||||
$key = '';
|
||||
break;
|
||||
case 1:
|
||||
$key = $columns[0];
|
||||
break;
|
||||
default:
|
||||
$key = $this->buildKey($columns);
|
||||
protected function primary(string ...$columns): string {
|
||||
foreach ($columns as &$column) {
|
||||
$column = $this->db->quoteColumnName($column);
|
||||
}
|
||||
|
||||
return " PRIMARY KEY ($key) ";
|
||||
}
|
||||
|
||||
private function buildKey(array $columns) {
|
||||
$key = '';
|
||||
foreach ($columns as $i => $column) {
|
||||
$key .= $i === count($columns) ? $column : "$column,";
|
||||
}
|
||||
|
||||
return $key;
|
||||
return ' PRIMARY KEY (' . implode(', ', $columns) . ') ';
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user