Skip to content

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

chore: sync dev's latest schema with prod (#1476)

Yilong Lic05e0b855094
diff --git a/store/migration/dev/LATEST.sql b/store/migration/dev/LATEST.sql
index 8f2710e950..c029db0bf0 100644
--- a/store/migration/dev/LATEST.sql
+++ b/store/migration/dev/LATEST.sql
@@ -917,6 +917,8 @@ CREATE TABLE repository (
-- The file path template for storing the latest schema auto-generated by Bytebase after migration.
-- If empty, then Bytebase won't auto generate it.
schema_path_template TEXT NOT NULL DEFAULT '',
+ -- The file path template to match the script file for sheet.
+ sheet_path_template TEXT NOT NULL DEFAULT '',
-- Repository id from the corresponding VCS provider.
-- For GitLab, this is the project id. e.g. 123
external_id TEXT NOT NULL,
@@ -932,8 +934,7 @@ CREATE TABLE repository (
-- access_token, expires_ts, refresh_token belongs to the user linking the project to the VCS repository.
access_token TEXT NOT NULL,
expires_ts BIGINT NOT NULL,
- refresh_token TEXT NOT NULL,
- sheet_path_template TEXT NOT NULL DEFAULT ''
+ refresh_token TEXT NOT NULL
);
CREATE UNIQUE INDEX idx_repository_unique_project_id ON repository(project_id);
@@ -1091,14 +1092,14 @@ CREATE TABLE sheet (
CREATE INDEX idx_sheet_creator_id ON sheet(creator_id);
-CREATE INDEX idx_sheet_project_id_row_status ON sheet(project_id, row_status);
-
-CREATE INDEX idx_sheet_database_id_row_status ON sheet(database_id, row_status);
-
CREATE INDEX idx_sheet_project_id ON sheet(project_id);
CREATE INDEX idx_sheet_name ON sheet(name);
+CREATE INDEX idx_sheet_project_id_row_status ON sheet(project_id, row_status);
+
+CREATE INDEX idx_sheet_database_id_row_status ON sheet(database_id, row_status);
+
ALTER SEQUENCE sheet_id_seq RESTART WITH 101;
CREATE TRIGGER update_sheet_updated_ts
@@ -1110,7 +1111,7 @@ EXECUTE FUNCTION trigger_update_updated_ts();
-- sheet_organizer table stores the sheet status for a principal.
CREATE TABLE sheet_organizer (
id SERIAL PRIMARY KEY,
- sheet_id INTEGER NOT NULL REFERENCES sheet (id),
+ sheet_id INTEGER NOT NULL REFERENCES sheet (id) ON DELETE CASCADE,
principal_id INTEGER NOT NULL REFERENCES principal (id),
starred BOOLEAN NOT NULL DEFAULT false,
pinned BOOLEAN NOT NULL DEFAULT false