Skip to content

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

Add test schema for clickhouse (#34)

p0nyd16ee9df6901
diff --git a/store/test_schema/clickhouse/1_todo.sql b/store/test_schema/clickhouse/1_todo.sql
new file mode 100644
index 0000000000..7a2345e707
--- /dev/null
+++ b/store/test_schema/clickhouse/1_todo.sql
@@ -0,0 +1,24 @@
+-- Covered objects:
+-- - Table
+-- - Index
+
+CREATE DATABASE bytebase_test_todo;
+
+-- Table and Index
+CREATE TABLE bytebase_test_todo.author (
+ id UUID,
+ name String
+) ENGINE = MergeTree()
+ORDER BY id;
+
+CREATE TABLE bytebase_test_todo.todo (
+ id UUID,
+ name String COMMENT 'name of the todo',
+ content String,
+ author_id UUID,
+ created_ts Int64 NOT NULL,
+ updated_ts Int64 NOT NULL,
+ INDEX index_name (name) TYPE minmax GRANULARITY 4,
+ INDEX index_created_ts (created_ts) TYPE minmax GRANULARITY 4
+) ENGINE = MergeTree()
+ORDER BY id;
\ No newline at end of file
diff --git a/store/test_schema/clickhouse/2_blog.sql b/store/test_schema/clickhouse/2_blog.sql
new file mode 100644
index 0000000000..be805c58eb
--- /dev/null
+++ b/store/test_schema/clickhouse/2_blog.sql
@@ -0,0 +1,49 @@
+-- Covered objects:
+-- - Table
+-- - Index
+-- - View
+
+CREATE DATABASE bytebase_test_blog;
+
+-- Table and Index
+CREATE TABLE bytebase_test_blog.author (
+ id UUID,
+ name String COMMENT 'name of the author',
+ email String,
+ coin Int32 DEFAULT 0 COMMENT 'coin can be earned by posting posts, comments'
+) ENGINE = MergeTree()
+ORDER BY id;
+
+CREATE TABLE bytebase_test_blog.post (
+ id UUID,
+ created_ts Int64 NOT NULL,
+ updated_ts Int64 NOT NULL,
+ author_id UUID NOT NULL,
+ name String comment 'name of the post',
+ content String,
+ like_count Int32 DEFAULT 0,
+ INDEX index_name (name) TYPE minmax GRANULARITY 4,
+ INDEX index_created_ts (created_ts) TYPE minmax GRANULARITY 4
+) ENGINE = MergeTree()
+ORDER BY id;
+
+CREATE TABLE bytebase_test_blog.comment (
+ id UUID,
+ created_ts Int64 NOT NULL,
+ updated_ts Int64 NOT NULL,
+ post_id Int32,
+ author_id Int32,
+ content String,
+ INDEX index_created_ts (created_ts) TYPE minmax GRANULARITY 4
+) ENGINE = MergeTree()
+ORDER BY id;
+
+-- View
+CREATE VIEW bytebase_test_blog.top_like_post AS
+SELECT
+ *
+FROM
+ bytebase_test_blog.post
+ORDER BY
+ like_count DESC
+LIMIT 10;
\ No newline at end of file