AeThex-OS/temp-forge-extract/aethex-forge-main/find_missing_user_id.sh
MrPiglr b3c308b2c8 Add functional marketplace modules, bottom nav bar, root terminal, arcade games
- ModuleManager: Central tracking for installed marketplace modules
- DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module)
- BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings
- RootShell: Real root command execution utility
- TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands
- Terminal Pro module: Adds aliases (ll, la, h), command history
- ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games
- fade_in/fade_out animations for smooth transitions
2026-02-18 22:03:50 -07:00

22 lines
1 KiB
Bash

#!/bin/bash
# Find tables with policies referencing user_id but no user_id column in CREATE TABLE
grep -n "create table" apply_missing_migrations.sql | while read line; do
line_num=$(echo "$line" | cut -d: -f1)
table_name=$(echo "$line" | grep -oP 'create table.*?public\.\K[a-z_]+' || echo "$line" | grep -oP 'CREATE TABLE.*?\K[a-z_]+')
if [ ! -z "$table_name" ]; then
# Get the CREATE TABLE block (next 30 lines)
table_def=$(sed -n "${line_num},$((line_num+30))p" apply_missing_migrations.sql)
# Check if this table has user_id in its definition
has_user_id=$(echo "$table_def" | grep -c "user_id")
# Check if there are policies for this table that reference user_id
has_policy_user_id=$(grep -c "policy.*on.*${table_name}.*user_id" apply_missing_migrations.sql)
if [ "$has_policy_user_id" -gt 0 ] && [ "$has_user_id" -eq 0 ]; then
echo "⚠️ Table: $table_name - Has policies with user_id but CREATE TABLE has no user_id column"
fi
fi
done