How to manage database changes on your extensions
When creating our main component, we had to create database tables to store our data manually in the database. This is not the best way to deliver a proper component to the world, especially since Joomla! allows us to create our database tables automatically on component installation.
To make Joomla! create our tables, we need to provide it with a SQL command. So, let’s add the src/component/admin/sql/install/mysql/install.sql
file and copy the content of the mock-data/src/database.sql
file:
CREATE TABLE IF NOT EXISTS '#__spm_projects' ( 'id' int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 'name' VARCHAR(255) NOT NULL, 'alias' VARCHAR(255) NOT NULL, 'description' TEXT, 'deadline' DATETIME, 'category' INT(11), ...