Skip to content

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

Refine demo data

天舟ca851f1c568e
diff --git a/store/seed/test/0030_project.sql b/store/seed/test/0030_project.sql
index 964e482b46..136e9b7634 100644
--- a/store/seed/test/0030_project.sql
+++ b/store/seed/test/0030_project.sql
@@ -12,9 +12,9 @@ VALUES
3001,
101,
101,
- 'BBBlog',
- 'BLG',
- 'VCS'
+ 'Test Project',
+ 'TEST',
+ 'UI'
);
INSERT INTO
@@ -31,9 +31,9 @@ VALUES
3002,
101,
101,
- 'project 2',
- 'PRJ2',
- 'UI'
+ 'Shop (VCS)',
+ 'SHP',
+ 'VCS'
);
INSERT INTO
@@ -50,28 +50,9 @@ VALUES
3003,
101,
101,
- 'project 3',
- 'PRJ3',
- 'UI'
- );
-
-INSERT INTO
- project (
- id,
- creator_id,
- updater_id,
- name,
- `key`,
- workflow_type
- )
-VALUES
- (
- 3004,
- 101,
- 101,
- 'project 4',
- 'PRJ4',
- 'UI'
+ 'Blog (VCS)',
+ 'BLG',
+ 'VCS'
);
INSERT INTO
@@ -86,11 +67,11 @@ INSERT INTO
)
VALUES
(
- 3005,
+ 3004,
'ARCHIVED',
101,
101,
- 'project 5',
- 'PRJ5',
+ 'Project Glacier',
+ 'GLC',
'UI'
);
\ No newline at end of file
diff --git a/store/seed/test/0040_project_member.sql b/store/seed/test/0040_project_member.sql
index d62835f746..c215ec19cc 100644
--- a/store/seed/test/0040_project_member.sql
+++ b/store/seed/test/0040_project_member.sql
@@ -14,8 +14,8 @@ VALUES
101,
101,
3001,
- 'OWNER',
- 102
+ 'DEVELOPER',
+ 101
);
INSERT INTO
@@ -33,8 +33,8 @@ VALUES
101,
101,
3001,
- 'DEVELOPER',
- 101
+ 'OWNER',
+ 102
);
INSERT INTO
@@ -73,7 +73,7 @@ VALUES
101,
3002,
'OWNER',
- 103
+ 101
);
INSERT INTO
@@ -91,7 +91,7 @@ VALUES
101,
101,
3002,
- 'DEVELOPER',
+ 'OWNER',
102
);
@@ -112,7 +112,7 @@ VALUES
101,
3003,
'OWNER',
- 102
+ 101
);
INSERT INTO
@@ -131,10 +131,9 @@ VALUES
101,
3003,
'DEVELOPER',
- 101
+ 102
);
--- Project 3004 membership
INSERT INTO
project_member (
id,
@@ -149,11 +148,12 @@ VALUES
4008,
101,
101,
- 3004,
+ 3003,
'OWNER',
- 102
+ 103
);
+-- Project 3004 membership
INSERT INTO
project_member (
id,
@@ -169,11 +169,10 @@ VALUES
101,
101,
3004,
- 'DEVELOPER',
+ 'OWNER',
101
);
--- Project 3005 membership
INSERT INTO
project_member (
id,
@@ -188,9 +187,9 @@ VALUES
4010,
101,
101,
- 3005,
+ 3004,
'OWNER',
- 101
+ 102
);
INSERT INTO
@@ -207,7 +206,7 @@ VALUES
4011,
101,
101,
- 3005,
+ 3004,
'DEVELOPER',
103
);
\ No newline at end of file
diff --git a/store/seed/test/0060_instance.sql b/store/seed/test/0060_instance.sql
index 308d8183e5..d5309f17bb 100644
--- a/store/seed/test/0060_instance.sql
+++ b/store/seed/test/0060_instance.sql
@@ -16,11 +16,11 @@ VALUES
101,
101,
5001,
- 'RDS dev',
+ 'On-premises Dev MySQL',
'MYSQL',
- 'bytebase-demo-dev-mysql8.cerr43rttews.us-west-1.rds.amazonaws.com',
+ 'mysql.dev.example.com',
'3306',
- 'https://us-west-1.console.aws.amazon.com/rds/home?region=us-west-1#database:id=bytebase-demo-dev-mysql8;is-cluster=false'
+ 'bytebase.com'
);
INSERT INTO
@@ -41,11 +41,11 @@ VALUES
101,
101,
5002,
- 'RDS integration',
+ 'On-premises Integration MySQL',
'MYSQL',
- 'bytebase-demo-integration-mysql8.cerr43rttews.us-west-1.rds.amazonaws.com',
+ 'mysql.integration.example.com',
'3306',
- 'https://us-west-1.console.aws.amazon.com/rds/home?region=us-west-1#database:id=bytebase-demo-integration-mysql8;is-cluster=false'
+ 'bytebase.com'
);
INSERT INTO
@@ -66,11 +66,11 @@ VALUES
101,
101,
5003,
- 'RDS staging',
+ 'On-premises Staging MySQL',
'MYSQL',
- 'bytebase-demo-staging-mysql57.cerr43rttews.us-west-1.rds.amazonaws.com',
+ 'mysql.staging.example.com',
'3306',
- 'https://us-west-1.console.aws.amazon.com/rds/home?region=us-west-1#database:id=bytebase-demo-staging-mysql57;is-cluster=false'
+ 'bytebase.com'
);
INSERT INTO
@@ -91,9 +91,9 @@ VALUES
101,
101,
5004,
- 'RDS prod',
+ 'On-premises Prod MySQL',
'MYSQL',
- 'bytebase-demo-prod-mysql57.cerr43rttews.us-west-1.rds.amazonaws.com',
+ 'mysql.prod.example.com',
'3306',
- 'https://us-west-1.console.aws.amazon.com/rds/home?region=us-west-1#database:id=bytebase-demo-prod-mysql57;is-cluster=false'
+ 'bytebase.com'
);
\ No newline at end of file
diff --git a/store/seed/test/0070_db.sql b/store/seed/test/0070_db.sql
index 8516f86eee..285a584da8 100644
--- a/store/seed/test/0070_db.sql
+++ b/store/seed/test/0070_db.sql
@@ -49,7 +49,7 @@ VALUES
101,
6001,
3001,
- 'bbblog',
+ 'db1_dev',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -78,7 +78,7 @@ VALUES
101,
6001,
3002,
- 'sandboxdb2',
+ 'shop',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -107,7 +107,7 @@ VALUES
101,
6001,
3003,
- 'sandboxdb3',
+ 'blog',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -166,7 +166,7 @@ VALUES
101,
6002,
3001,
- 'integrationdb1',
+ 'db1_integration',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -195,7 +195,7 @@ VALUES
101,
6002,
3002,
- 'integrationdb2',
+ 'shop',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -224,7 +224,7 @@ VALUES
101,
6002,
3003,
- 'integrationdb3',
+ 'blog',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -283,7 +283,7 @@ VALUES
101,
6003,
3001,
- 'stagingdb1',
+ 'db1_staging',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -312,7 +312,7 @@ VALUES
101,
6003,
3002,
- 'stagingdb2',
+ 'shop',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -341,7 +341,7 @@ VALUES
101,
6003,
3003,
- 'stagingdb3',
+ 'blog',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -400,7 +400,7 @@ VALUES
101,
6004,
3001,
- 'proddb1',
+ 'db1_prod',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -429,7 +429,7 @@ VALUES
101,
6004,
3002,
- 'proddb2',
+ 'shop',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -457,8 +457,8 @@ VALUES
101,
101,
6004,
- 3002,
- 'proddb21',
+ 3003,
+ 'blog',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
@@ -486,8 +486,8 @@ VALUES
101,
101,
6004,
- 3003,
- 'proddb3',
+ 3004,
+ 'glacier',
'utf8mb4',
'utf8mb4_0900_ai_ci',
'OK',
diff --git a/store/seed/test/0090_pipeline.sql b/store/seed/test/0090_pipeline.sql
index 6a60276155..3b919874e9 100644
--- a/store/seed/test/0090_pipeline.sql
+++ b/store/seed/test/0090_pipeline.sql
@@ -16,21 +16,25 @@ VALUES
'OPEN'
);
--- A multi stage, each containing a single add column task
+-- A multiple stage Pipeline for simulating webhook push event to create table for shop project database.
INSERT INTO
pipeline (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
name,
`status`
)
VALUES
(
9002,
- 103,
- 103,
- 'Pipeline - Add column ''location'' to table ''warehouse''',
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
+ 'Pipeline - Create product table',
'OPEN'
);
@@ -52,12 +56,14 @@ VALUES
'OPEN'
);
--- A pipeline simulating webhook push event
+-- Pipeline for simulating webhook push event to create table for blog project dev database.
INSERT INTO
pipeline (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
name,
`status`
)
@@ -65,7 +71,97 @@ VALUES
(
9004,
1,
+ 1624865387,
+ 1,
+ 1624865387,
+ 'Pipeline - Create user, post, comment table for dev environment',
+ 'DONE'
+ );
+
+-- Pipeline for simulating webhook push event to create table for blog project integration database.
+INSERT INTO
+ pipeline (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ name,
+ `status`
+ )
+VALUES
+ (
+ 9005,
+ 1,
+ 1624866790,
+ 1,
+ 1624866790,
+ 'Pipeline - Create user, post, comment table for integration environment',
+ 'DONE'
+ );
+
+-- Pipeline for simulating webhook push event to create table for blog project staging database.
+INSERT INTO
+ pipeline (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ name,
+ `status`
+ )
+VALUES
+ (
+ 9006,
+ 1,
+ 1624868407,
+ 1,
+ 1624868407,
+ 'Pipeline - Create user, post, comment table for staging environment',
+ 'DONE'
+ );
+
+-- Pipeline for simulating webhook push event to create table for blog project prod database.
+INSERT INTO
+ pipeline (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ name,
+ `status`
+ )
+VALUES
+ (
+ 9007,
+ 1,
+ 1624868680,
+ 1,
+ 1624868680,
+ 'Pipeline - Create user, post, comment table for prod environment',
+ 'DONE'
+ );
+
+-- Pipeline for simulating webhook push event to alter table for blog project dev database.
+INSERT INTO
+ pipeline (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ name,
+ `status`
+ )
+VALUES
+ (
+ 9008,
+ 1,
+ 1624869944,
1,
- 'Pipeline - Create todo table to staging db1',
+ 1624869944,
+ 'Pipeline - Add created_at column to user,post,comment table for dev environment',
'OPEN'
);
\ No newline at end of file
diff --git a/store/seed/test/0100_stage.sql b/store/seed/test/0100_stage.sql
index 45a36c8e34..89803c5975 100644
--- a/store/seed/test/0100_stage.sql
+++ b/store/seed/test/0100_stage.sql
@@ -18,12 +18,14 @@ VALUES
'Prod'
);
--- Stage for Pipeline 9002 add column
+-- Stage for Pipeline 9002 simulating webhook push event
INSERT INTO
stage (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
environment_id,
name
@@ -31,18 +33,22 @@ INSERT INTO
VALUES
(
10002,
- 103,
- 103,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
9002,
5001,
- 'Sandbox A'
+ 'Dev'
);
INSERT INTO
stage (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
environment_id,
name
@@ -50,8 +56,10 @@ INSERT INTO
VALUES
(
10003,
- 103,
- 103,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
9002,
5002,
'Integration'
@@ -61,7 +69,9 @@ INSERT INTO
stage (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
environment_id,
name
@@ -69,8 +79,10 @@ INSERT INTO
VALUES
(
10004,
- 103,
- 103,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
9002,
5003,
'Staging'
@@ -80,7 +92,9 @@ INSERT INTO
stage (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
environment_id,
name
@@ -88,8 +102,10 @@ INSERT INTO
VALUES
(
10005,
- 103,
- 103,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
9002,
5004,
'Prod'
@@ -112,7 +128,7 @@ VALUES
103,
9003,
5001,
- 'Sandbox A'
+ 'Dev'
);
INSERT INTO
@@ -139,7 +155,9 @@ INSERT INTO
stage (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
environment_id,
name
@@ -148,8 +166,106 @@ VALUES
(
10008,
1,
+ 1624865387,
1,
+ 1624865387,
9004,
+ 5001,
+ 'Dev'
+ );
+
+-- Stage for Pipeline 9005 simulating webhook push event
+INSERT INTO
+ stage (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ environment_id,
+ name
+ )
+VALUES
+ (
+ 10009,
+ 1,
+ 1624866790,
+ 1,
+ 1624866790,
+ 9005,
+ 5002,
+ 'Integration'
+ );
+
+-- Stage for Pipeline 9006 simulating webhook push event
+INSERT INTO
+ stage (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ environment_id,
+ name
+ )
+VALUES
+ (
+ 10010,
+ 1,
+ 1624868407,
+ 1,
+ 1624868407,
+ 9006,
5003,
'Staging'
+ );
+
+-- Stage for Pipeline 9007 simulating webhook push event
+INSERT INTO
+ stage (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ environment_id,
+ name
+ )
+VALUES
+ (
+ 10011,
+ 1,
+ 1624868680,
+ 1,
+ 1624868680,
+ 9007,
+ 5004,
+ 'Prod'
+ );
+
+-- Stage for Pipeline 9008 simulating webhook push event
+INSERT INTO
+ stage (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ environment_id,
+ name
+ )
+VALUES
+ (
+ 10012,
+ 1,
+ 1624869944,
+ 1,
+ 1624869944,
+ 9008,
+ 5001,
+ 'Dev'
);
\ No newline at end of file
diff --git a/store/seed/test/0110_task.sql b/store/seed/test/0110_task.sql
index 6467f620c6..3cd635a073 100644
--- a/store/seed/test/0110_task.sql
+++ b/store/seed/test/0110_task.sql
@@ -1,4 +1,4 @@
--- Task for Pipeline 9001 "Hello world", Stage 10001 "Prod" to update database 7008 "proddb1"
+-- Task for Pipeline 9001 "Hello world", Stage 10001 "Prod" to update database 7014 "db1_prod"
INSERT INTO
task (
id,
@@ -15,7 +15,7 @@ INSERT INTO
)
VALUES
(
- 1101,
+ 11001,
101,
101,
9001,
@@ -28,13 +28,15 @@ VALUES
'{"statement":"SELECT ''Welcome Tech Lead, DBA, Developer'';"}'
);
--- Task for Pipeline 9002 add column
--- Task for stage 10002 "Sandbox A" to update database 7002 'sandboxdb1'
+-- Task for Pipeline 9002
+-- Task for stage 10002 "Dev" to update database 7003 'shop'
INSERT INTO
task (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
stage_id,
instance_id,
@@ -46,25 +48,29 @@ INSERT INTO
)
VALUES
(
- 1102,
- 103,
- 103,
+ 11002,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
9002,
10002,
6001,
- 7002,
- 'Update sandboxdb1',
+ 7003,
+ 'Add initial schema',
'bb.task.database.schema.update',
- 'PENDING',
- '{"statement":"ALTER TABLE sandboxdb1.warehouse ADD COLUMN location VARCHAR(255);", "rollbackStatement":"ALTER TABLE sandboxdb1.warehouse DROP COLUMN location;"}'
+ 'DONE',
+ '{"statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"14","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repoFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"da90a2510eccd051ad14e4b89ca904d733169a39","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/da90a2510eccd051ad14e4b89ca904d733169a39","authorName":"tianzhou","added":"bytebase/v1__shop__baseline__add_initial_schema.sql"}}}'
);
--- Task for stage 10003 "Integration" to update database 7006 'integrationdb1'
+-- Task for stage 10003 "Integration" to update database 7007 'shop'
INSERT INTO
task (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
stage_id,
instance_id,
@@ -76,25 +82,29 @@ INSERT INTO
)
VALUES
(
- 1103,
- 103,
- 103,
+ 11003,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
9002,
10003,
6001,
- 7006,
- 'Update integrationdb1',
+ 7007,
+ 'Add initial schema',
'bb.task.database.schema.update',
- 'PENDING',
- '{"statement":"ALTER TABLE integrationdb1.warehouse ADD COLUMN location VARCHAR(255);", "rollbackStatement":"ALTER TABLE integrationdb1.warehouse DROP COLUMN location;"}'
+ 'DONE',
+ '{"statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"14","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repoFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"da90a2510eccd051ad14e4b89ca904d733169a39","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/da90a2510eccd051ad14e4b89ca904d733169a39","authorName":"tianzhou","added":"bytebase/v1__shop__baseline__add_initial_schema.sql"}}}'
);
--- Task for stage 10004 "Staging" to update database 7010 'stagingdb1'
+-- Task for stage 10004 "Staging" to update database 7011 'shop'
INSERT INTO
task (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
stage_id,
instance_id,
@@ -106,25 +116,29 @@ INSERT INTO
)
VALUES
(
- 1104,
- 103,
- 103,
+ 11004,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
9002,
10004,
6003,
- 7010,
- 'Update stagingdb1',
+ 7011,
+ 'Add initial schema',
'bb.task.database.schema.update',
'PENDING_APPROVAL',
- '{"statement":"ALTER TABLE stagingdb1.warehouse ADD COLUMN location VARCHAR(255);", "rollbackStatement":"ALTER TABLE stagingdb1.warehouse DROP COLUMN location;"}'
+ '{"statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"14","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repoFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"da90a2510eccd051ad14e4b89ca904d733169a39","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/da90a2510eccd051ad14e4b89ca904d733169a39","authorName":"tianzhou","added":"bytebase/v1__shop__baseline__add_initial_schema.sql"}}}'
);
--- Task for stage 10005 "Prod" to update database 7014 'proddb1'
+-- Task for stage 10005 "Prod" to update database 7015 'proddb1'
INSERT INTO
task (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
stage_id,
instance_id,
@@ -137,20 +151,22 @@ INSERT INTO
VALUES
(
11005,
- 103,
- 103,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
9002,
10005,
6004,
- 7014,
- 'Update proddb1',
+ 7015,
+ 'Add initial schema',
'bb.task.database.schema.update',
'PENDING_APPROVAL',
- '{"statement":"ALTER TABLE proddb1.warehouse ADD COLUMN location VARCHAR(255);", "rollbackStatement":"ALTER TABLE proddb1.warehouse DROP COLUMN location;"}'
+ '{"statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"14","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repoFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"da90a2510eccd051ad14e4b89ca904d733169a39","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/da90a2510eccd051ad14e4b89ca904d733169a39","authorName":"tianzhou","added":"bytebase/v1__shop__baseline__add_initial_schema.sql"}}}'
);
-- Task for Pipeline 9003 create table
--- Task for stage 10006 "Sandbox A" to craete table in database 7002 'sandboxdb1'
+-- Task for stage 10006 "Dev" to craete table in database 7002 'db1_dev'
INSERT INTO
task (
id,
@@ -174,13 +190,13 @@ VALUES
10006,
6001,
7002,
- 'Update sandboxdb1',
+ 'Update db1_dev',
'bb.task.database.schema.update',
- 'PENDING_APPROVAL',
- '{"statement":"CREATE TABLE sandboxdb1.tbl1 (name TEXT);", "rollbackStatement":"DROP TABLE sandboxdb1.tbl1;"}'
+ 'FAILED',
+ '{"statement":"CREATE TABLE db1_dev.tbl1 (name TEXT);", "rollbackStatement":"DROP TABLE db1_dev.tbl1;"}'
);
--- Task for stage 10003 "Integration" to update database 7006 'integrationdb1'
+-- Task for stage 10003 "Integration" to update database 7006 'db1_integration'
INSERT INTO
task (
id,
@@ -204,18 +220,20 @@ VALUES
10007,
6001,
7006,
- 'Update integrationdb1',
+ 'Update db1_integration',
'bb.task.database.schema.update',
'PENDING',
- '{"statement":"CREATE TABLE integrationdb1.tbl1 (name TEXT);", "rollbackStatement":"DROP TABLE integrationdb1.tbl1;"}'
+ '{"statement":"CREATE TABLE db1_integration.tbl1 (name TEXT);", "rollbackStatement":"DROP TABLE db1_integration.tbl1;"}'
);
--- Task for stage 10008 "Staging" to update database 7010 'stagingdb1' to simulate webhook push event
+-- Task for stage 10008 simulating webhook push event
INSERT INTO
task (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
pipeline_id,
stage_id,
instance_id,
@@ -229,13 +247,151 @@ VALUES
(
11008,
1,
+ 1624865387,
1,
+ 1624865387,
9004,
10008,
+ 6001,
+ 7004,
+ 'Add initial schema',
+ 'bb.task.database.schema.update',
+ 'DONE',
+ '{"statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","authorName":"tianzhou","added":"bytebase/dev/202106280000__blog__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Task for stage 10009 simulating webhook push event
+INSERT INTO
+ task (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ stage_id,
+ instance_id,
+ database_id,
+ name,
+ `type`,
+ `status`,
+ payload
+ )
+VALUES
+ (
+ 11009,
+ 1,
+ 1624866790,
+ 1,
+ 1624866790,
+ 9005,
+ 10009,
+ 6002,
+ 7008,
+ 'Add initial schema',
+ 'bb.task.database.schema.update',
+ 'DONE',
+ '{"statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"70d06befa6d78abed1b78b7de1cd0e7ce3365719","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs":1624866787,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/70d06befa6d78abed1b78b7de1cd0e7ce3365719","authorName":"tianzhou","added":"bytebase/integration/202106280000__blog__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Task for stage 10010 simulating webhook push event
+INSERT INTO
+ task (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ stage_id,
+ instance_id,
+ database_id,
+ name,
+ `type`,
+ `status`,
+ payload
+ )
+VALUES
+ (
+ 11010,
+ 1,
+ 1624868407,
+ 1,
+ 1624868407,
+ 9006,
+ 10010,
6003,
- 7010,
- 'create todo table',
+ 7012,
+ 'Add initial schema',
'bb.task.database.schema.update',
- 'PENDING',
- '{"statement":"CREATE TABLE todo (\n id INTEGER PRIMARY KEY AUTO_INCREMENT,\n title TEXT\n)\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","ref":"refs/heads/master","repoId":"7","repoUrl":"http://gitlab.bytebase.com/bytebase-test/project1","repoFullPath":"bytebase-test/project1","authorName":"tianzhou","fileCommit":{"id":"e3b3f33a455a7e3cd999b44fa9cb8ddb633e1d29","title":"Create todo table to staging db1","message":"Create todo table to staging db1","createdTs":1624006500,"url":"http://gitlab.bytebase.com/bytebase-test/project1/-/commit/e3b3f33a455a7e3cd999b44fa9cb8ddb633e1d29","authorName":"tianzhou","added":"bytebase/20210618164921_stagingdb1_create_todo_table.sql"}}}'
+ 'DONE',
+ '{"statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"2dac551a44ff26b08d20bd213b856a993da50ecb","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs":1624868403,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/2dac551a44ff26b08d20bd213b856a993da50ecb","authorName":"tianzhou","added":"bytebase/staging/202106280000__blog__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Task for stage 10011 simulating webhook push event
+INSERT INTO
+ task (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ stage_id,
+ instance_id,
+ database_id,
+ name,
+ `type`,
+ `status`,
+ payload
+ )
+VALUES
+ (
+ 11011,
+ 1,
+ 1624868680,
+ 1,
+ 1624868680,
+ 9007,
+ 10011,
+ 6004,
+ 7016,
+ 'Add initial schema',
+ 'bb.task.database.schema.update',
+ 'DONE',
+ '{"statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"e3ff00e2432cfb2da422222ab4f055dd43c4d441","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs":1624868676,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/e3ff00e2432cfb2da422222ab4f055dd43c4d441","authorName":"tianzhou","added":"bytebase/prod/202106280000__blog__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Task for stage 10012 simulating webhook push event
+INSERT INTO
+ task (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ pipeline_id,
+ stage_id,
+ instance_id,
+ database_id,
+ name,
+ `type`,
+ `status`,
+ payload
+ )
+VALUES
+ (
+ 11012,
+ 1,
+ 1624869944,
+ 1,
+ 1624869944,
+ 9008,
+ 10012,
+ 6001,
+ 7004,
+ 'Add created at column',
+ 'bb.task.database.schema.update',
+ 'FAILED',
+ '{"statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"171ceaf7659ceb8e495aa3ef356ec686656f9dc0","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/171ceaf7659ceb8e495aa3ef356ec686656f9dc0","authorName":"tianzhou","added":"bytebase/dev/202106280100__blog__add_created_at_column.sql"}}}'
);
\ No newline at end of file
diff --git a/store/seed/test/0120_task_run.sql b/store/seed/test/0120_task_run.sql
index 47f84bb980..1b900643cd 100644
--- a/store/seed/test/0120_task_run.sql
+++ b/store/seed/test/0120_task_run.sql
@@ -1,3 +1,59 @@
+-- Task run for task 11002
+INSERT INTO
+ task_run (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ task_id,
+ name,
+ `status`,
+ `type`,
+ error,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
+ 11002,
+ 'Add initial schema 1624873710',
+ 'DONE',
+ 'bb.task.database.schema.update',
+ '',
+ '{"statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"14","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repoFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"da90a2510eccd051ad14e4b89ca904d733169a39","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/da90a2510eccd051ad14e4b89ca904d733169a39","authorName":"tianzhou","added":"bytebase/v1__shop__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Task run for task 11003
+INSERT INTO
+ task_run (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ task_id,
+ name,
+ `status`,
+ `type`,
+ error,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624883710,
+ 1,
+ 1624883710,
+ 11003,
+ 'Add initial schema 1624883710',
+ 'DONE',
+ 'bb.task.database.schema.update',
+ '',
+ '{"statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"14","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repoFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"da90a2510eccd051ad14e4b89ca904d733169a39","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/da90a2510eccd051ad14e4b89ca904d733169a39","authorName":"tianzhou","added":"bytebase/v1__shop__baseline__add_initial_schema.sql"}}}'
+ );
+
-- Failed task run for task 11006 create table
INSERT INTO
task_run (
@@ -16,8 +72,148 @@ VALUES
101,
101,
11006,
- 'UPDATE testdb1 task run',
+ 'Update db1_dev task run',
+ 'FAILED',
+ 'bb.task.database.schema.update',
+ 'table "tbl1" already exists'
+ );
+
+-- Task run for task 11008
+INSERT INTO
+ task_run (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ task_id,
+ name,
+ `status`,
+ `type`,
+ error,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624865387,
+ 1,
+ 1624865387,
+ 11008,
+ 'Add initial schema 1624865387',
+ 'DONE',
+ 'bb.task.database.schema.update',
+ '',
+ '{"statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","authorName":"tianzhou","added":"bytebase/dev/202106280000__blog__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Task run for task 11009
+INSERT INTO
+ task_run (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ task_id,
+ name,
+ `status`,
+ `type`,
+ error,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624866790,
+ 1,
+ 1624866790,
+ 11009,
+ 'Add initial schema 1624866790',
+ 'DONE',
+ 'bb.task.database.schema.update',
+ '',
+ '{"statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","authorName":"tianzhou","added":"bytebase/dev/202106280000__blog__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Task run for task 11010
+INSERT INTO
+ task_run (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ task_id,
+ name,
+ `status`,
+ `type`,
+ error,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868407,
+ 1,
+ 1624868407,
+ 11010,
+ 'Add initial schema 1624868407',
+ 'DONE',
+ 'bb.task.database.schema.update',
+ '',
+ '{"statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","authorName":"tianzhou","added":"bytebase/dev/202106280000__blog__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Task run for task 11011
+INSERT INTO
+ task_run (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ task_id,
+ name,
+ `status`,
+ `type`,
+ error,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868680,
+ 1,
+ 1624868680,
+ 11011,
+ 'Add initial schema 1624868680',
+ 'DONE',
+ 'bb.task.database.schema.update',
+ '',
+ '{"statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","authorName":"tianzhou","added":"bytebase/dev/202106280000__blog__baseline__add_initial_schema.sql"}}}'
+ );
+
+-- Failed task run for task 11012 create table
+INSERT INTO
+ task_run (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ task_id,
+ name,
+ `status`,
+ `type`,
+ error,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624869944,
+ 1,
+ 1624869944,
+ 11012,
+ 'Add created at column 1624869944',
'FAILED',
'bb.task.database.schema.update',
- 'fake execution error'
+ 'failed to connect instance: On-premises Dev MySQL with user: admin. dial tcp: lookup mysql.dev.example.com: no such host',
+ '{"statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repoId":"13","repoUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repoFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"171ceaf7659ceb8e495aa3ef356ec686656f9dc0","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/171ceaf7659ceb8e495aa3ef356ec686656f9dc0","authorName":"tianzhou","added":"bytebase/dev/202106280100__blog__add_created_at_column.sql"}}}'
);
\ No newline at end of file
diff --git a/store/seed/test/0130_issue.sql b/store/seed/test/0130_issue.sql
index af4b5967a1..3d31024597 100644
--- a/store/seed/test/0130_issue.sql
+++ b/store/seed/test/0130_issue.sql
@@ -16,24 +16,26 @@ INSERT INTO
VALUES
(
13001,
- 102,
- 102,
+ 1,
+ 1,
3001,
9001,
'Hello world!',
'OPEN',
'bb.issue.general',
- 'Welcome to Bytebase, this is the issue interface where tech leads, developers and DBAs collaborate on database management issues such as: ' || char(10, 10) || ' - Requesting a new database' || char(10) || ' - Creating a table' || char(10) || ' - Creating an index' || char(10) || ' - Adding a column' || char(10) || ' - Troubleshooting performance issue' || char(10, 10) || 'Let''s bookmark this issue by clicking the star icon on the top of this page.' || char(10, 10) || 'And then click the ''Approve'' button on the top right.',
+ 'Welcome to Bytebase, this is the issue interface where tech leads, developers and DBAs collaborate on database management issues such as: ' || char(10, 10) || ' - Creating a new database' || char(10) || ' - Creating a table' || char(10) || ' - Creating an index' || char(10) || ' - Adding a column' || char(10) || ' - Troubleshooting performance issue' || char(10, 10) || 'Let''s bookmark this issue by clicking the star icon on the top of this page.' || char(10, 10) || 'And then click the ''Approve'' button on the top right.',
101,
'101,102,103,104'
);
--- Issue for the multi stage add column pipeline
+-- Issue for simulating webhook push event to create table in multi-stage for shop project.
INSERT INTO
issue (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
project_id,
pipeline_id,
name,
@@ -46,19 +48,21 @@ INSERT INTO
VALUES
(
13002,
- 103,
- 103,
- 3001,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
+ 3002,
9002,
- 'Add column ''location'' to table ''warehouse''',
+ 'Create product table',
'OPEN',
'bb.issue.database.schema.update',
- 'Add the location column to record the warehouse address.',
+ 'Create product table',
101,
'101,102,103,104'
);
--- Issue for the multi stage create table pipeline
+-- Issue for the multi stage create table pipeline, first stage has a failed task run
INSERT INTO
issue (
id,
@@ -78,22 +82,24 @@ VALUES
13003,
103,
103,
- 3002,
+ 3001,
9003,
'Create a new table ''tbl1''',
'OPEN',
'bb.issue.database.schema.update',
'Create tbl1.',
- 101,
+ 102,
'101,102,103,104'
);
--- Issue for simulating webhook push event
+-- Issue for simulating webhook push event to create table for blog project dev database.
INSERT INTO
issue (
id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
project_id,
pipeline_id,
name,
@@ -107,13 +113,151 @@ VALUES
(
13004,
1,
+ 1624865387,
1,
- 3001,
+ 1624865387,
+ 3003,
9004,
- 'Create todo table to stagingdb1',
+ 'Create user, post, comment table for dev environment',
+ 'DONE',
+ 'bb.issue.database.schema.update',
+ 'Create user, post, comment table for dev environment',
+ 1,
+ '101,102,103,104'
+ );
+
+-- Issue for simulating webhook push event to create table for blog project integration database.
+INSERT INTO
+ issue (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ project_id,
+ pipeline_id,
+ name,
+ `status`,
+ `type`,
+ description,
+ assignee_id,
+ subscriber_id_list
+ )
+VALUES
+ (
+ 13005,
+ 1,
+ 1624866790,
+ 1,
+ 1624866790,
+ 3003,
+ 9005,
+ 'Create user, post, comment table for integration environment',
+ 'DONE',
+ 'bb.issue.database.schema.update',
+ 'Create user, post, comment table for integration environment',
+ 1,
+ '101,102,103,104'
+ );
+
+-- Issue for simulating webhook push event to create table for blog project staging database.
+INSERT INTO
+ issue (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ project_id,
+ pipeline_id,
+ name,
+ `status`,
+ `type`,
+ description,
+ assignee_id,
+ subscriber_id_list
+ )
+VALUES
+ (
+ 13006,
+ 1,
+ 1624868407,
+ 1,
+ 1624868407,
+ 3003,
+ 9006,
+ 'Create user, post, comment table for staging environment',
+ 'DONE',
+ 'bb.issue.database.schema.update',
+ 'Create user, post, comment table for staging environment',
+ 1,
+ '101,102,103,104'
+ );
+
+-- Issue for simulating webhook push event to create table for blog project prod database.
+INSERT INTO
+ issue (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ project_id,
+ pipeline_id,
+ name,
+ `status`,
+ `type`,
+ description,
+ assignee_id,
+ subscriber_id_list
+ )
+VALUES
+ (
+ 13007,
+ 1,
+ 1624868680,
+ 1,
+ 1624868680,
+ 3003,
+ 9007,
+ 'Create user, post, comment table for prod environment',
+ 'DONE',
+ 'bb.issue.database.schema.update',
+ 'Create user, post, comment table for prod environment',
+ 1,
+ '101,102,103,104'
+ );
+
+-- Issue for simulating webhook push event to alter table for blog project dev database.
+INSERT INTO
+ issue (
+ id,
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ project_id,
+ pipeline_id,
+ name,
+ `status`,
+ `type`,
+ description,
+ assignee_id,
+ subscriber_id_list
+ )
+VALUES
+ (
+ 13008,
+ 1,
+ 1624869944,
+ 1,
+ 1624869944,
+ 3003,
+ 9008,
+ 'Add created_at column to user,post,comment table for dev environment',
'OPEN',
'bb.issue.database.schema.update',
- 'Create todo table to stagingdb1',
+ 'Add created_at column to user,post,comment table for dev environment',
1,
- ''
+ '101,102,103,104'
);
\ No newline at end of file
diff --git a/store/seed/test/0140_activity.sql b/store/seed/test/0140_activity.sql
index d12abb4f8d..895485c9f5 100644
--- a/store/seed/test/0140_activity.sql
+++ b/store/seed/test/0140_activity.sql
@@ -18,7 +18,6 @@ VALUES
INSERT INTO
activity (
- id,
creator_id,
updater_id,
container_id,
@@ -27,7 +26,6 @@ INSERT INTO
)
VALUES
(
- 14002,
101,
101,
13001,
@@ -37,7 +35,6 @@ VALUES
INSERT INTO
activity (
- id,
creator_id,
updater_id,
container_id,
@@ -46,7 +43,6 @@ INSERT INTO
)
VALUES
(
- 14003,
102,
102,
13001,
@@ -56,7 +52,6 @@ VALUES
INSERT INTO
activity (
- id,
creator_id,
updater_id,
container_id,
@@ -65,7 +60,6 @@ INSERT INTO
)
VALUES
(
- 14004,
103,
103,
13001,
@@ -76,25 +70,118 @@ VALUES
-- Activity for issue 13002
INSERT INTO
activity (
- id,
creator_id,
+ created_ts,
updater_id,
+ updated_ts,
container_id,
`type`
)
VALUES
(
- 14005,
- 103,
- 103,
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
13002,
'bb.issue.create'
);
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
+ 13002,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11002,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
+ 13002,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11002,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
+ 13002,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11003,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624873710,
+ 1,
+ 1624873710,
+ 13002,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11003,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
-- Activity for issue 13003
INSERT INTO
activity (
- id,
creator_id,
updater_id,
container_id,
@@ -102,9 +189,470 @@ INSERT INTO
)
VALUES
(
- 14006,
103,
103,
13003,
'bb.issue.create'
+ );
+
+-- Activity for failed task_run 12001
+INSERT INTO
+ activity (
+ creator_id,
+ updater_id,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1,
+ 13003,
+ 'bb.pipeline.task.status.update',
+ 'table "tbl1" already exists',
+ '{"taskId":11006,"oldStatus":"RUNNING","newStatus":"FAILED"}'
+ );
+
+-- Activity for issue 13004
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624865387,
+ 1,
+ 1624865387,
+ 13004,
+ 'bb.issue.create',
+ '',
+ ''
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624865388,
+ 1,
+ 1624865388,
+ 13004,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11008,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624865388,
+ 1,
+ 1624865388,
+ 13004,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11008,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624865388,
+ 1,
+ 1624865388,
+ 13004,
+ 'bb.issue.status.update',
+ '',
+ '{"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+-- Activity for issue 13005
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624866790,
+ 1,
+ 1624866790,
+ 13005,
+ 'bb.issue.create',
+ '',
+ ''
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624866791,
+ 1,
+ 1624866791,
+ 13005,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11009,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624866791,
+ 1,
+ 1624866791,
+ 13005,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11009,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624866791,
+ 1,
+ 1624866791,
+ 13005,
+ 'bb.issue.status.update',
+ '',
+ '{"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+-- Activity for issue 13006
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868407,
+ 1,
+ 1624868407,
+ 13006,
+ 'bb.issue.create',
+ '',
+ ''
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868408,
+ 1,
+ 1624868408,
+ 13006,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11010,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868408,
+ 1,
+ 1624868408,
+ 13006,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11010,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868408,
+ 1,
+ 1624868408,
+ 13006,
+ 'bb.issue.status.update',
+ '',
+ '{"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+-- Activity for issue 13007
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868680,
+ 1,
+ 1624868680,
+ 13007,
+ 'bb.issue.create',
+ '',
+ ''
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868681,
+ 1,
+ 1624868681,
+ 13007,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11011,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868681,
+ 1,
+ 1624868681,
+ 13007,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11011,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624868681,
+ 1,
+ 1624868681,
+ 13007,
+ 'bb.issue.status.update',
+ '',
+ '{"oldStatus":"RUNNING","newStatus":"DONE"}'
+ );
+
+-- Activity for issue 13008
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624869944,
+ 1,
+ 1624869944,
+ 13008,
+ 'bb.issue.create',
+ '',
+ ''
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624869945,
+ 1,
+ 1624869945,
+ 13008,
+ 'bb.pipeline.task.status.update',
+ '',
+ '{"taskId":11012,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ );
+
+INSERT INTO
+ activity (
+ creator_id,
+ created_ts,
+ updater_id,
+ updated_ts,
+ container_id,
+ `type`,
+ COMMENT,
+ payload
+ )
+VALUES
+ (
+ 1,
+ 1624869945,
+ 1,
+ 1624869945,
+ 13008,
+ 'bb.pipeline.task.status.update',
+ 'failed to connect instance: On-premises Dev MySQL with user: admin. dial tcp: lookup mysql.dev.example.com: no such host',
+ '{"taskId":11012,"oldStatus":"RUNNING","newStatus":"FAILED"}'
);
\ No newline at end of file
diff --git a/store/seed/test/0150_bookmark.sql b/store/seed/test/0150_bookmark.sql
index e69de29bb2..882ffd449a 100644
--- a/store/seed/test/0150_bookmark.sql
+++ b/store/seed/test/0150_bookmark.sql
@@ -0,0 +1,17 @@
+-- Bookmark for issue 13001 "Hello world"
+INSERT INTO
+ bookmark (
+ id,
+ creator_id,
+ updater_id,
+ name,
+ link
+ )
+VALUES
+ (
+ 15001,
+ 101,
+ 101,
+ 'Hello world!',
+ '/issue/hello-world-13001'
+ );
\ No newline at end of file
diff --git a/store/seed/test/0170_repo.sql b/store/seed/test/0170_repo.sql
index d74d9a0458..785e7c1c26 100644
--- a/store/seed/test/0170_repo.sql
+++ b/store/seed/test/0170_repo.sql
@@ -21,16 +21,53 @@ VALUES
101,
101,
16001,
- 3001,
- "Bytebase Blog",
- "bytebase-demo/bbblog",
- "http://gitlab.bytebase.com/bytebase-demo/bbblog",
+ 3003,
+ "Blog",
+ "bytebase-demo/blog",
+ "http://gitlab.bytebase.com/bytebase-demo/blog",
"bytebase",
"master",
- -- Refers to the bytebase-demo/bbblog
+ -- Refers to the bytebase-demo/blog
"13",
- -- Refers to the webhook in bytebase-demo/bbblog
- "59",
- "5effe17f-947a-4eff-b0b5-244e26c5cd68",
- "mQqrGRRnAuuL59F8"
+ -- Refers to the webhook in bytebase-demo/blog
+ "60",
+ "e99bf622-7f58-4d6b-a5be-b97af313d7ea",
+ "3TmNgpQxI35MQEeS"
+ );
+
+INSERT INTO
+ repo (
+ id,
+ creator_id,
+ updater_id,
+ vcs_id,
+ project_id,
+ name,
+ full_path,
+ web_url,
+ base_directory,
+ branch_filter,
+ external_id,
+ external_webhook_id,
+ webhook_endpoint_id,
+ secret_token
+ )
+VALUES
+ (
+ 17002,
+ 101,
+ 101,
+ 16001,
+ 3002,
+ "Shop",
+ "bytebase-demo/shop",
+ "http://gitlab.bytebase.com/bytebase-demo/shop",
+ "bytebase",
+ "master",
+ -- Refers to the bytebase-demo/shop
+ "14",
+ -- Refers to the webhook in bytebase-demo/shop
+ "61",
+ "c5e30130-7322-4f84-953a-d08168c047d1",
+ "gbjoh84prbxkz8ny"
);
\ No newline at end of file