mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix(migrations): add 0004 for search_providers table
Add incremental migration for existing databases to create the search_providers table and bots.search_provider_id column introduced in the search provider feature.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
-- 0005_search_providers (down)
|
||||
ALTER TABLE bots DROP COLUMN IF EXISTS search_provider_id;
|
||||
DROP TABLE IF EXISTS search_providers;
|
||||
@@ -0,0 +1,15 @@
|
||||
-- 0005_search_providers
|
||||
-- Add search_providers table and link to bots for web search integration.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS search_providers (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name TEXT NOT NULL,
|
||||
provider TEXT NOT NULL,
|
||||
config JSONB NOT NULL DEFAULT '{}'::jsonb,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
CONSTRAINT search_providers_name_unique UNIQUE (name),
|
||||
CONSTRAINT search_providers_provider_check CHECK (provider IN ('brave'))
|
||||
);
|
||||
|
||||
ALTER TABLE bots ADD COLUMN IF NOT EXISTS search_provider_id UUID REFERENCES search_providers(id) ON DELETE SET NULL;
|
||||
Reference in New Issue
Block a user