🔧 Database Structure Fix Tool
Step 1: Checking BuySms table structure...
| Column Name | Type | Status |
|---|
| validity_days | INT DEFAULT 0 | ✓ EXISTS |
| validity_hours | INT DEFAULT 0 | ✓ EXISTS |
| validity_minutes | INT DEFAULT 0 | ✓ EXISTS |
✓ All required columns already exist in BuySms table!
Step 3: Checking SMS table...
✓ SMS.validity_minutes already exists!
Step 4: Adding indexes for performance...
ℹ Index idx_expiry_status already exists
Step 5: Final structure verification...
| Column | Type | Null | Default |
|---|
| id | int(11) | NO | NULL |
| user_id | int(11) | NO | NULL |
| phone | varchar(15) | NO | NULL |
| package_id | int(11) | NO | NULL |
| sms_count | int(11) | NO | NULL |
| price | decimal(10,2) | NO | NULL |
| previous_balance | decimal(10,2) | YES | NULL |
| new_balance | decimal(10,2) | YES | NULL |
| previous_sms | int(11) | YES | NULL |
| new_sms | int(11) | YES | NULL |
| purchase_date | datetime | YES | current_timestamp() |
| expiry_date | datetime | NO | NULL |
| validity_days | int(11) | YES | 0 |
| validity_hours | int(11) | YES | 0 |
| validity_minutes | int(11) | YES | 0 |
| expired_at | datetime | YES | NULL |
| status | enum('active','completed','expired','cancelled') | YES | active |
| expired_sms | int(11) | YES | 0 |
Step 6: Testing insert query...
✗ Test insert failed: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`ftbbdxyz_tallydb`.`BuySms`, CONSTRAINT `BuySms_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account` (`id`))
✅ Database Fix Complete!
আপনার database এখন সম্পূর্ণ প্রস্তুত। এখন:
- buy_sms.php আপলোড করুন
- Android App থেকে SMS প্যাকেজ কিনুন
- Cron job চেক করুন:
/app/test_expire.php