-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add DB migration to drop style column
- Loading branch information
Showing
5 changed files
with
32 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE `networknotice` DROP `style`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | ||
SET time_zone = "+00:00"; | ||
|
||
|
||
-- -------------------------------------------------------- | ||
-- Table structure for table `networknotice` | ||
-- | ||
|
||
CREATE TABLE IF NOT EXISTS `networknotice` ( | ||
`notice_id` int(11) NOT NULL AUTO_INCREMENT, | ||
`label` tinyblob NOT NULL, | ||
`wiki` blob NOT NULL, | ||
`namespace` tinyblob NOT NULL, | ||
`notice_text` blob NOT NULL, | ||
`style` tinyblob NOT NULL, | ||
`category` blob NOT NULL, | ||
`prefix` blob NOT NULL, | ||
`action` blob NOT NULL, | ||
`disabled` tinyint(1) NOT NULL DEFAULT '0', | ||
PRIMARY KEY (`notice_id`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Liquipedia\Extension\NetworkNotice\Hooks; | ||
|
||
use DatabaseUpdater; | ||
use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; | ||
use MediaWiki\MediaWikiServices; | ||
|
||
class SchemaHookHandler implements LoadExtensionSchemaUpdatesHook { | ||
|
||
/** | ||
* @param DatabaseUpdater $updater | ||
*/ | ||
public function onLoadExtensionSchemaUpdates( $updater ) { | ||
$config = MediaWikiServices::getInstance()->getMainConfig(); | ||
$db = $updater->getDB(); | ||
if ( !$db->tableExists( $config->get( 'DBname' ) . '.networknotice', __METHOD__ ) ) { | ||
$updater->addExtensionTable( 'networknotice', __DIR__ . '/../../sql/networknotice.sql' ); | ||
} | ||
if ( $db->fieldExists( $config->get( 'DBname' ) . '.networknotice', 'style' ) ) { | ||
$updater->dropExtensionField( 'networknotice', 'style', __DIR__ . '/../../sql/3_3_0.sql' ); | ||
} | ||
} | ||
|
||
} |