quivr/scripts/20231128173900_remove_openai_api_key.sql
Zineb El Bachiri f48dab4a7d
refactor: to modules (#1754)
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
2023-11-30 22:29:28 +01:00

23 lines
506 B
SQL

DO $$
BEGIN
IF EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_name = 'brains' AND column_name = 'openai_api_key'
) THEN
-- Column exists, so drop it
ALTER TABLE brains
DROP COLUMN openai_api_key;
END IF;
END $$;
-- Update migrations table
INSERT INTO migrations (name)
SELECT '20231128173900_remove_openai_api_key'
WHERE NOT EXISTS (
SELECT 1 FROM migrations WHERE name = '20231128173900_remove_openai_api_key'
);
COMMIT;