Implementa sistema de IDs curtos para pastes, substituindo hashes SHA-256. Atualiza a estrutura do banco de dados e a lógica de inserção para suportar a detecção de duplicatas. O README e a documentação de migração foram atualizados para refletir essas mudanças.

This commit is contained in:
Luiz Costa
2025-08-29 08:57:44 -03:00
parent 9abff0338b
commit 18c4b0613f
8 changed files with 334 additions and 47 deletions
+6 -4
View File
@@ -2,14 +2,16 @@
-- Execute este script para criar a estrutura do banco
CREATE TABLE IF NOT EXISTS pastes (
hash TEXT PRIMARY KEY,
short_id TEXT PRIMARY KEY,
content TEXT NOT NULL,
content_hash TEXT NOT NULL,
created_at INTEGER NOT NULL
);
-- Criar índice para melhorar performance de consultas por data
-- Criar índices para melhorar performance
CREATE INDEX IF NOT EXISTS idx_pastes_content_hash ON pastes(content_hash);
CREATE INDEX IF NOT EXISTS idx_pastes_created_at ON pastes(created_at);
-- Inserir alguns dados de exemplo (opcional)
-- INSERT OR IGNORE INTO pastes (hash, content, created_at) VALUES
-- ('a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447', 'hello world', strftime('%s', 'now'));
-- INSERT OR IGNORE INTO pastes (short_id, content, content_hash, created_at) VALUES
-- ('Ly34kx3', 'hello world', 'a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447', strftime('%s', 'now'));