Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

ProtoWeb Initial MySQL Schema

This repository contains the initial MySQL database schema
used in the Protoweb project.

Overview

  • File: proto_web_schema.sql
  • Tables use the MyISAM storage engine.
  • Date fields are defined as DATETIME (not TIMESTAMP).
  • Some unused fields are preserved for compatibility with an older system.

Design Notes

🧱 Engine: MyISAM

The schema uses the MyISAM engine due to legacy and compatibility reasons:

  • Required by a related CodeIgniter 3 system still in production.
  • Offers simpler file-based storage with minimal resource overhead.
  • Allows broader compatibility with servers where InnoDB is not guaranteed.

⚠️ Note: MyISAM does not support foreign keys or transactions.


🕒 Date Fields: DATETIME (2038-Safe)

All temporal fields use DATETIME instead of TIMESTAMP because:

  • TIMESTAMP in MySQL is limited to the year 2038 (32-bit signed int).
  • DATETIME supports a wider date range (1000-01-01 to 9999-12-31) and is not affected by the 2038 problem.
  • Timezone-independent behavior ensures consistency across environments.

❗Manual Updates Required

Because DATETIME does not auto-update,
you must set values explicitly in PHP.

PHP Examples
// Manual update using NOW()
$db->query('UPDATE my_table SET updated_at = NOW() WHERE id = ?', [$id]);

// CodeIgniter active record with raw expression
$this->db->set('updated_at', 'NOW()', false);

// Manual value using PHP
$data = [
    'updated_at' => date('Y-m-d H:i:s')
];
$this->db->update('my_table', $data);

🗃️ Legacy Fields and Compatibility

This schema includes unused or legacy fields that are retained for:

  • Full compatibility with an older CodeIgniter 3-based system.
  • Smooth migration between shared codebases.
  • Avoiding breakage in shared libraries or controllers that expect those fields.

Feel free to ignore or remove them if you're building a fresh implementation.


📦 Import Instructions

To import the schema into your MySQL server:

mysql -u your_user -p your_database < proto_web_schema.sql

⚖ License

BSD 2-Clause License — see LICENSE

About

ProtoWeb (Databases)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors