Skip to content

Commit

Permalink
Add data export migration
Browse files Browse the repository at this point in the history
  • Loading branch information
sjorobekov committed Dec 19, 2024
1 parent eb1f43b commit c5ea22d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/db/migrations/20241219092946_data_export.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type {Knex} from 'knex';

export async function up(knex: Knex): Promise<void> {
return knex.raw(`
CREATE TABLE data_export (
data_export_id BIGINT NOT NULL PRIMARY KEY DEFAULT get_id(),
title TEXT NOT NULL,
tenant_id TEXT,
chart_id BIGINT NOT NULL,
chart_rev_id BIGINT NOT NULL,
dataset_id BIGINT,
dataset_rev_id BIGINT NOT NULL,
connection_id BIGINT NOT NULL,
connection_rev_id BIGINT NOT NULL,
params JSONB NOT NULL DEFAULT '{}'::jsonb,
created_by TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
expired_at TIMESTAMPTZ NOT NULL,
job_id TEXT NOT NULL,
result_link TEXT,
error JSONB
);
`);
}

export async function down(knex: Knex): Promise<void> {
return knex.raw(`
DROP TABLE data_export;
`);
}

0 comments on commit c5ea22d

Please sign in to comment.