Apex Software Platform

Apex Training - Create Database Tables

Many of you will probably groan, but at Apex we strongly believe that SQL database schemas should be written in, well... SQL. If you do not know SQL, it is an extremely easy language to learn the basics, and can dramatically improve the architecture, performance, and stability of your software. You will notice there is a blank file at /etc/training/install.sql, and this file is executed against the database upon installation of the package.

Open the /etc/training/install.sql file, and enter the following contents:



DROP TABLE IF EXISTS lotteries; CREATE TABLE lotteries ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, userid INT NOT NULL, amount DECIMAL(16,8) NOT NULL, total_entries INT NOT NULL, date_added TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (userid) REFERENCES users (id) ON DELETE CASCADE ) engine=InnoDB;

Now simply connect to mySQL via terminal, and copy and paste the above SQL into the mySQL prompt to create the necessary tables.

Next

Now that we have a small database structure, let's move on to Creating a Library.

Need a Developer?

Taking work, any size or scope, and your imagination is the only limit. Contact me for a free consultation at [email protected].

Recent News

Apex v1.5 Released!
Auto-Install via YAML, Preloading, CRUD Scaffolding, Code ReOrganization, Import / Export between Packages, and more...
Apex v1.4.0 Released!
New Package Format, Service Providers and Adapters, New Theme Tools, and more
Apex v1.3.0 Released!
PHP 7.4, Docker, git Integration, 96.4% Test Coverage, and more!

Mailing List

Subscribe to the low traffic mailing list to stay updated on Apex.

Admin Screenshot