quivr/scripts/202307111517030_add_subscription_invitations_table.sql
Zineb El Bachiri f837a6e9b9
Feat/shareable brains send link be (#599)
* 🗃️ new table for invitations to subscribe to brain

*  new BrainSubscription class

*  new subscription router

* 👽️ add RESEND_API_KEY to .env in BE

* 📦 add 'resend' lib to requirements

* ♻️ fix some stanGPT
2023-07-11 18:20:31 +02:00

19 lines
505 B
PL/PgSQL

BEGIN;
-- Create brain_subscription_invitations table if it doesn't exist
CREATE TABLE IF NOT EXISTS brain_subscription_invitations (
brain_id UUID,
email VARCHAR(255),
rights VARCHAR(255),
PRIMARY KEY (brain_id, email),
FOREIGN KEY (brain_id) REFERENCES Brains (brain_id)
);
INSERT INTO migrations (name)
SELECT '202307111517030_add_subscription_invitations_table'
WHERE NOT EXISTS (
SELECT 1 FROM migrations WHERE name = '202307111517030_add_subscription_invitations_table'
);
COMMIT;