diff options
Diffstat (limited to 'phpBB/develop/create_schema_files.php')
-rw-r--r-- | phpBB/develop/create_schema_files.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 5ef278d493..dcbe5ec66d 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -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; |