feat: implement email validation, CI/CD pipeline, migration history, and web templates
Email validation: - Replace @/. check with net/mail.ParseAddress on register - Add size limit check (max 254 chars, RFC 5321) CI/CD Pipeline: - Add .gitea/workflows/ci.yml (lint → test → build → docker push) - Registry: gitea.mrixs.me/Mrixs/MrixsCraft-server - Push only on main branch Database: - Add migrations/002_migration_history.sql (tracking applied migrations) - Add migrations/README.md (manual apply instructions) Web Templates: - Add base.html with Minecraft-themed layout (dark + green accent) - Add index.html, login.html, register.html with POST forms - Rewrite templates.go for data-driven rendering with pageData struct - Fallback placeholder preserved when templates dir missing
This commit is contained in:
12
migrations/002_migration_history.sql
Normal file
12
migrations/002_migration_history.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- 002_migration_history.sql — Track applied migrations.
|
||||
-- Run manually: psql $DATABASE_URL -f migrations/002_migration_history.sql
|
||||
|
||||
CREATE TABLE IF NOT EXISTS migration_history (
|
||||
id SERIAL PRIMARY KEY,
|
||||
filename VARCHAR(255) UNIQUE NOT NULL,
|
||||
applied_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Record this migration.
|
||||
INSERT INTO migration_history (filename) VALUES ('002_migration_history.sql')
|
||||
ON CONFLICT (filename) DO NOTHING;
|
||||
14
migrations/README.md
Normal file
14
migrations/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Migrations
|
||||
|
||||
Applied manually in order:
|
||||
|
||||
```bash
|
||||
psql "$DATABASE_URL" -f migrations/001_init.sql # schema
|
||||
psql "$DATABASE_URL" -f migrations/002_migration_history.sql # tracking
|
||||
```
|
||||
|
||||
Check applied:
|
||||
|
||||
```sql
|
||||
SELECT * FROM migration_history ORDER BY id;
|
||||
```
|
||||
Reference in New Issue
Block a user