-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate vm_messages to hypertable (#1149)
* Migrate vm_messages to hypertable * Add column if not exists * Add comment * Add comment
- Loading branch information
1 parent
5ece2fa
commit 68bf175
Showing
2 changed files
with
26 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package v1 | ||
|
||
func init() { | ||
patches.Register( | ||
14, | ||
` | ||
{{- if and .SchemaName (ne .SchemaName "public") }} | ||
SET search_path TO {{ .SchemaName }},public; | ||
{{- end }} | ||
-- Convert messages to a hypertable partitioned on height (time) | ||
-- Setting the time interval to 2880 heights so there will be one chunk per day. | ||
SELECT create_hypertable( | ||
'vm_messages', | ||
'height', | ||
chunk_time_interval => 2880, | ||
if_not_exists => TRUE, | ||
migrate_data => TRUE | ||
); | ||
SELECT set_integer_now_func('vm_messages', 'current_height', replace_if_exists => true); | ||
`, | ||
) | ||
} |