Skip to content

Commit

Permalink
fix database dumpfile replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
satkunas committed Oct 15, 2024
1 parent 6accfd6 commit ca329be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addons/functions/database.functions
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ function import_mysqldump() {
check_code $?

sub_splitter
echo "Replacing create statements from the dump and removing drop statements"
echo "Replacing CREATE TABLE and DROP TABLE statements"
# This is done so that tables aren't dropped
sed -i "s/^DROP TABLE IF EXISTS /---DROP TABLE IF EXISTS /g" $dump_file
sed -i "s/^DROP TABLE IF EXISTS /-- DROP TABLE IF EXISTS /g" $dump_file
sed -i "s/CREATE TABLE /CREATE TABLE IF NOT EXISTS /g" $dump_file

echo "Replacing INSERT statements"
sed -i "s/^INSERT INTO /INSERT IGNORE INTO /g" $dump_file

# Delete this statement if its there because this table isn't in our schema anymore but some old deployments have it
sed -i 's/DELETE IGNORE FROM `dhcp_fingerprint`;//g' $dump_file
sed -i 's/DELETE IGNORE FROM `action`;//g' $dump_file
Expand Down

0 comments on commit ca329be

Please sign in to comment.