<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
namespace Friendica\Util\Writer;
use Exception;
+use Friendica\App;
use Friendica\Database\Definition\DbaDefinition;
/**
public static function create(DbaDefinition $definition): string
{
$sqlString = "-- ------------------------------------------\n";
- $sqlString .= "-- " . FRIENDICA_PLATFORM . " " . FRIENDICA_VERSION . " (" . FRIENDICA_CODENAME . ")\n";
+ $sqlString .= "-- " . App::PLATFORM . " " . App::VERSION . " (" . App::CODENAME . ")\n";
$sqlString .= "-- DB_UPDATE_VERSION " . DB_UPDATE_VERSION . "\n";
$sqlString .= "-- ------------------------------------------\n\n\n";
$foreign_keys = [];
foreach ($tableStructure['fields'] as $fieldName => $field) {
- $sql_rows[] = '`' . static::escape($fieldName) . '` ' . self::FieldCommand($field);
+ $sql_rows[] = '`' . static::escape($fieldName) . '` ' . self::fieldCommand($field);
if (!empty($field['primary'])) {
$primary_keys[] = $fieldName;
}
*/
public static function addTableField(string $fieldName, array $parameters): string
{
- return sprintf("ADD `%s` %s", static::escape($fieldName), static::FieldCommand($parameters));
+ return sprintf("ADD `%s` %s", static::escape($fieldName), static::fieldCommand($parameters));
}
/**
*/
public static function modifyTableField(string $fieldName, array $parameters): string
{
- return sprintf("MODIFY `%s` %s", static::escape($fieldName), self::FieldCommand($parameters, false));
+ return sprintf("MODIFY `%s` %s", static::escape($fieldName), self::fieldCommand($parameters, false));
}
/**
* @param boolean $create Whether to include PRIMARY KEY statement (unused)
* @return string SQL statement part
*/
- public static function FieldCommand(array $parameters, bool $create = true): string
+ public static function fieldCommand(array $parameters, bool $create = true): string
{
$fieldstruct = $parameters['type'];