Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Change db_table to tbl

天舟24eb0a054a4c
diff --git a/backend/store/migration/0001_init_schema.down.sql b/backend/store/migration/0001_init_schema.down.sql
index 9eb35c75e4..3e765e140a 100644
--- a/backend/store/migration/0001_init_schema.down.sql
+++ b/backend/store/migration/0001_init_schema.down.sql
@@ -14,7 +14,7 @@ DROP TABLE pipeline;
DROP TABLE data_source;
-DROP TABLE db_table;
+DROP TABLE tbl;
DROP TABLE db;
diff --git a/backend/store/migration/0001_init_schema.up.sql b/backend/store/migration/0001_init_schema.up.sql
index 61ff384e26..4ab96c52c6 100644
--- a/backend/store/migration/0001_init_schema.up.sql
+++ b/backend/store/migration/0001_init_schema.up.sql
@@ -284,9 +284,9 @@ WHERE
END;
--- db_table stores the table for a particular database
+-- tbl stores the table for a particular database
-- data is synced periodically from the instance
-CREATE TABLE db_table (
+CREATE TABLE tbl (
id INTEGER PRIMARY KEY AUTOINCREMENT,
row_status TEXT NOT NULL CHECK (
row_status IN ('NORMAL', 'ARCHIVED', 'PENDING_DELETE')
@@ -312,14 +312,14 @@ CREATE TABLE db_table (
INSERT INTO
sqlite_sequence (name, seq)
VALUES
- ('db_table', 1000);
+ ('tbl', 1000);
-CREATE TRIGGER IF NOT EXISTS `trigger_update_db_table_modification_time`
+CREATE TRIGGER IF NOT EXISTS `trigger_update_tbl_modification_time`
AFTER
UPDATE
- ON `db_table` FOR EACH ROW BEGIN
+ ON `tbl` FOR EACH ROW BEGIN
UPDATE
- `db_table`
+ `tbl`
SET
updated_ts = (strftime('%s', 'now'))
WHERE
diff --git a/backend/store/seed/0071_db_table.sql b/backend/store/seed/0071_db_table.sql
deleted file mode 100644
index 1467fbe983..0000000000
--- a/backend/store/seed/0071_db_table.sql
+++ /dev/null
@@ -1,2 +0,0 @@
--- db_table is populated via schema sync, so no seed data here.
--- Creating this file just to reduce confusion in case people may wonder whether we miss the file.
\ No newline at end of file
diff --git a/backend/store/seed/0071_tbl.sql b/backend/store/seed/0071_tbl.sql
new file mode 100644
index 0000000000..2bacb747fd
--- /dev/null
+++ b/backend/store/seed/0071_tbl.sql
@@ -0,0 +1,2 @@
+-- tbl is populated via schema sync, so no seed data here.
+-- Creating this file just to reduce confusion in case people may wonder whether we miss the file.
\ No newline at end of file
diff --git a/backend/store/table.go b/backend/store/table.go
index 283d73845c..aeb2a5d441 100644
--- a/backend/store/table.go
+++ b/backend/store/table.go
@@ -107,7 +107,7 @@ func (s *TableService) PatchTable(ctx context.Context, patch *api.TablePatch) (*
func (s *TableService) createTable(ctx context.Context, tx *Tx, create *api.TableCreate) (*api.Table, error) {
// Insert row into table.
row, err := tx.QueryContext(ctx, `
- INSERT INTO db_table (
+ INSERT INTO tbl (
creator_id,
updater_id,
database_id,
@@ -192,7 +192,7 @@ func (s *TableService) findTableList(ctx context.Context, tx *Tx, find *api.Tabl
index_size,
sync_status,
last_successful_sync_ts
- FROM db_table
+ FROM tbl
WHERE `+strings.Join(where, " AND "),
args...,
)
@@ -248,7 +248,7 @@ func (s *TableService) patchTable(ctx context.Context, tx *Tx, patch *api.TableP
// Execute update query with RETURNING.
row, err := tx.QueryContext(ctx, `
- UPDATE db_table
+ UPDATE tbl
SET `+strings.Join(set, ", ")+`
WHERE id = ?
RETURNING id, creator_id, created_ts, updater_id, updated_ts, database_id, name, engine, collation, row_count, data_size, index_size, sync_status, last_successful_sync_ts