diff options
author | Freya Murphy <freya@freyacat.org> | 2024-05-20 19:26:59 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-05-20 19:26:59 -0400 |
commit | 29f7c5ea41d36509d8e5961f40a7af0a934a7ca1 (patch) | |
tree | 722c420750b16c9ef25eb77410813942f146446f /src/shim/shim.php | |
parent | a (diff) | |
download | xssbook2-29f7c5ea41d36509d8e5961f40a7af0a934a7ca1.tar.gz xssbook2-29f7c5ea41d36509d8e5961f40a7af0a934a7ca1.tar.bz2 xssbook2-29f7c5ea41d36509d8e5961f40a7af0a934a7ca1.zip |
aaaa
Diffstat (limited to 'src/shim/shim.php')
-rwxr-xr-x | src/shim/shim.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shim/shim.php b/src/shim/shim.php index a1a3eca..318d825 100755 --- a/src/shim/shim.php +++ b/src/shim/shim.php @@ -266,6 +266,18 @@ function migrate_user_media($type) { } } +function migrate_seq() { + echo "migrating sequences\n"; + extract($GLOBALS); + + $tables = array('user', 'post', 'like', 'comment', 'follow', 'user_media'); + + foreach ($tables as $table) { + $sql = "SELECT setval('sys.{$table}_id_seq', (SELECT MAX(id) FROM admin.{$table}), true);"; + $psql->exec($sql); + } +} + try { wait_until_ready(); clear_all(); @@ -276,6 +288,7 @@ try { migrate_follow(); migrate_user_media('avatar'); migrate_user_media('banner'); + migrate_seq(); } catch (Exception $ex) { echo "$ex\n"; $psql->rollBack(); |