Upgrading LWT
This guide covers how to upgrade Learning with Texts to a newer version safely.
How Upgrades Work
LWT uses an automatic database migration system. When you start LWT after updating the files, it automatically:
- Detects your current database version
- Runs any pending migrations to update the database schema
- Updates the
dbversionsetting to match the current version
This means most upgrades are seamless - just replace the files and open LWT.
Standard Upgrade Process
Step 1: Backup Your Data
Before any upgrade, create backups:
Database backup (recommended):
- Open LWT in your browser
- Go to Settings (gear icon)
- Click Backup/Restore/Empty Database
- Click Backup ENTIRE Database to download a backup file
File backup:
Copy your entire LWT directory to a safe location. Important files include:
.env- Your database configurationmedia/- Your audio files (if you created this folder)
Step 2: Download the New Version
Get the latest release:
- Stable releases: GitHub Releases
- Latest development: Download main branch
Step 3: Replace Files
- Extract the new version
- Copy your
.envfile from the backup into the new LWT directory - Copy your
media/folder (if it exists) into the new directory - Replace the old LWT directory with the new one
Step 4: Clear Browser Cache
Clear your browser cache to ensure you're loading the new JavaScript and CSS files. You can also try:
- Hard refresh:
Ctrl+Shift+R(Windows/Linux) orCmd+Shift+R(Mac) - Or open LWT in a private/incognito window
Step 5: Open LWT
Open LWT in your browser as usual. The database will be automatically updated if needed.
Docker Upgrades
If you're using Docker:
# Stop the current container
docker compose down
# Pull the latest image (if using pre-built images)
docker compose pull
# Or rebuild from source
docker compose build --no-cache
# Start the updated container
docker compose up -dYour data persists in Docker volumes, so it will be preserved across upgrades.
Upgrading from Very Old Versions
If you're upgrading from a version older than 2.7.0 (released before 2022), special considerations apply:
Database Schema Changes
Older versions used a different database structure. The migration system will attempt to convert your data, but for very old versions:
- Export your data first: Use LWT's export features to save your terms and texts
- Consider a fresh install: Create a new database, then import your exported data
- Test thoroughly: After upgrading, verify your terms and texts are intact
Configuration File Changes
- Versions before 3.0 used
connect.inc.phpinstead of.env - If upgrading from these versions, create a new
.envfile based on.env.example - Copy your database credentials from
connect.inc.phpto.env
PHP Version Requirements
Modern LWT requires PHP 8.1 or higher. If your server runs an older PHP version, you'll need to upgrade PHP first.
| LWT Version | Minimum PHP |
|---|---|
| 3.0+ | PHP 8.1 |
| 2.9.x | PHP 8.0 |
| 2.0-2.8 | PHP 7.4 |
| < 2.0 | PHP 5.6 |
Troubleshooting
"Database needs to be reinstalled" Error
This usually means the migration couldn't complete. Try:
- Restore your database backup
- Check that your
.envcredentials are correct - Ensure your MySQL/MariaDB user has ALTER TABLE permissions
Features Not Working After Upgrade
Clear browser cache completely
Check browser console (F12) for JavaScript errors
Rebuild assets if you're running from source:
bashnpm install npm run build:all
Tests Not Auto-Advancing
If tests don't advance to the next word after upgrading:
- Clear your browser cache
- Check if JavaScript is loading correctly (F12 > Console)
- Try a different browser to isolate the issue
Database Connection Errors
Verify your .env file has the correct settings:
DB_HOST=localhost # Or your database host
DB_USER=root # Your database username
DB_PASSWORD= # Your database password
DB_NAME=learning-with-textsChecking Your Version
To see your current LWT version:
- Look at the footer of any LWT page
- Or check the
dbversionvalue in your database'ssettingstable
Downgrading
Downgrading is not officially supported because newer database migrations cannot be reversed automatically. If you need to downgrade:
- Restore your database backup from before the upgrade
- Use the older LWT files
This is why backups before upgrading are essential.
Getting Help
If you encounter issues:
- GitHub Issues - Report bugs or search existing issues