Last active
August 4, 2022 12:09
-
-
Save RobbiNespu/485c1a0b648b4ffb99a1e1ea60750db9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE IF NOT EXISTS `maxxan_coa` /*!40100 DEFAULT CHARACTER SET utf8mb4 */; | |
USE `maxxan_coa`; | |
CREATE TABLE `details` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`who` varchar(100) DEFAULT NULL, | |
`original_link` varchar(100) DEFAULT NULL, | |
`descriptions` text DEFAULT NULL, | |
`img_folder` varchar(255) DEFAULT NULL, | |
`status` enum('✅ Available','⏳ Booked','⛔ Hold','❌ Rented','❌ Sold') DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=1000001 DEFAULT CHARSET=utf8mb4; | |
ALTER TABLE maxxan_coa.details ADD created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; | |
ALTER TABLE maxxan_coa.details ADD modified TIMESTAMP null ; | |
--- trigger for created | |
CREATE DEFINER=`root`@`localhost` TRIGGER details_before_insert | |
BEFORE INSERT | |
ON details FOR EACH row | |
BEGIN | |
SET NEW.created = new.created; | |
END; | |
--- trigger for modified | |
CREATE DEFINER=`root`@`localhost` TRIGGER details_before_update | |
BEFORE UPDATE | |
ON details FOR EACH ROW | |
BEGIN | |
SET NEW.modified = CURRENT_TIMESTAMP(); | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment