first commit
This commit is contained in:
commit
c788404cc9
15
README.md
Normal file
15
README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# android-sms-65-to-64-workaround
|
||||
|
||||
So you just updated your CyanogenMod 12.1, probably to "stable" snapshot build, and now your SMS app is crashing with error `android.database.sqlite.SQLiteException: Can't downgrade database from version 65 to 64`, you know that you can just delete `/data/data/com.android.providers.telephony/mmssms.db` file, reboot and be happy, but you can't be happy because you must save your messages? Okay, this is what I faced and here is what you can do.
|
||||
|
||||
- copy your `mmssms.db` file to computer (this will be the source)
|
||||
- delete it on device, reboot and copy the newly created `mmssms.db` (this will be the destination)
|
||||
- put the names of your src and dst files in the script
|
||||
- run it (you need PHP with SQLite3 installed)
|
||||
- replace `mmssms.db` on your device with your dst file
|
||||
- reboot
|
||||
- be happy
|
||||
|
||||
This script just copies content of some tables from old to the new db. Feel free to improve it.
|
||||
|
||||
Hope this will help somebody.
|
69
copy-mmssms-db.php
Normal file
69
copy-mmssms-db.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
// place paths to your files here
|
||||
$src_path = '';
|
||||
$dst_path = '';
|
||||
|
||||
$src = new SQLite3($src_path);
|
||||
$dst = new SQLite3($dst_path);
|
||||
|
||||
function copy_canonical_addresses() {
|
||||
global $src, $dst;
|
||||
$q = $src->query("SELECT * FROM canonical_addresses");
|
||||
while ($row = $q->fetchArray(SQLITE3_ASSOC)) {
|
||||
$dst->query("INSERT INTO canonical_addresses (_id, address) VALUES (".$row['_id'].", '".SQLite3::escapeString($row['address'])."')");
|
||||
}
|
||||
}
|
||||
|
||||
function copy_sms() {
|
||||
global $src, $dst;
|
||||
$q = $src->query("SELECT * FROM sms");
|
||||
while ($row = $q->fetchArray(SQLITE3_ASSOC)) {
|
||||
$keys = [];
|
||||
$values = [];
|
||||
foreach ($row as $key => $value) {
|
||||
$keys[] = "`".$key."`";
|
||||
$values[] = "'".SQLite3::escapeString($value)."'";
|
||||
}
|
||||
$dst->query("INSERT INTO sms (".implode(', ', $keys).") VALUES (".implode(', ', $values).")");
|
||||
}
|
||||
}
|
||||
|
||||
function copy_threads() {
|
||||
global $src, $dst;
|
||||
$q = $src->query("SELECT * FROM threads");
|
||||
while ($row = $q->fetchArray(SQLITE3_ASSOC)) {
|
||||
$keys = [];
|
||||
$values = [];
|
||||
foreach ($row as $key => $value) {
|
||||
if ($key == 'unread_message_count') {
|
||||
continue;
|
||||
}
|
||||
$keys[] = "`".$key."`";
|
||||
$values[] = "'".SQLite3::escapeString($value)."'";
|
||||
}
|
||||
$dst->query("INSERT INTO threads (".implode(', ', $keys).") VALUES (".implode(', ', $values).")");
|
||||
}
|
||||
}
|
||||
|
||||
function copy_words() {
|
||||
global $src, $dst;
|
||||
$tables = ['words', 'words_content', 'words_segments', 'words_segdir'];
|
||||
foreach ($tables as $table) {
|
||||
$q = $src->query("SELECT * FROM {$table}");
|
||||
while ($row = $q->fetchArray(SQLITE3_ASSOC)) {
|
||||
$keys = [];
|
||||
$values = [];
|
||||
foreach ($row as $key => $value) {
|
||||
$keys[] = "`".$key."`";
|
||||
$values[] = "'".SQLite3::escapeString($value)."'";
|
||||
}
|
||||
$dst->query("INSERT INTO {$table} (".implode(', ', $keys).") VALUES (".implode(', ', $values).")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copy_threads();
|
||||
copy_words();
|
||||
copy_sms();
|
||||
copy_canonical_addresses();
|
Loading…
x
Reference in New Issue
Block a user