#!/bin/bash

echo "Executing database migration for allow_sharing column..."
echo "Please enter your MySQL password when prompted."

# Execute SQL commands
mysql -u root -p notafilija << EOF
ALTER TABLE collections ADD COLUMN allow_sharing TINYINT(1) NOT NULL DEFAULT 0 AFTER is_template;
CREATE INDEX idx_collections_allow_sharing ON collections(allow_sharing);
EOF

if [ $? -eq 0 ]; then
    echo "✅ Migration completed successfully!"
else
    echo "❌ Migration failed. Please check the error above."
fi
