<?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));
}
/**
* Creates the SQL definition to modify a table field
*
* @param string $fieldName The table field name
- * @param array $parameters The paramters to modify
+ * @param array $parameters The parameters to modify
*
* @return string The SQL definition
*/
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'];
* @param string $method The method to create the index (default is ADD)
*
* @return string The SQL definition
- * @throws Exception in cases the paramter contains invalid content
+ * @throws Exception in cases the parameter contains invalid content
*/
public static function createIndex(string $indexName, array $fieldNames, string $method = 'ADD'): string
{