The DEV SEC IT is a comprehensive toolkit designed to simplify the process of migrating data from a MySQL database to Firestore. It provides a user-friendly interface for selecting and migrating individual tables, ensuring a seamless transition from one database to another. The migration tool is designed to migrate data from a MySQL database to Firestore. It provides a simple web interface for selecting tables and migrating them to Firestore.
This tool allows you to migrate data from a MySQL database to Firestore one table at a time. It provides a simple web interface to select tables and migrate them individually.
- User authentication through login form
- Secure session-based credential storage
- Tests database and Firestore connections
- Lists all tables in the database
- Allows selection of individual tables for migration
- Migrates selected table data to Firestore in document format
- Responsive and modern UI with external CSS styling
- AJAX operations without page reloads
- Toast notifications for status updates
-
Server Requirements
- PHP 5.6 or higher
- MySQL database access
- Internet connection for Firestore communication
- cURL extension enabled in PHP
-
Installation
- Place all files on a PHP-enabled web server
- Ensure the server supports sessions
- Access
login.phpthrough your web browser
-
Login
- Access
login.phpin your web browser - Enter your MySQL credentials:
- Host (e.g., localhost)
- Username
- Password
- Database name
- Enter your Firestore credentials:
- Firestore Project ID
- Firestore Service Account JSON
- Click "Connect and Continue"
- Access
-
Verify Connections
- Click the "Test MySQL & Firestore Connections" button to verify your configurations
-
Load Tables
- Click the "Load Database Tables" button to fetch all tables from your database
-
Select and Migrate
- Choose a table from the list
- Click "Sync" button next to any table to migrate it to Firestore
-
Logout
- Click the "Logout" button to end your session
- All credentials are cleared from the session
- The tool accepts your database credentials through a secure login form
- Credentials are stored in PHP sessions only for the duration of your visit
- When you select a table, it fetches all data from that table
- The data is converted to Firestore document format
- The documents are sent to your Firestore database using the Firestore REST API
- Each MySQL table becomes a Firestore collection with documents for each row
To use this tool:
- Go to Firebase Console → Project Settings → Service accounts
- Click "Generate new private key"
- Download the JSON file
- Copy the entire JSON content and paste it in the login form
- Enter your Firestore Project ID (found in Project Settings → General)
After migration, your Firestore database will have the following structure:
collections:
table_name_1:
document_1:
column1: "value1"
column2: "value2"
document_2:
column1: "value3"
column2: "value4"
table_name_2:
// ... documents from second table
Each MySQL table becomes a Firestore collection, and each row becomes a document in that collection.
This tool implements several security measures for public hosting:
- Session-Based Storage: Credentials are stored in PHP sessions, not on the server
- HTTP-Only Cookies: Session cookies are protected against XSS attacks
- Secure Cookies: Cookies are marked as secure when using HTTPS
- Strict Session Mode: Prevents session fixation attacks
- No Persistent Storage: No credentials are saved to files or databases
For the tool to work properly with your Firestore project:
-
Enable Firestore:
- Go to Firebase Console
- Click "Firestore Database" in the left sidebar
- Create a database if you haven't already
-
Service Account Permissions:
- The service account should have permissions to read/write to Firestore
- Default service accounts usually have the necessary permissions
-
Verify Your Project ID:
- Make sure you're using the correct Project ID
- It can be found in Project Settings → General
Connection Test Fails:
- Verify your MySQL credentials are correct
- Check that your MySQL server is running and accessible
- Confirm your Firestore Service Account JSON is valid
- Ensure your Project ID is correct
Sync Fails with Authentication Error:
- Verify your Firestore Service Account JSON is valid
- Ensure your Firestore project has the Firestore API enabled
- Check that your service account has the necessary permissions
Sync Fails with 404 Error:
- Verify your Project ID is correct
- Check that Firestore is enabled in your Firebase project
- Make sure the Google Cloud Firestore API is enabled
Tables Not Loading:
- Make sure your MySQL credentials are correct
- Check that the database contains tables
- Verify that the MySQL user has permissions to access the database
The project consists of the following files:
login.php- User authentication and credential entryindex.php- Main application interfaceconfig.php- Application configuration and security settingsstyle.css- Styling for the application interfaceREADME.md- This documentation fileinit.php- Initialization script (optional)