Skip to content

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

feat(PITR): add dev demo seed data (#1301)

Yilong Li7d1894eede79
diff --git a/store/demo/dev/10090__pipeline.sql b/store/demo/dev/10090__pipeline.sql
index 68be15a831..a5825fe6cb 100644
--- a/store/demo/dev/10090__pipeline.sql
+++ b/store/demo/dev/10090__pipeline.sql
@@ -210,4 +210,26 @@ VALUES
'OPEN'
);
-ALTER SEQUENCE pipeline_id_seq RESTART WITH 9011;
+-- Pipeline for PITR tasks
+INSERT INTO
+ pipeline (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ name,
+ status
+ )
+VALUES
+ (
+ 9011,
+ 1,
+ 1652429962,
+ 1,
+ 1652429962,
+ 'Pipeline - PITR',
+ 'OPEN'
+ );
+
+ALTER SEQUENCE pipeline_id_seq RESTART WITH 9012;
diff --git a/store/demo/dev/10100__stage.sql b/store/demo/dev/10100__stage.sql
index f5cade4cbf..35a69a0a85 100644
--- a/store/demo/dev/10100__stage.sql
+++ b/store/demo/dev/10100__stage.sql
@@ -387,4 +387,28 @@ VALUES
'Dev'
);
-ALTER SEQUENCE stage_id_seq RESTART WITH 10018;
+-- Stage for task dependency
+INSERT INTO
+ stage (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ environment_id,
+ name
+ )
+VALUES
+ (
+ 10018,
+ 1,
+ 1652429962,
+ 1,
+ 1652429962,
+ 9011,
+ 5001,
+ 'Dev'
+ );
+
+ALTER SEQUENCE stage_id_seq RESTART WITH 10019;
diff --git a/store/demo/dev/10110__task.sql b/store/demo/dev/10110__task.sql
index 635d737c73..a3f0316fd8 100644
--- a/store/demo/dev/10110__task.sql
+++ b/store/demo/dev/10110__task.sql
@@ -518,8 +518,7 @@ VALUES
'{"migrationType":"MIGRATE","statement":"CREATE TABLE testdb_prod.tbl2 (name TEXT);"}'
);
--- Task for task dependency
-
+-- Tasks for task dependency, which is a gh-ost migration pipeline
INSERT INTO
task (
id,
@@ -607,5 +606,92 @@ VALUES
'{"databaseName":"testdb_prod","tableName":"_tbl1_del"}'
);
+-- Tasks for PITR pipeline
+INSERT INTO
+ task (
+ id,
+ creator_id,
+ updater_id,
+ pipeline_id,
+ stage_id,
+ instance_id,
+ database_id,
+ name,
+ type,
+ status,
+ payload
+ )
+VALUES
+ (
+ 11020,
+ 1,
+ 1,
+ 9011,
+ 10018,
+ 6001,
+ 7002,
+ 'Restore PITR database testdb_dev',
+ 'bb.task.database.pitr.restore',
+ 'PENDING_APPROVAL',
+ '{"projectId":3001,"pointInTimeTs":1652429962}'
+ );
+
+INSERT INTO
+ task (
+ id,
+ creator_id,
+ updater_id,
+ pipeline_id,
+ stage_id,
+ instance_id,
+ database_id,
+ name,
+ type,
+ status,
+ payload
+ )
+VALUES
+ (
+ 11021,
+ 1,
+ 1,
+ 9011,
+ 10018,
+ 6001,
+ 7002,
+ 'Swap PITR and the original database testdb_dev',
+ 'bb.task.database.pitr.cutover',
+ 'PENDING_APPROVAL',
+ '{}'
+ );
+
+INSERT INTO
+ task (
+ id,
+ creator_id,
+ updater_id,
+ pipeline_id,
+ stage_id,
+ instance_id,
+ database_id,
+ name,
+ type,
+ status,
+ payload
+ )
+VALUES
+ (
+ 11022,
+ 1,
+ 1,
+ 9011,
+ 10018,
+ 6001,
+ 7002,
+ 'Delete the original database testdb_dev',
+ 'bb.task.database.pitr.delete',
+ 'PENDING_APPROVAL',
+ '{}'
+ );
-ALTER SEQUENCE task_id_seq RESTART WITH 11020;
+ALTER SEQUENCE task_id_seq RESTART WITH 11023;
diff --git a/store/demo/dev/10111__task_dag.sql b/store/demo/dev/10111__task_dag.sql
index 8a6f465d59..18e06cbe8d 100644
--- a/store/demo/dev/10111__task_dag.sql
+++ b/store/demo/dev/10111__task_dag.sql
@@ -1,5 +1,4 @@
-- task_dag for task dependency
-
INSERT INTO
task_dag (
id,
@@ -26,4 +25,31 @@ VALUES
11019
);
-ALTER SEQUENCE task_dag_id_seq RESTART WITH 11103;
+-- task_dag for PITR tasks
+INSERT INTO
+ task_dag (
+ id,
+ from_task_id,
+ to_task_id
+ )
+VALUES
+ (
+ 11103,
+ 11020,
+ 11021
+ );
+
+INSERT INTO
+ task_dag (
+ id,
+ from_task_id,
+ to_task_id
+ )
+VALUES
+ (
+ 11104,
+ 11021,
+ 11022
+ );
+
+ALTER SEQUENCE task_dag_id_seq RESTART WITH 11105;
diff --git a/store/demo/dev/10130__issue.sql b/store/demo/dev/10130__issue.sql
index 8c08ea106e..ce12c4ee37 100644
--- a/store/demo/dev/10130__issue.sql
+++ b/store/demo/dev/10130__issue.sql
@@ -302,4 +302,32 @@ VALUES
101
);
-ALTER SEQUENCE issue_id_seq RESTART WITH 13011;
+-- Issue for PITR
+INSERT INTO
+ issue (
+ id,
+ creator_id,
+ updater_id,
+ project_id,
+ pipeline_id,
+ name,
+ status,
+ type,
+ description,
+ assignee_id
+ )
+VALUES
+ (
+ 13011,
+ 1,
+ 1,
+ 3001,
+ 9011,
+ 'Hello PITR!',
+ 'OPEN',
+ 'bb.issue.database.pitr',
+ 'This issue is to demonstrate PITR.',
+ 101
+ );
+
+ALTER SEQUENCE issue_id_seq RESTART WITH 13012;