wip
This commit is contained in:
@@ -14,6 +14,7 @@ fi
|
||||
|
||||
IMPORT_MYTHICPLUS_SQL="${ACORE_IMPORT_MYTHICPLUS_SQL:-1}"
|
||||
IMPORT_STORE_SQL="${ACORE_IMPORT_STORE_SQL:-1}"
|
||||
IMPORT_ENCOUNTER_JOURNAL_SQL="${ACORE_IMPORT_ENCOUNTER_JOURNAL_SQL:-1}"
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
@@ -234,6 +235,49 @@ import_aoe_loot_sql() {
|
||||
import_sql_file "acore_world" "$aoe_loot_sql_file"
|
||||
}
|
||||
|
||||
import_encounter_journal_sql() {
|
||||
local schema_file="$ROOT_DIR/modules/mod-encounter-journal/data/sql/db-world/base/01_encounter_journal_schema.sql"
|
||||
local sample_file="$ROOT_DIR/modules/mod-encounter-journal/data/sql/db-world/base/02_encounter_journal_sample.sql"
|
||||
|
||||
if [[ "$IMPORT_ENCOUNTER_JOURNAL_SQL" == "0" ]]; then
|
||||
log "Encounter Journal SQL import disabled, skipped"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ ! -f "$schema_file" ]]; then
|
||||
log "mod-encounter-journal schema SQL not found, skipped"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Schema file uses CREATE TABLE IF NOT EXISTS, but we still gate on the
|
||||
# canonical tier table to avoid noisy re-imports on every bootstrap.
|
||||
if ! table_exists "acore_world" "custom_ej_tier"; then
|
||||
import_sql_file "acore_world" "$schema_file"
|
||||
else
|
||||
log "custom_ej_* schema already present, skipping"
|
||||
fi
|
||||
|
||||
# Sample data only on a fresh install (no rows in any custom_ej_* table).
|
||||
# Re-running it would clobber hand-edited rows in the 9000-9999 id range.
|
||||
if [[ -f "$sample_file" ]]; then
|
||||
local total
|
||||
total="$(mysql_query "acore_world" "
|
||||
SELECT (SELECT COUNT(*) FROM custom_ej_tier)
|
||||
+ (SELECT COUNT(*) FROM custom_ej_instance)
|
||||
+ (SELECT COUNT(*) FROM custom_ej_encounter)
|
||||
+ (SELECT COUNT(*) FROM custom_ej_creature)
|
||||
+ (SELECT COUNT(*) FROM custom_ej_section)
|
||||
+ (SELECT COUNT(*) FROM custom_ej_loot);
|
||||
")"
|
||||
|
||||
if [[ "$total" == "0" ]]; then
|
||||
import_sql_file "acore_world" "$sample_file"
|
||||
else
|
||||
log "custom_ej_* tables already populated, skipping sample data"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if (($# > 0)); then
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
@@ -250,6 +294,7 @@ fi
|
||||
|
||||
require_integer_flag "ACORE_IMPORT_MYTHICPLUS_SQL" "$IMPORT_MYTHICPLUS_SQL"
|
||||
require_integer_flag "ACORE_IMPORT_STORE_SQL" "$IMPORT_STORE_SQL"
|
||||
require_integer_flag "ACORE_IMPORT_ENCOUNTER_JOURNAL_SQL" "$IMPORT_ENCOUNTER_JOURNAL_SQL"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
@@ -260,6 +305,7 @@ fi
|
||||
|
||||
import_mythicplus_sql
|
||||
import_aoe_loot_sql
|
||||
import_encounter_journal_sql
|
||||
import_store_sql
|
||||
|
||||
log "custom SQL bootstrap completed"
|
||||
|
||||
Reference in New Issue
Block a user