|
2 | 2 | require_once ('db.php'); |
3 | 3 | require_once ('auth_app.php'); |
4 | 4 |
|
5 | | - mysqli_query($con, "ALTER TABLE $db_keys_table ADD COLUMN favorite TINYINT(1) NOT NULL DEFAULT 0") or die(mysqli_error($con)); |
6 | | - // Update existing tables to handle new data structures |
7 | | - $table_list = mysqli_query($con, "SELECT table_name FROM INFORMATION_SCHEMA.tables WHERE table_schema = '$db_name' and table_name like '$db_table%' ORDER BY table_name DESC;"); |
8 | | - while( $row = mysqli_fetch_assoc($table_list) ) { |
9 | | - $db_table_name = $row["table_name"]; |
10 | | - // Change the GPS Latitude and Longitude datapoints from Float to Double to improve accuracy |
11 | | - $sqlLatQuery = "ALTER TABLE $db_table_name MODIFY kff1006 DOUBLE NOT NULL DEFAULT '0'"; |
12 | | - mysqli_query($con, $sqlLatQuery) or die(mysqli_error($con)); |
13 | | - $sqlLongQuery = "ALTER TABLE $db_table_name MODIFY kff1005 DOUBLE NOT NULL DEFAULT '0'"; |
14 | | - mysqli_query($con, $sqlLongQuery) or die(mysqli_error($con)); |
15 | | - // Delete columns which are now redundant and just stored with the session |
16 | | - $sqlVQuery = "ALTER TABLE $db_table_name DROP COLUMN v"; |
17 | | - mysqli_query($con, $sqlVQuery) or die(mysqli_error($con)); |
18 | | - $sqlIdQuery = "ALTER TABLE $db_table_name DROP COLUMN id"; |
19 | | - mysqli_query($con, $sqlIdQuery) or die(mysqli_error($con)); |
20 | | - $sqlEmlQuery = "ALTER TABLE $db_table_name DROP COLUMN eml"; |
21 | | - mysqli_query($con, $sqlEmlQuery) or die(mysqli_error($con)); |
22 | | - $sqlProfileNameQuery = "ALTER TABLE $db_table_name DROP COLUMN profileName"; |
23 | | - mysqli_query($con, $sqlProfileNameQuery) or die(mysqli_error($con)); |
24 | | - $sqlProfileFuelTypeQuery = "ALTER TABLE $db_table_name DROP COLUMN profileFuelType"; |
25 | | - mysqli_query($con, $sqlProfileFuelTypeQuery) or die(mysqli_error($con)); |
26 | | - $sqlProfileWeightQuery = "ALTER TABLE $db_table_name DROP COLUMN profileWeight"; |
27 | | - mysqli_query($con, $sqlProfileWeightQuery) or die(mysqli_error($con)); |
28 | | - $sqlProfileVeQuery = "ALTER TABLE $db_table_name DROP COLUMN profileVe"; |
29 | | - mysqli_query($con, $sqlProfileVeQuery) or die(mysqli_error($con)); |
30 | | - $sqlProfileFuelCostQuery = "ALTER TABLE $db_table_name DROP COLUMN profileFuelCost"; |
31 | | - mysqli_query($con, $sqlProfileFuelCostQuery) or die(mysqli_error($con)); |
32 | | - |
33 | | - } |
| 5 | +# mysqli_query($con, "ALTER TABLE $db_keys_table ADD COLUMN favorite TINYINT(1) NOT NULL DEFAULT 0") or die(mysqli_error($con)); |
| 6 | +# // Update existing tables to handle new data structures |
| 7 | +# $table_list = mysqli_query($con, "SELECT table_name FROM INFORMATION_SCHEMA.tables WHERE table_schema = '$db_name' and table_name like '$db_table%' ORDER BY table_name DESC;"); |
| 8 | +# while( $row = mysqli_fetch_assoc($table_list) ) { |
| 9 | +# $db_table_name = $row["table_name"]; |
| 10 | +# // Change the GPS Latitude and Longitude datapoints from Float to Double to improve accuracy |
| 11 | +# $sqlLatQuery = "ALTER TABLE $db_table_name MODIFY kff1006 DOUBLE NOT NULL DEFAULT '0'"; |
| 12 | +# mysqli_query($con, $sqlLatQuery) or die(mysqli_error($con)); |
| 13 | +# $sqlLongQuery = "ALTER TABLE $db_table_name MODIFY kff1005 DOUBLE NOT NULL DEFAULT '0'"; |
| 14 | +# mysqli_query($con, $sqlLongQuery) or die(mysqli_error($con)); |
| 15 | +# // Delete columns which are now redundant and just stored with the session |
| 16 | +# $sqlVQuery = "ALTER TABLE $db_table_name DROP COLUMN v"; |
| 17 | +# mysqli_query($con, $sqlVQuery) or die(mysqli_error($con)); |
| 18 | +# $sqlIdQuery = "ALTER TABLE $db_table_name DROP COLUMN id"; |
| 19 | +# mysqli_query($con, $sqlIdQuery) or die(mysqli_error($con)); |
| 20 | +# $sqlEmlQuery = "ALTER TABLE $db_table_name DROP COLUMN eml"; |
| 21 | +# mysqli_query($con, $sqlEmlQuery) or die(mysqli_error($con)); |
| 22 | +# $sqlProfileNameQuery = "ALTER TABLE $db_table_name DROP COLUMN profileName"; |
| 23 | +# mysqli_query($con, $sqlProfileNameQuery) or die(mysqli_error($con)); |
| 24 | +# $sqlProfileFuelTypeQuery = "ALTER TABLE $db_table_name DROP COLUMN profileFuelType"; |
| 25 | +# mysqli_query($con, $sqlProfileFuelTypeQuery) or die(mysqli_error($con)); |
| 26 | +# $sqlProfileWeightQuery = "ALTER TABLE $db_table_name DROP COLUMN profileWeight"; |
| 27 | +# mysqli_query($con, $sqlProfileWeightQuery) or die(mysqli_error($con)); |
| 28 | +# $sqlProfileVeQuery = "ALTER TABLE $db_table_name DROP COLUMN profileVe"; |
| 29 | +# mysqli_query($con, $sqlProfileVeQuery) or die(mysqli_error($con)); |
| 30 | +# $sqlProfileFuelCostQuery = "ALTER TABLE $db_table_name DROP COLUMN profileFuelCost"; |
| 31 | +# mysqli_query($con, $sqlProfileFuelCostQuery) or die(mysqli_error($con)); |
| 32 | +# |
| 33 | +# } |
34 | 34 |
|
35 | | - // Split the raw logs table into per-month tables |
36 | | - $sessionYears = mysqli_query($con, "SELECT DISTINCT CONCAT(YEAR(FROM_UNIXTIME(session/1000)), '_', DATE_FORMAT(FROM_UNIXTIME(session/1000),'%m')) as Suffix, YEAR(FROM_UNIXTIME(session/1000)) as Year, MONTH(FROM_UNIXTIME(session/1000)) as Month FROM $db_table"); |
37 | | - while( $row = mysqli_fetch_assoc( $sessionYears ) ) { |
38 | | - $suffix = $row['Suffix']; |
39 | | - $year = $row['Year']; |
40 | | - $month = $row['Month']; |
41 | | - $new_table_name = "{$db_table}_test_{$suffix}"; |
42 | | - $table_create_query = "CREATE TABLE $new_table_name SELECT * FROM $db_table WHERE YEAR(FROM_UNIXTIME(session/1000)) LIKE '$year' and MONTH(FROM_UNIXTIME(session/1000)) LIKE '$month'"; |
43 | | - mysqli_query($con, $table_create_query) or die(mysqli_error($con)); |
44 | | - } |
| 35 | +# // Split the raw logs table into per-month tables |
| 36 | +# $sessionYears = mysqli_query($con, "SELECT DISTINCT CONCAT(YEAR(FROM_UNIXTIME(session/1000)), '_', DATE_FORMAT(FROM_UNIXTIME(session/1000),'%m')) as Suffix, YEAR(FROM_UNIXTIME(session/1000)) as Year, MONTH(FROM_UNIXTIME(session/1000)) as Month FROM $db_table"); |
| 37 | +# while( $row = mysqli_fetch_assoc( $sessionYears ) ) { |
| 38 | +# $suffix = $row['Suffix']; |
| 39 | +# $year = $row['Year']; |
| 40 | +# $month = $row['Month']; |
| 41 | +# $new_table_name = "{$db_table}_test_{$suffix}"; |
| 42 | +# $table_create_query = "CREATE TABLE $new_table_name SELECT * FROM $db_table WHERE YEAR(FROM_UNIXTIME(session/1000)) LIKE '$year' and MONTH(FROM_UNIXTIME(session/1000)) LIKE '$month'"; |
| 43 | +# mysqli_query($con, $table_create_query) or die(mysqli_error($con)); |
| 44 | +# } |
45 | 45 |
|
46 | | - // Clear the raw_logs table; we still want it as a shell, just empty |
47 | | - mysqli_query($con, "DELETE FROM $db_table") or die(mysqli_error($con)); |
| 46 | +# // Clear the raw_logs table; we still want it as a shell, just empty |
| 47 | +# mysqli_query($con, "DELETE FROM $db_table") or die(mysqli_error($con)); |
48 | 48 | ?> |
49 | 49 |
|
0 commit comments