MySQL Paste Schema + Queries
MySQL Paste Schema + Queries
==============================
-- PasteText Database Schema
CREATE TABLE pastes (
id INT PRIMARY KEY AUTO_INCREMENT,
public_id VARCHAR(12) UNIQUE,
title VARCHAR(255),
content TEXT NOT NULL,
member VARCHAR(50),
visible TINYINT DEFAULT 1,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
expires_at TIMESTAMP NULL
);
-- Recent public pastes
SELECT public_id, title, created_at
FROM pastes
WHERE visible=1 AND (expires_at IS NULL OR expires_at > NOW())
ORDER BY created_at DESC LIMIT 10;
-- Admin delete
DELETE FROM pastes WHERE public_id = ?;
Featured
Advertisement
Category
Action