1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
unleash.unleash/src/migrations/20231212094044-event-created-by-user-id.js
David Leek d632690203
chore: add created by user id to events (#5621)
## About the changes

Adds the column `created_by_user_id` to `events` table and adds index
for it

---------

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2023-12-12 15:57:59 +01:00

22 lines
515 B
JavaScript

'use strict';
exports.up = function (db, callback) {
db.runSql(
`
ALTER TABLE events ADD COLUMN IF NOT EXISTS created_by_user_id INTEGER;
CREATE INDEX events_created_by_user_id_idx ON events(created_by_user_id);
`,
callback,
);
};
exports.down = function (db, callback) {
db.runSql(
`
DROP INDEX IF EXISTS events_created_by_user_id_idx;
ALTER TABLE events DROP COLUMN IF EXISTS created_by_user_id;
`,
callback,
);
};