1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-13 11:17:26 +02:00
unleash.unleash/src/migrations/20241220102327-drop-ai-chats.js
Nuno Góis adaf91a791
chore: remove Unleash AI (#9010)
https://linear.app/unleash/issue/2-3071/finish-experiment

Removes Unleash AI.

Also removes other related changes made during the experiment
development.
2024-12-20 11:02:49 +00:00

27 lines
651 B
JavaScript

exports.up = function (db, cb) {
db.runSql(
`
DROP INDEX IF EXISTS idx_ai_chats_user_id;
DROP TABLE IF EXISTS ai_chats;
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`
CREATE TABLE IF NOT EXISTS ai_chats
(
id BIGSERIAL PRIMARY KEY NOT NULL,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
messages JSONB NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_ai_chats_user_id ON ai_chats(user_id);
`,
cb,
);
};