mirror of
https://git.sr.ht/~iwakuralain/text0Nly
synced 2025-07-27 15:36:11 +00:00
ahh security
modified: main/db.sql
This commit is contained in:
parent
a4f57efde7
commit
596ce57099
18
main/db.sql
18
main/db.sql
@ -26,20 +26,4 @@ CREATE TABLE registrations (
|
|||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
INDEX idx_created_at (created_at)
|
INDEX idx_created_at (created_at)
|
||||||
);
|
);
|
||||||
|
|
||||||
DELIMITER //
|
|
||||||
CREATE PROCEDURE migrate_if_needed()
|
|
||||||
BEGIN
|
|
||||||
IF EXISTS (
|
|
||||||
SELECT * FROM information_schema.columns
|
|
||||||
WHERE table_name = 'registrations' AND column_name = 'ip'
|
|
||||||
) THEN
|
|
||||||
DROP INDEX IF EXISTS idx_ip_created ON registrations;
|
|
||||||
ALTER TABLE registrations DROP COLUMN ip;
|
|
||||||
END IF;
|
|
||||||
END //
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
||||||
CALL migrate_if_needed();
|
|
||||||
DROP PROCEDURE migrate_if_needed();
|
|
Loading…
x
Reference in New Issue
Block a user