forked from getlago/lago-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clickhouse): Add support for clickhouse migrations (getlago#1409)
* feat(clickhouse): Add support for clickhouse migrations * Ignore rubocop in clickhouse generated schema * feat(clickhouse): Add events_raw model * feat(clickhouse): Update gem
- Loading branch information
1 parent
2523dbb
commit 5d8cec1
Showing
8 changed files
with
61 additions
and
10 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
module Clickhouse | ||
class EventsRaw < BaseRecord | ||
self.table_name = 'events_raw' | ||
end | ||
end |
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
Empty file.
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,23 @@ | ||
class CreateEventsRaw < ActiveRecord::Migration[7.0] | ||
def change | ||
options = <<-SQL | ||
MergeTree | ||
PRIMARY KEY (organization_id, external_subscription_id, code, toStartOfDay(timestamp)) | ||
TTL | ||
timestamp TO VOLUME 'hot', | ||
timestamp + INTERVAL 90 DAY TO VOLUME 'cold' | ||
SETTINGS | ||
storage_policy = 'hot_cold'; | ||
SQL | ||
|
||
create_table :events_raw, id: false, options: do |t| | ||
t.string :organization_id, null: false | ||
t.string :external_customer_id, null: false | ||
t.string :external_subscription_id, null: false | ||
t.string :transaction_id, null: false | ||
t.datetime :timestamp, null: false | ||
t.string :code, null: false | ||
t.string :properties, null: false | ||
end | ||
end | ||
end |
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