Last active
September 3, 2021 09:29
-
-
Save sakydev/280d352d725765885f5fd054d1e448a8 to your computer and use it in GitHub Desktop.
php+mysql: script to run same command on multiple tables
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
<?php | |
$query = "alter table {table} drop column columnName;"; | |
$tables = array('tableA', 'tableB'); | |
foreach ($tables as $key => $source) { | |
$currentQuery = str_replace('{table}', $source, $query); | |
DB::query($currentQuery); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment