Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add automated actions tables #5857

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/migrations/20240111125100-automated-actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
exports.up = function (db, cb) {
db.runSql(
`
CREATE TABLE IF NOT EXISTS action_sets
(
id SERIAL PRIMARY KEY NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
created_by_user_id INTEGER,
name varchar(255),
actor_id INTEGER,
source varchar(255),
source_id INTEGER,
payload JSONB DEFAULT '{}'::jsonb NOT NULL,
FOREIGN KEY (project) references projects(id) ON DELETE CASCADE,
gastonfournier marked this conversation as resolved.
Show resolved Hide resolved
);

CREATE TABLE IF NOT EXISTS actions
(
id SERIAL PRIMARY KEY NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
created_by_user_id INTEGER,
action_set_id INTEGER references action_sets (id) ON DELETE CASCADE,
sort_order INTEGER,
action varchar(255) NOT NULL,
execution_params JSONB DEFAULT '{}'::jsonb NOT NULL,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another trailing comma ☝️

);

CREATE INDEX idx_action_sets_project ON action_sets (project);
`,
cb,
);
};

exports.down = function (db, cb) {
db.runSql(
`
DROP INDEX IF EXISTS idx_action_sets_project;
DROP TABLE IF EXISTS actions;
DROP TABLE IF EXISTS action_sets;
`,
cb,
);
};
Loading