Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/update.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Add date column to dependencies table if it doesn't exist (for parallel installation tracking)
ALTER TABLE dependencies ADD COLUMN date TEXT;
-- Note: This migration is handled by cauldron_update script to ensure idempotency

INSERT INTO "familiars" ("id", "name", "display_name", "familiar_type", "unlocked", "cow_src_ext", "nickname") VALUES ('8', 'vault-boy', NULL, 'Meme', '1', '1', NULL);
INSERT INTO "familiars" ("id", "name", "display_name", "familiar_type", "unlocked", "cow_src_ext", "nickname") VALUES ('9', 'wheatley', NULL, 'Meme', '1', '1', NULL);
Expand Down
48 changes: 42 additions & 6 deletions functions/cauldron_repair.fish
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,21 @@ function cauldron_repair --description "Repair broken Cauldron installation"
end
end

# Check 4: Verify functions are installed
# Check 4: Verify dependencies table has date column
if test -f "$CAULDRON_DATABASE"
echo "→ Checking dependencies table schema..."
set -l has_date_column (sqlite3 "$CAULDRON_DATABASE" "PRAGMA table_info(dependencies);" 2>/dev/null | grep -c "date")

if test $has_date_column -eq 0
set issues_found (math $issues_found + 1)
set -a issues "Dependencies table missing 'date' column (required for parallel installs)"
echo " ✗ Dependencies table schema outdated"
else
echo " ✓ Dependencies table schema OK"
end
end

# Check 5: Verify functions are installed
echo "→ Checking Fish functions..."
set -l functions_dir "$HOME/.config/cauldron/functions"

Expand Down Expand Up @@ -114,7 +128,7 @@ function cauldron_repair --description "Repair broken Cauldron installation"
end
end

# Check 5: Verify data files
# Check 6: Verify data files
echo "→ Checking data files..."
set -l required_files palettes.json spinners.json

Expand All @@ -135,7 +149,7 @@ function cauldron_repair --description "Repair broken Cauldron installation"
echo " ✓ Data files OK"
end

# Check 6: Verify Fish config
# Check 7: Verify Fish config
echo "→ Checking Fish configuration..."
set -l fish_config "$HOME/.config/fish/config.fish"

Expand Down Expand Up @@ -216,7 +230,29 @@ function cauldron_repair --description "Repair broken Cauldron installation"
end
end

# Fix 2: Reinstall functions
# Fix 2: Update dependencies table schema
if string match -q "*Dependencies table*" -- $issues
echo " → Updating dependencies table schema..."

# Check if the date column exists before trying to add it
set -l has_date_column (sqlite3 "$CAULDRON_DATABASE" "PRAGMA table_info(dependencies);" 2>/dev/null | grep -c "date")

if test $has_date_column -eq 0
sqlite3 "$CAULDRON_DATABASE" "ALTER TABLE dependencies ADD COLUMN date TEXT;" 2>/dev/null

if test $status -eq 0
echo " ✓ Added date column to dependencies table"
set issues_fixed (math $issues_fixed + 1)
else
echo " ✗ Failed to add date column"
end
else
echo " ✓ Date column already exists"
set issues_fixed (math $issues_fixed + 1)
end
end

# Fix 3: Reinstall functions
if string match -q "*function*" -- $issues
echo " → Reinstalling functions..."

Expand Down Expand Up @@ -244,7 +280,7 @@ function cauldron_repair --description "Repair broken Cauldron installation"
set issues_fixed (math $issues_fixed + 1)
end

# Fix 3: Restore data files
# Fix 4: Restore data files
if string match -q "*data file*" -- $issues
echo " → Restoring data files..."

Expand All @@ -262,7 +298,7 @@ function cauldron_repair --description "Repair broken Cauldron installation"
set issues_fixed (math $issues_fixed + 1)
end

# Fix 4: Fix Fish config
# Fix 5: Fix Fish config
if string match -q "*Fish config*" -- $issues
echo " → Updating Fish configuration..."

Expand Down
7 changes: 7 additions & 0 deletions update/cauldron_update.fish
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ function cauldron_update -d 'Update Cauldron to the latest version'
sqlite3 $CAULDRON_DATABASE < $CAULDRON_PATH/data/update.sql 2> /dev/null
end

# Add date column to dependencies table if it doesn't exist (for parallel installation tracking)
# Check if the column exists before trying to add it
set has_date_column (sqlite3 $CAULDRON_DATABASE "PRAGMA table_info(dependencies);" | grep -c "date")
if test $has_date_column -eq 0
sqlite3 $CAULDRON_DATABASE "ALTER TABLE dependencies ADD COLUMN date TEXT;" 2> /dev/null
end

# List of folders with functions
set CAULDRON_LOCAL_DIRS "alias" "cli" "config" "effects" "functions" "familiar" "internal" "setup" "text" "UI" "update"

Expand Down
Loading