Skip to content

Commit

Permalink
Update table model: add new columns for remote dbs (#7609)
Browse files Browse the repository at this point in the history
  • Loading branch information
PopDaph authored Sep 24, 2024
1 parent 91463e7 commit d2a429b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
4 changes: 4 additions & 0 deletions core/src/stores/migrations/20240923_add_remote_db_fields.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- pre deploy
ALTER TABLE tables ADD COLUMN remote_database_table_id TEXT; -- nullable if not a remote table
ALTER TABLE tables ADD COLUMN remote_database_secret_id TEXT; -- nullable if not a remote table

26 changes: 14 additions & 12 deletions core/src/stores/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,20 @@ pub const POSTGRES_TABLES: [&'static str; 14] = [
);",
"-- databases tables
CREATE TABLE IF NOT EXISTS tables (
id BIGSERIAL PRIMARY KEY,
created BIGINT NOT NULL,
table_id TEXT NOT NULL, -- unique within datasource
name TEXT NOT NULL, -- unique within datasource
description TEXT NOT NULL,
timestamp BIGINT NOT NULL,
tags_array TEXT[] NOT NULL,
parents TEXT[] NOT NULL,
schema TEXT, -- json, kept up-to-date automatically with the last insert
schema_stale_at BIGINT, -- timestamp when the schema was last invalidated
data_source BIGINT NOT NULL,
FOREIGN KEY(data_source) REFERENCES data_sources(id)
id BIGSERIAL PRIMARY KEY,
created BIGINT NOT NULL,
table_id TEXT NOT NULL, -- unique within datasource
name TEXT NOT NULL, -- unique within datasource
description TEXT NOT NULL,
timestamp BIGINT NOT NULL,
tags_array TEXT[] NOT NULL,
parents TEXT[] NOT NULL,
schema TEXT, -- json, kept up-to-date automatically with the last insert
schema_stale_at BIGINT, -- timestamp when the schema was last invalidated
data_source BIGINT NOT NULL,
remote_database_table_id TEXT,
remote_database_secret_id TEXT,
FOREIGN KEY(data_source) REFERENCES data_sources(id)
);",
];

Expand Down

0 comments on commit d2a429b

Please sign in to comment.