1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

Merge branch 'develop-olympus' into develop-ascraeus

* develop-olympus:
  [ticket/9725] Code sniffer fixes
  [ticket/9725] Do not use deprecated views to remove default constraints
  [ticket/9725] Move primary key creation to the correct location
  [ticket/9725] Remove trailing spaces from MSSQL schema
  [ticket/9725] Create MSSQL primary keys if none exist
  [ticket/9725] Remove explicit filegroup designations
  [ticket/9725] Fetch Azure db stats from proper table
  [ticket/9725] Add dummy indexes for Azure
  [ticket/9725] Create an Azure SQL compatible Schema

Conflicts:
	phpBB/install/schemas/mssql_schema.sql
This commit is contained in:
Joas Schilling
2014-03-29 10:50:18 +01:00
4 changed files with 468 additions and 347 deletions

View File

@@ -20,7 +20,6 @@ if (!is_writable($schema_path))
define('IN_PHPBB', true);
require(dirname(__FILE__) . '/../includes/db/schema_data.php');
require(dirname(__FILE__) . '/../phpbb/db/tools.php');
$dbms_type_map = phpbb\db\tools::get_dbms_type_map();
@@ -31,6 +30,19 @@ $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', '
foreach ($supported_dbms as $dbms)
{
include(dirname(__FILE__) . '/../includes/db/schema_data.php');
if ($dbms == 'mssql')
{
foreach ($schema_data as $table_name => $table_data)
{
if (!isset($table_data['PRIMARY_KEY']))
{
$schema_data[$table_name]['COLUMNS']['mssqlindex'] = array('UINT', NULL, 'auto_increment');
$schema_data[$table_name]['PRIMARY_KEY'] = 'mssqlindex';
}
}
}
$fp = fopen($schema_path . $dbms . '_schema.sql', 'wb');
$line = '';
@@ -346,7 +358,7 @@ foreach ($supported_dbms as $dbms)
case 'mssql':
$line = substr($line, 0, -2);
$line .= "\n) ON [PRIMARY]" . (($textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : '') . "\n";
$line .= "\n)";// ON [PRIMARY]" . (($textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : '') . "\n";
$line .= "GO\n\n";
break;
}
@@ -383,7 +395,7 @@ foreach ($supported_dbms as $dbms)
$line .= "\tCONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED \n";
$line .= "\t(\n";
$line .= "\t\t[" . implode("],\n\t\t[", $table_data['PRIMARY_KEY']) . "]\n";
$line .= "\t) ON [PRIMARY] \n";
$line .= "\t)\n";
$line .= "GO\n\n";
break;
@@ -478,7 +490,7 @@ foreach ($supported_dbms as $dbms)
case 'mssql':
$line .= ($key_data[0] == 'INDEX') ? 'CREATE INDEX' : '';
$line .= ($key_data[0] == 'UNIQUE') ? 'CREATE UNIQUE INDEX' : '';
$line .= " [{$key_name}] ON [{$table_name}]([" . implode('], [', $key_data[1]) . "]) ON [PRIMARY]\n";
$line .= " [{$key_name}] ON [{$table_name}]([" . implode('], [', $key_data[1]) . "])\n";
$line .= "GO\n\n";
break;