-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
486 additions
and
372 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
server/ch_migrations/1723258343_store_words_in_clickhouse/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
DROP TABLE IF EXISTS words_datasets; |
12 changes: 12 additions & 0 deletions
12
server/ch_migrations/1723258343_store_words_in_clickhouse/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CREATE TABLE IF NOT EXISTS words_datasets ( | ||
id UUID NOT NULL, | ||
dataset_id UUID NOT NULL, | ||
word String NOT NULL, | ||
count Int32 NOT NULL, | ||
created_at DateTime DEFAULT now() NOT NULL, | ||
INDEX idx_created_at created_at TYPE minmax GRANULARITY 8192, | ||
INDEX idx_id id TYPE minmax GRANULARITY 8192 | ||
) ENGINE = SummingMergeTree(created_at) | ||
ORDER BY (dataset_id, word) | ||
PARTITION BY dataset_id; | ||
|
1 change: 1 addition & 0 deletions
1
server/ch_migrations/1723490007_create_last_processed_table/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS dataset_words_last_processed; |
6 changes: 6 additions & 0 deletions
6
server/ch_migrations/1723490007_create_last_processed_table/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE IF NOT EXISTS dataset_words_last_processed ( | ||
last_processed DateTime DEFAULT now() NOT NULL, | ||
dataset_id UUID NOT NULL, | ||
) ENGINE = ReplacingMergeTree(last_processed) | ||
ORDER BY (dataset_id) | ||
PARTITION BY dataset_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
server/migrations/2024-08-10-032512_delete_tables/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- This file should undo anything in `up.sql` | ||
CREATE TABLE IF NOT EXISTS "words_in_datasets" ( | ||
id UUID PRIMARY KEY, | ||
word TEXT NOT NULL, | ||
UNIQUE(word) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS "words_datasets" ( | ||
id UUID PRIMARY KEY, | ||
dataset_id UUID NOT NULL, | ||
word_id UUID NOT NULL, | ||
count INT NOT NULL, | ||
UNIQUE(dataset_id, word_id), | ||
FOREIGN KEY (dataset_id) REFERENCES "datasets"(id) ON DELETE CASCADE, | ||
FOREIGN KEY (word_id) REFERENCES "words_in_datasets"(id) ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Your SQL goes here | ||
DROP TABLE IF EXISTS "words_datasets"; | ||
DROP TABLE IF EXISTS "words_in_datasets"; | ||
|
||
|
8 changes: 8 additions & 0 deletions
8
server/migrations/2024-08-12-191216_delete_last_processed_table/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- This file should undo anything in `up.sql` | ||
CREATE TABLE IF NOT EXISTS "dataset_words_last_processed" ( | ||
id UUID PRIMARY KEY, | ||
last_processed TIMESTAMP NULL, | ||
dataset_id UUID NOT NULL, | ||
FOREIGN KEY (dataset_id) REFERENCES "datasets"(id) ON DELETE CASCADE, | ||
UNIQUE(dataset_id) | ||
); |
2 changes: 2 additions & 0 deletions
2
server/migrations/2024-08-12-191216_delete_last_processed_table/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Your SQL goes | ||
DROP TABLE IF EXISTS "dataset_words_last_processed"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.