-- Database schema for DROPNAME drop
-- Table naming convention: <drop-name>_<table-name>

CREATE TABLE IF NOT EXISTS DROPNAME_items (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    data TEXT NOT NULL,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

-- Index for faster queries
CREATE INDEX IF NOT EXISTS idx_DROPNAME_items_created 
    ON DROPNAME_items(created_at);

-- Trigger to update updated_at timestamp
CREATE TRIGGER IF NOT EXISTS update_DROPNAME_items_timestamp 
    AFTER UPDATE ON DROPNAME_items
BEGIN
    UPDATE DROPNAME_items SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.id;
END;
