mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
Add user page permissions to manage access to social media pages
Create the `user_page_permissions` table with foreign keys to `users` and `social_pages` tables, and add indexes for performance. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/1VOBLTw
This commit is contained in:
1 parent
344d79f5d9
commit
f305d62091
1 file changed
+14
@@ -31,6 +31,19 @@ VALUES (
|
||||
'user'
|
||||
) ON CONFLICT (username) DO NOTHING;
|
||||
|
||||
-- Créer la table user_page_permissions (permissions d'accès aux pages par utilisateur)
|
||||
CREATE TABLE IF NOT EXISTS user_page_permissions (
|
||||
id VARCHAR PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id VARCHAR NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
page_id VARCHAR NOT NULL REFERENCES social_pages(id) ON DELETE CASCADE,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
UNIQUE(user_id, page_id)
|
||||
);
|
||||
|
||||
-- Index pour optimiser les requêtes de permissions
|
||||
CREATE INDEX IF NOT EXISTS idx_user_page_permissions_user_id ON user_page_permissions(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_page_permissions_page_id ON user_page_permissions(page_id);
|
||||
|
||||
-- Liste des tables créées automatiquement par Drizzle ORM :
|
||||
-- - users (utilisateurs avec rôles)
|
||||
-- - social_pages (pages Facebook/Instagram connectées)
|
||||
@@ -41,3 +54,4 @@ VALUES (
|
||||
-- - scheduled_posts (publications programmées)
|
||||
-- - ai_generations (historique des générations IA)
|
||||
-- - post_media (relation many-to-many entre posts et media)
|
||||
-- - user_page_permissions (permissions d'accès aux pages par utilisateur)
|
||||
Reference in new issue
Block a user