Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
- statement: |-
CREATE TABLE "user"(
id INT,
name VARCHAR(255) NOT NULL,
room_id INT NOT NULL,
creator_id INT NOT NULL,
created_ts TIMESTAMP NOT NULL,
updater_id INT NOT NULL,
updated_ts TIMESTAMP NOT NULL,
CONSTRAINT pk_user_id PRIMARY KEY (id),
CONSTRAINT uk_user_id_name UNIQUE (id, name)
);
COMMENT ON TABLE "user" IS 'User table';
result:
- |-
{
"status": "SUCCESS",
"title": "OK"
}
run: false
- statement: CREATE TABLE user(id);
result:
- |-
{
"status": "ERROR",
"title": "Syntax error",
"content": "Syntax error at line 1: syntax error at or near \"user\"",
"code": 201,
"sqlReviewReport": {
"startPosition": {
"line": 1,
"column": 14
}
}
}
run: false
- statement: |-
CREATE TABLE "userTable"(
id INT,
name VARCHAR(255),
"roomId" INT,
CONSTRAINT uk1 UNIQUE (id, name),
CONSTRAINT fk1 FOREIGN KEY ("roomId") REFERENCES room(id)
);
COMMENT ON TABLE "userTable" IS 'User table';
result:
- |-
{
"status": "WARNING",
"title": "DDL simulation failed",
"content": "ERROR: relation \"room\" does not exist (SQLSTATE 42P01)",
"code": 604,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
run: false
- statement: DELETE FROM t
result:
- |-
{
"status": "ERROR",
"title": "STATEMENT_WHERE_REQUIRE_UPDATE_DELETE",
"content": "\"DELETE FROM t\" requires WHERE clause",
"code": 202,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
- |-
{
"status": "WARNING",
"title": "STATEMENT_DML_DRY_RUN",
"content": "\"DELETE FROM t\" dry runs failed: ERROR: relation \"t\" does not exist (SQLSTATE 42P01)",
"code": 208,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
run: false
- statement: DELETE FROM t WHERE a like '%abc'
result:
- |-
{
"status": "ERROR",
"title": "STATEMENT_WHERE_NO_LEADING_WILDCARD_LIKE",
"content": "\"DELETE FROM t WHERE a like '%abc'\" uses leading wildcard LIKE",
"code": 204,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
- |-
{
"status": "WARNING",
"title": "STATEMENT_DML_DRY_RUN",
"content": "\"DELETE FROM t WHERE a like '%abc'\" dry runs failed: ERROR: relation \"t\" does not exist (SQLSTATE 42P01)",
"code": 208,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
run: false
- statement: DELETE FROM t WHERE a = (SELECT max(id) FROM "user" WHERE name = 'bytebase')
result:
- |-
{
"status": "WARNING",
"title": "STATEMENT_DML_DRY_RUN",
"content": "\"DELETE FROM t WHERE a = (SELECT max(id) FROM \"user\" WHERE name = 'bytebase')\" dry runs failed: ERROR: relation \"t\" does not exist (SQLSTATE 42P01)",
"code": 208,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
run: false
- statement: INSERT INTO t VALUES (1), (2)
result:
- |-
{
"status": "WARNING",
"title": "STATEMENT_DML_DRY_RUN",
"content": "\"INSERT INTO t VALUES (1), (2)\" dry runs failed: ERROR: relation \"t\" does not exist (SQLSTATE 42P01)",
"code": 208,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
run: false
- statement: |-
CREATE TABLE tech_book(
id int,
creator_id INT NOT NULL,
created_ts TIMESTAMP NOT NULL,
updater_id INT NOT NULL,
updated_ts TIMESTAMP NOT NULL,
CONSTRAINT pk_tech_book_id PRIMARY KEY (id)
);
COMMENT ON TABLE tech_book IS 'tech_book';
result:
- |-
{
"status": "SUCCESS",
"title": "OK"
}
run: true
- statement: ALTER INDEX pk_tech_book_id RENAME TO pk1
result:
- |-
{
"status": "WARNING",
"title": "NAMING_INDEX_PK",
"content": "Primary key in table \"tech_book\" mismatches the naming convention, expect \"^$|^pk_tech_book_id$\" but found \"pk1\"",
"code": 306,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
- |-
{
"status": "WARNING",
"title": "SCHEMA_BACKWARD_COMPATIBILITY",
"content": "\"ALTER INDEX pk_tech_book_id RENAME TO pk1\" may cause incompatibility with the existing data and code",
"code": 102,
"sqlReviewReport": {
"startPosition": {
"line": 1
}
}
}
run: false