feat: add database schema and SQLx migrations
- 5 reversible migrations: extensions/enums, tables, indexes, views, config seed - Tables: event, user, session, upload, hashtag, upload_hashtag, comment, comment_hashtag, like, export_job, config - Views: v_feed (uploads with like/comment counts), v_hashtag_counts - Indexes optimised for feed queries, session lookup, hashtag filtering - Config table seeded with default rate limits and quotas - db.rs module: PgPool creation with auto-migration on startup - docker-compose.override.yml: expose db port 5432 for local dev - Fix crate names: async_zip, tower_governor (underscore, not hyphen) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
11
backend/migrations/002_tables.down.sql
Normal file
11
backend/migrations/002_tables.down.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
DROP TABLE IF EXISTS config;
|
||||
DROP TABLE IF EXISTS export_job;
|
||||
DROP TABLE IF EXISTS "like";
|
||||
DROP TABLE IF EXISTS comment_hashtag;
|
||||
DROP TABLE IF EXISTS comment;
|
||||
DROP TABLE IF EXISTS upload_hashtag;
|
||||
DROP TABLE IF EXISTS hashtag;
|
||||
DROP TABLE IF EXISTS upload;
|
||||
DROP TABLE IF EXISTS session;
|
||||
DROP TABLE IF EXISTS "user";
|
||||
DROP TABLE IF EXISTS event;
|
||||
Reference in New Issue
Block a user