Skip to content

Commit 3e2f648

Browse files
author
epriestley
committed
Use define() instead of PHP 5.3-only global 'const' in upgrade_schema.php
Summary: This global 'const' syntax was introduced in PHP 5.3: http://www.php.net/manual/en/language.constants.syntax.php We're PHP 5.2.x elsewhere so just use define(). Made the constant a little more specific too. Test Plan: Ran upgrade_schema.php script. Reviewed By: Girish Reviewers: tuomaspelkonen, Girish, davidrecordon CC: jungejason, aran, epriestley, Girish Differential Revision: 190
1 parent b339703 commit 3e2f648

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

scripts/sql/upgrade_schema.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
phutil_require_module('phutil', 'console');
2525

26-
const TABLE_NAME = 'schema_version';
26+
define('SCHEMA_VERSION_TABLE_NAME', 'schema_version');
2727

2828
if (isset($argv[1]) && !is_numeric($argv[1])) {
2929
print
@@ -82,7 +82,7 @@ public function getApplicationName() {
8282
$version = queryfx_one(
8383
$conn,
8484
'SELECT * FROM %T',
85-
TABLE_NAME);
85+
SCHEMA_VERSION_TABLE_NAME);
8686

8787
if (!$version) {
8888
print "*** No version information in the database ***\n";
@@ -142,12 +142,16 @@ public function getApplicationName() {
142142

143143
// Patch was successful, update the db with the latest applied patch version
144144
// 'DELETE' and 'INSERT' instead of update, because the table might be empty
145-
queryfx($conn, 'DELETE FROM %T', TABLE_NAME);
146-
queryfx($conn, 'INSERT INTO %T values (%d)', TABLE_NAME, $patch['version']);
145+
queryfx($conn, 'DELETE FROM %T', SCHEMA_VERSION_TABLE_NAME);
146+
queryfx(
147+
$conn,
148+
'INSERT INTO %T values (%d)',
149+
SCHEMA_VERSION_TABLE_NAME,
150+
$patch['version']);
147151

148152
$patch_applied = true;
149153
}
150154

151155
if (!$patch_applied) {
152-
print "Your database is already up-to-date\n";
156+
print "Your database is already up-to-date.\n";
153157
}

0 commit comments

Comments
 (0)