timescaledb 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timescaledb/acts_as_hypertable/core.rb +1 -1
- data/lib/timescaledb/database/quoting.rb +12 -0
- data/lib/timescaledb/database/schema_statements.rb +168 -0
- data/lib/timescaledb/database/types.rb +17 -0
- data/lib/timescaledb/database.rb +11 -0
- data/lib/timescaledb/toolkit/time_vector.rb +41 -4
- data/lib/timescaledb/version.rb +1 -1
- metadata +6 -95
- data/.github/workflows/ci.yml +0 -72
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.ruby-version +0 -1
- data/.tool-versions +0 -1
- data/.travis.yml +0 -9
- data/CODE_OF_CONDUCT.md +0 -74
- data/Fastfile +0 -17
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -75
- data/Gemfile.scenic +0 -7
- data/Gemfile.scenic.lock +0 -119
- data/README.md +0 -490
- data/Rakefile +0 -21
- data/bin/console +0 -28
- data/bin/setup +0 -13
- data/docs/command_line.md +0 -178
- data/docs/img/lttb_example.png +0 -0
- data/docs/img/lttb_sql_vs_ruby.gif +0 -0
- data/docs/img/lttb_zoom.gif +0 -0
- data/docs/index.md +0 -72
- data/docs/migrations.md +0 -76
- data/docs/models.md +0 -78
- data/docs/toolkit.md +0 -507
- data/docs/toolkit_lttb_tutorial.md +0 -557
- data/docs/toolkit_lttb_zoom.md +0 -357
- data/docs/toolkit_ohlc.md +0 -315
- data/docs/videos.md +0 -16
- data/examples/all_in_one/all_in_one.rb +0 -94
- data/examples/all_in_one/benchmark_comparison.rb +0 -108
- data/examples/all_in_one/caggs.rb +0 -93
- data/examples/all_in_one/query_data.rb +0 -78
- data/examples/ranking/.gitattributes +0 -7
- data/examples/ranking/.gitignore +0 -29
- data/examples/ranking/.ruby-version +0 -1
- data/examples/ranking/Gemfile +0 -33
- data/examples/ranking/Gemfile.lock +0 -189
- data/examples/ranking/README.md +0 -166
- data/examples/ranking/Rakefile +0 -6
- data/examples/ranking/app/controllers/application_controller.rb +0 -2
- data/examples/ranking/app/controllers/concerns/.keep +0 -0
- data/examples/ranking/app/jobs/application_job.rb +0 -7
- data/examples/ranking/app/models/application_record.rb +0 -3
- data/examples/ranking/app/models/concerns/.keep +0 -0
- data/examples/ranking/app/models/game.rb +0 -2
- data/examples/ranking/app/models/play.rb +0 -7
- data/examples/ranking/bin/bundle +0 -114
- data/examples/ranking/bin/rails +0 -4
- data/examples/ranking/bin/rake +0 -4
- data/examples/ranking/bin/setup +0 -33
- data/examples/ranking/config/application.rb +0 -39
- data/examples/ranking/config/boot.rb +0 -4
- data/examples/ranking/config/credentials.yml.enc +0 -1
- data/examples/ranking/config/database.yml +0 -86
- data/examples/ranking/config/environment.rb +0 -5
- data/examples/ranking/config/environments/development.rb +0 -60
- data/examples/ranking/config/environments/production.rb +0 -75
- data/examples/ranking/config/environments/test.rb +0 -53
- data/examples/ranking/config/initializers/cors.rb +0 -16
- data/examples/ranking/config/initializers/filter_parameter_logging.rb +0 -8
- data/examples/ranking/config/initializers/inflections.rb +0 -16
- data/examples/ranking/config/initializers/timescale.rb +0 -2
- data/examples/ranking/config/locales/en.yml +0 -33
- data/examples/ranking/config/puma.rb +0 -43
- data/examples/ranking/config/routes.rb +0 -6
- data/examples/ranking/config/storage.yml +0 -34
- data/examples/ranking/config.ru +0 -6
- data/examples/ranking/db/migrate/20220209120747_create_games.rb +0 -10
- data/examples/ranking/db/migrate/20220209120910_create_plays.rb +0 -19
- data/examples/ranking/db/migrate/20220209143347_create_score_per_hours.rb +0 -5
- data/examples/ranking/db/schema.rb +0 -47
- data/examples/ranking/db/seeds.rb +0 -7
- data/examples/ranking/db/views/score_per_hours_v01.sql +0 -7
- data/examples/ranking/lib/tasks/.keep +0 -0
- data/examples/ranking/log/.keep +0 -0
- data/examples/ranking/public/robots.txt +0 -1
- data/examples/ranking/storage/.keep +0 -0
- data/examples/ranking/tmp/.keep +0 -0
- data/examples/ranking/tmp/pids/.keep +0 -0
- data/examples/ranking/tmp/storage/.keep +0 -0
- data/examples/ranking/vendor/.keep +0 -0
- data/examples/toolkit-demo/compare_volatility.rb +0 -104
- data/examples/toolkit-demo/lttb/README.md +0 -15
- data/examples/toolkit-demo/lttb/lttb.rb +0 -92
- data/examples/toolkit-demo/lttb/lttb_sinatra.rb +0 -139
- data/examples/toolkit-demo/lttb/lttb_test.rb +0 -21
- data/examples/toolkit-demo/lttb/views/index.erb +0 -27
- data/examples/toolkit-demo/lttb-zoom/README.md +0 -13
- data/examples/toolkit-demo/lttb-zoom/lttb_zoomable.rb +0 -90
- data/examples/toolkit-demo/lttb-zoom/views/index.erb +0 -33
- data/examples/toolkit-demo/ohlc.rb +0 -175
- data/mkdocs.yml +0 -34
- data/timescaledb.gemspec +0 -40
data/examples/ranking/README.md
DELETED
@@ -1,166 +0,0 @@
|
|
1
|
-
# README
|
2
|
-
|
3
|
-
This example application is a "Scoring" service that stores "games" and "plays" of the games in question.
|
4
|
-
|
5
|
-
There are two tables:
|
6
|
-
|
7
|
-
* `games` that holds a name and description
|
8
|
-
* `plays` is a [hypertable][hypertable] that references a `game`, storing `score` and `total_time`.
|
9
|
-
|
10
|
-
Interesting things to observe here:
|
11
|
-
|
12
|
-
* The gem is required on [config/initializers/timescale.rb](./config/initializers/timescale.rb).
|
13
|
-
* The [hypertable creation](db/migrate/20220209120910_create_plays.rb) is also with the `enable_extension` command time.
|
14
|
-
* See how the [play model](app/models/play.rb) uses [acts_as_hypertable](../../lib/timescale/acts_as_hypertable.rb).
|
15
|
-
|
16
|
-
## Walkthrough
|
17
|
-
|
18
|
-
Use `bin/console` to preload the environment and follow the next steps.
|
19
|
-
|
20
|
-
Let's start by creating a game and a single play.
|
21
|
-
|
22
|
-
```ruby
|
23
|
-
lol = Game.create(name: "LoL", description: "League of Legends")
|
24
|
-
Play.create(game: lol,
|
25
|
-
score: (rand * 100).to_i,
|
26
|
-
total_time: (rand * 1000).to_i)
|
27
|
-
```
|
28
|
-
You can also insert a few hundreds/thousands/millions of records to test it properly.
|
29
|
-
|
30
|
-
```ruby
|
31
|
-
100.times do
|
32
|
-
Play.create(game: lol,
|
33
|
-
score: (rand * 100).to_i,
|
34
|
-
total_time: (rand * 1000).to_i)
|
35
|
-
end
|
36
|
-
```
|
37
|
-
|
38
|
-
You can play with multiple games and millions of play records to make it an impressive playground if you want :wink:
|
39
|
-
|
40
|
-
|
41
|
-
Then you can experiment with the [time_bucket][time_bucket] funciton.
|
42
|
-
|
43
|
-
```ruby
|
44
|
-
Play.group("time_bucket('1 min',created_at)").count
|
45
|
-
# => {2022-02-09 12:34:00 UTC=>1, 2022-02-09 12:39:00 UTC=>10100}
|
46
|
-
```
|
47
|
-
|
48
|
-
> Hypertables in TimescaleDB are designed to be easy to manage and to behave predictably to users familiar with standard PostgreSQL tables. Along those lines, SQL commands to create, alter, or delete hypertables in TimescaleDB are identical to those in PostgreSQL. Even though hypertables are comprised of many interlinked chunks, commands made to the hypertable automatically propagate changes down to all of the chunks belonging to that hypertable.
|
49
|
-
|
50
|
-
When the model contains the `acts_as_hypertable` macro, it's possible to navigate into the hypertable internals:
|
51
|
-
|
52
|
-
```ruby
|
53
|
-
Play.hypertable
|
54
|
-
# => #<Timescaledb::Hypertable:0x00007faa97df7e30
|
55
|
-
# hypertable_schema: "public",
|
56
|
-
# hypertable_name: "plays",
|
57
|
-
# owner: "jonatasdp",
|
58
|
-
# num_dimensions: 1,
|
59
|
-
# num_chunks: 2,
|
60
|
-
# compression_enabled: true,
|
61
|
-
# is_distributed: false,
|
62
|
-
# replication_factor: nil,
|
63
|
-
# data_nodes: nil,
|
64
|
-
# tablespaces: nil>
|
65
|
-
```
|
66
|
-
|
67
|
-
Each hypertable has many chunks. Chunks are the subtables spread accross the time. You can check chunks metadata from the `hypertable` relation here:
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
Play.hypertable.chunks.pluck(:chunk_name)
|
71
|
-
# => ["_hyper_1_1_chunk", "_hyper_1_2_chunk"]
|
72
|
-
```
|
73
|
-
|
74
|
-
Chunks can also be compressed/decompressed and you can check the state using scopes:
|
75
|
-
|
76
|
-
```ruby
|
77
|
-
Play.hypertable.chunks.compressed.count # => 2
|
78
|
-
```
|
79
|
-
|
80
|
-
Get a resume from chunks status:
|
81
|
-
|
82
|
-
```ruby
|
83
|
-
Play.hypertable.chunks.resume
|
84
|
-
# => {:total=>2, :compressed=>0, :uncompressed=>2}
|
85
|
-
```
|
86
|
-
|
87
|
-
To get a full stats from all hypertables, you can see `Timescaledb.stats`:
|
88
|
-
|
89
|
-
```ruby
|
90
|
-
Timescaledb.stats
|
91
|
-
# => {:hypertables=>
|
92
|
-
# {:count=>1,
|
93
|
-
# :uncompressed=>0,
|
94
|
-
# :approximate_row_count=>{"plays"=>10100},
|
95
|
-
# :chunks=>{:total=>2, :compressed=>0, :uncompressed=>2},
|
96
|
-
# :size=>{:uncompressed=>"1.3 MB", :compressed=>"0 Bytes"}},
|
97
|
-
# :continuous_aggregates=>{:total=>0},
|
98
|
-
# :jobs_stats=>[{:success=>100, :runs=>100, :failures=>0}]}
|
99
|
-
```
|
100
|
-
Note that we haven't used compression yet. So, we can force compression directly from the `chunk` relation:
|
101
|
-
|
102
|
-
```ruby
|
103
|
-
Play.hypertable.chunks.each(&:compress!)
|
104
|
-
```
|
105
|
-
|
106
|
-
Calling `stats` to check the compressed size:
|
107
|
-
|
108
|
-
```ruby
|
109
|
-
Timescaledb.stats
|
110
|
-
# {:count=>1, ...
|
111
|
-
# :size=>
|
112
|
-
# {:uncompressed=>"1.2 MB",
|
113
|
-
# :compressed=>"180 KB"}},
|
114
|
-
# :continuous_aggregates=>{:total=>0},
|
115
|
-
# :jobs_stats=>
|
116
|
-
# [{:success=>107,
|
117
|
-
# :runs=>107,
|
118
|
-
# :failures=>0}]}
|
119
|
-
```
|
120
|
-
|
121
|
-
> :warning: Note that the chunks are not very effective compressing here because of the example is incomplete and with a little amount of records.
|
122
|
-
|
123
|
-
You can decompress as the system will make the compression in the background as it already have a policy.
|
124
|
-
|
125
|
-
```ruby
|
126
|
-
Play.hypertable.chunks.each(&:decompress!)
|
127
|
-
```
|
128
|
-
|
129
|
-
## Dump schema
|
130
|
-
|
131
|
-
The lib also contains a [schema_dumper](../../lib/timescale/schema_dumper.rb) that allows you to dump the schema and reload with the same hypertable options.
|
132
|
-
|
133
|
-
```bash
|
134
|
-
rails db:schema:dump
|
135
|
-
```
|
136
|
-
|
137
|
-
Confirm that the hypertable is on [db/schema.rb](db/schema.rb) file:
|
138
|
-
|
139
|
-
```
|
140
|
-
grep hypertable db/schema.rb
|
141
|
-
create_hypertable "plays", time_column: "created_at", chunk_time_interval: "1
|
142
|
-
minute", compress_segmentby: "game_id", compress_orderby: "created_at ASC",
|
143
|
-
compression_interval: "P7D"
|
144
|
-
```
|
145
|
-
|
146
|
-
And you can also reload the configuration manually in the test environment:
|
147
|
-
|
148
|
-
```bash
|
149
|
-
RAILS_ENV=test rails db:schema:load
|
150
|
-
```
|
151
|
-
|
152
|
-
## Scenic views
|
153
|
-
|
154
|
-
If you use [scenic](https://github.com/scenic-views/scenic) views, it will
|
155
|
-
automatically recognize and dump the views.
|
156
|
-
|
157
|
-
Check the [view migration](db/migrate/20220209143347_create_score_per_hours.rb)
|
158
|
-
and the correspondent view defined in the [sql file](db/views/score_per_hours_v01.sql).
|
159
|
-
|
160
|
-
> Note that scenic is not fully compatible with timescaledb continous aggregates
|
161
|
-
> and we created a [helper](../../lib/timescale/scenic/extension.rb) to make it
|
162
|
-
> easy to use along with scenic.
|
163
|
-
|
164
|
-
[hypertable]: https://docs.timescale.com/timescaledb/latest/how-to-guides/hypertables/
|
165
|
-
[time_bucket]: https://docs.timescale.com/api/latest/hyperfunctions/time_bucket/
|
166
|
-
|
data/examples/ranking/Rakefile
DELETED
File without changes
|
@@ -1,7 +0,0 @@
|
|
1
|
-
class ApplicationJob < ActiveJob::Base
|
2
|
-
# Automatically retry jobs that encountered a deadlock
|
3
|
-
# retry_on ActiveRecord::Deadlocked
|
4
|
-
|
5
|
-
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
-
# discard_on ActiveJob::DeserializationError
|
7
|
-
end
|
File without changes
|
data/examples/ranking/bin/bundle
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'bundle' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "rubygems"
|
12
|
-
|
13
|
-
m = Module.new do
|
14
|
-
module_function
|
15
|
-
|
16
|
-
def invoked_as_script?
|
17
|
-
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
-
end
|
19
|
-
|
20
|
-
def env_var_version
|
21
|
-
ENV["BUNDLER_VERSION"]
|
22
|
-
end
|
23
|
-
|
24
|
-
def cli_arg_version
|
25
|
-
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
-
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
-
bundler_version = nil
|
28
|
-
update_index = nil
|
29
|
-
ARGV.each_with_index do |a, i|
|
30
|
-
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
-
bundler_version = a
|
32
|
-
end
|
33
|
-
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
-
bundler_version = $1
|
35
|
-
update_index = i
|
36
|
-
end
|
37
|
-
bundler_version
|
38
|
-
end
|
39
|
-
|
40
|
-
def gemfile
|
41
|
-
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
-
return gemfile if gemfile && !gemfile.empty?
|
43
|
-
|
44
|
-
File.expand_path("../../Gemfile", __FILE__)
|
45
|
-
end
|
46
|
-
|
47
|
-
def lockfile
|
48
|
-
lockfile =
|
49
|
-
case File.basename(gemfile)
|
50
|
-
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
-
else "#{gemfile}.lock"
|
52
|
-
end
|
53
|
-
File.expand_path(lockfile)
|
54
|
-
end
|
55
|
-
|
56
|
-
def lockfile_version
|
57
|
-
return unless File.file?(lockfile)
|
58
|
-
lockfile_contents = File.read(lockfile)
|
59
|
-
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
-
Regexp.last_match(1)
|
61
|
-
end
|
62
|
-
|
63
|
-
def bundler_version
|
64
|
-
@bundler_version ||=
|
65
|
-
env_var_version || cli_arg_version ||
|
66
|
-
lockfile_version
|
67
|
-
end
|
68
|
-
|
69
|
-
def bundler_requirement
|
70
|
-
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
-
|
72
|
-
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
-
|
74
|
-
requirement = bundler_gem_version.approximate_recommendation
|
75
|
-
|
76
|
-
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
-
|
78
|
-
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
-
|
80
|
-
requirement
|
81
|
-
end
|
82
|
-
|
83
|
-
def load_bundler!
|
84
|
-
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
85
|
-
|
86
|
-
activate_bundler
|
87
|
-
end
|
88
|
-
|
89
|
-
def activate_bundler
|
90
|
-
gem_error = activation_error_handling do
|
91
|
-
gem "bundler", bundler_requirement
|
92
|
-
end
|
93
|
-
return if gem_error.nil?
|
94
|
-
require_error = activation_error_handling do
|
95
|
-
require "bundler/version"
|
96
|
-
end
|
97
|
-
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
-
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
|
-
exit 42
|
100
|
-
end
|
101
|
-
|
102
|
-
def activation_error_handling
|
103
|
-
yield
|
104
|
-
nil
|
105
|
-
rescue StandardError, LoadError => e
|
106
|
-
e
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
m.load_bundler!
|
111
|
-
|
112
|
-
if m.invoked_as_script?
|
113
|
-
load Gem.bin_path("bundler", "bundle")
|
114
|
-
end
|
data/examples/ranking/bin/rails
DELETED
data/examples/ranking/bin/rake
DELETED
data/examples/ranking/bin/setup
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
# path to your application root.
|
5
|
-
APP_ROOT = File.expand_path("..", __dir__)
|
6
|
-
|
7
|
-
def system!(*args)
|
8
|
-
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
-
end
|
10
|
-
|
11
|
-
FileUtils.chdir APP_ROOT do
|
12
|
-
# This script is a way to set up or update your development environment automatically.
|
13
|
-
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
|
-
# Add necessary setup steps to this file.
|
15
|
-
|
16
|
-
puts "== Installing dependencies =="
|
17
|
-
system! "gem install bundler --conservative"
|
18
|
-
system("bundle check") || system!("bundle install")
|
19
|
-
|
20
|
-
# puts "\n== Copying sample files =="
|
21
|
-
# unless File.exist?("config/database.yml")
|
22
|
-
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
23
|
-
# end
|
24
|
-
|
25
|
-
puts "\n== Preparing database =="
|
26
|
-
system! "bin/rails db:prepare"
|
27
|
-
|
28
|
-
puts "\n== Removing old logs and tempfiles =="
|
29
|
-
system! "bin/rails log:clear tmp:clear"
|
30
|
-
|
31
|
-
puts "\n== Restarting application server =="
|
32
|
-
system! "bin/rails restart"
|
33
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require_relative "boot"
|
2
|
-
|
3
|
-
require "rails"
|
4
|
-
# Pick the frameworks you want:
|
5
|
-
require "active_model/railtie"
|
6
|
-
require "active_job/railtie"
|
7
|
-
require "active_record/railtie"
|
8
|
-
require "active_storage/engine"
|
9
|
-
require "action_controller/railtie"
|
10
|
-
# require "action_mailer/railtie"
|
11
|
-
require "action_mailbox/engine"
|
12
|
-
require "action_text/engine"
|
13
|
-
require "action_view/railtie"
|
14
|
-
# require "action_cable/engine"
|
15
|
-
# require "rails/test_unit/railtie"
|
16
|
-
|
17
|
-
# Require the gems listed in Gemfile, including any gems
|
18
|
-
# you've limited to :test, :development, or :production.
|
19
|
-
Bundler.require(*Rails.groups)
|
20
|
-
|
21
|
-
module Ranking
|
22
|
-
class Application < Rails::Application
|
23
|
-
# Initialize configuration defaults for originally generated Rails version.
|
24
|
-
config.load_defaults 7.0
|
25
|
-
|
26
|
-
# Configuration for the application, engines, and railties goes here.
|
27
|
-
#
|
28
|
-
# These settings can be overridden in specific environments using the files
|
29
|
-
# in config/environments, which are processed later.
|
30
|
-
#
|
31
|
-
# config.time_zone = "Central Time (US & Canada)"
|
32
|
-
# config.eager_load_paths << Rails.root.join("extras")
|
33
|
-
|
34
|
-
# Only loads a smaller set of middleware suitable for API only apps.
|
35
|
-
# Middleware like session, flash, cookies can be added back manually.
|
36
|
-
# Skip views, helpers and assets when generating a new resource.
|
37
|
-
config.api_only = true
|
38
|
-
end
|
39
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
89mWxkKPY+RpiS3ysJ0FE9ljcVzmhiJVCYL9MVKwqPzkU/tUhehytnhibSz/ZNV/ef8WqOzYm5DfFfKXAXXixut/Aazw8725RxxLUDcikpy8ayr13WZgj91XlaPLCHPVyuNlxgVJFN8HPw++Xfe3pakKeJB0hhAlCgwCWIT7tx7Zf6g8KaIbdvJ+U9drEu3n4OgaQuw+wzRU1EaI80BbX1r9+Uufg6t7mWzMEh7n55HEBTinyNL/UZgQ0XvOQs+bQjjHVxRATXT2Mxt1zF3FZQZ6ECtOPKBKit9PDaS3RCkN2tk3ObvXlmSbz2vcIB/oW03M63TfjmfXjpG25N8tXqLl0MKoyOv/3UiBqeC7orNLTXZuWxpaQyCjpTqmza/rQyPkTRsUt+V1Rtw1gZfMbTK/JOdXr1feMhrl--91mPoTmwkbiDY9sK--49vaWMgJTV11y2bdEDMgug==
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# PostgreSQL. Versions 9.3 and up are supported.
|
2
|
-
#
|
3
|
-
# Install the pg driver:
|
4
|
-
# gem install pg
|
5
|
-
# On macOS with Homebrew:
|
6
|
-
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
7
|
-
# On macOS with MacPorts:
|
8
|
-
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
9
|
-
# On Windows:
|
10
|
-
# gem install pg
|
11
|
-
# Choose the win32 build.
|
12
|
-
# Install PostgreSQL and put its /bin directory on your path.
|
13
|
-
#
|
14
|
-
# Configure Using Gemfile
|
15
|
-
# gem "pg"
|
16
|
-
#
|
17
|
-
default: &default
|
18
|
-
adapter: postgresql
|
19
|
-
encoding: unicode
|
20
|
-
# For details on connection pooling, see Rails configuration guide
|
21
|
-
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
22
|
-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
23
|
-
|
24
|
-
development:
|
25
|
-
<<: *default
|
26
|
-
database: ranking_development
|
27
|
-
|
28
|
-
# The specified database role being used to connect to postgres.
|
29
|
-
# To create additional roles in postgres see `$ createuser --help`.
|
30
|
-
# When left blank, postgres will use the default role. This is
|
31
|
-
# the same name as the operating system user running Rails.
|
32
|
-
#username: ranking
|
33
|
-
|
34
|
-
# The password associated with the postgres role (username).
|
35
|
-
#password:
|
36
|
-
|
37
|
-
# Connect on a TCP socket. Omitted by default since the client uses a
|
38
|
-
# domain socket that doesn't need configuration. Windows does not have
|
39
|
-
# domain sockets, so uncomment these lines.
|
40
|
-
#host: localhost
|
41
|
-
|
42
|
-
# The TCP port the server listens on. Defaults to 5432.
|
43
|
-
# If your server runs on a different port number, change accordingly.
|
44
|
-
#port: 5432
|
45
|
-
|
46
|
-
# Schema search path. The server defaults to $user,public
|
47
|
-
#schema_search_path: myapp,sharedapp,public
|
48
|
-
|
49
|
-
# Minimum log levels, in increasing order:
|
50
|
-
# debug5, debug4, debug3, debug2, debug1,
|
51
|
-
# log, notice, warning, error, fatal, and panic
|
52
|
-
# Defaults to warning.
|
53
|
-
#min_messages: notice
|
54
|
-
|
55
|
-
# Warning: The database defined as "test" will be erased and
|
56
|
-
# re-generated from your development database when you run "rake".
|
57
|
-
# Do not set this db to the same as development or production.
|
58
|
-
test:
|
59
|
-
<<: *default
|
60
|
-
database: ranking_test
|
61
|
-
|
62
|
-
# As with config/credentials.yml, you never want to store sensitive information,
|
63
|
-
# like your database password, in your source code. If your source code is
|
64
|
-
# ever seen by anyone, they now have access to your database.
|
65
|
-
#
|
66
|
-
# Instead, provide the password or a full connection URL as an environment
|
67
|
-
# variable when you boot the app. For example:
|
68
|
-
#
|
69
|
-
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
70
|
-
#
|
71
|
-
# If the connection URL is provided in the special DATABASE_URL environment
|
72
|
-
# variable, Rails will automatically merge its configuration values on top of
|
73
|
-
# the values provided in this file. Alternatively, you can specify a connection
|
74
|
-
# URL environment variable explicitly:
|
75
|
-
#
|
76
|
-
# production:
|
77
|
-
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
|
78
|
-
#
|
79
|
-
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
80
|
-
# for a full overview on how database connection configuration can be specified.
|
81
|
-
#
|
82
|
-
production:
|
83
|
-
<<: *default
|
84
|
-
database: ranking_production
|
85
|
-
username: ranking
|
86
|
-
password: <%= ENV["RANKING_DATABASE_PASSWORD"] %>
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
2
|
-
|
3
|
-
Rails.application.configure do
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
-
|
6
|
-
# In the development environment your application's code is reloaded any time
|
7
|
-
# it changes. This slows down response time but is perfect for development
|
8
|
-
# since you don't have to restart the web server when you make code changes.
|
9
|
-
config.cache_classes = false
|
10
|
-
|
11
|
-
# Do not eager load code on boot.
|
12
|
-
config.eager_load = false
|
13
|
-
|
14
|
-
# Show full error reports.
|
15
|
-
config.consider_all_requests_local = true
|
16
|
-
|
17
|
-
# Enable server timing
|
18
|
-
config.server_timing = true
|
19
|
-
|
20
|
-
# Enable/disable caching. By default caching is disabled.
|
21
|
-
# Run rails dev:cache to toggle caching.
|
22
|
-
if Rails.root.join("tmp/caching-dev.txt").exist?
|
23
|
-
config.cache_store = :memory_store
|
24
|
-
config.public_file_server.headers = {
|
25
|
-
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
26
|
-
}
|
27
|
-
else
|
28
|
-
config.action_controller.perform_caching = false
|
29
|
-
|
30
|
-
config.cache_store = :null_store
|
31
|
-
end
|
32
|
-
|
33
|
-
# Store uploaded files on the local file system (see config/storage.yml for options).
|
34
|
-
config.active_storage.service = :local
|
35
|
-
|
36
|
-
# Print deprecation notices to the Rails logger.
|
37
|
-
config.active_support.deprecation = :log
|
38
|
-
|
39
|
-
# Raise exceptions for disallowed deprecations.
|
40
|
-
config.active_support.disallowed_deprecation = :raise
|
41
|
-
|
42
|
-
# Tell Active Support which deprecation messages to disallow.
|
43
|
-
config.active_support.disallowed_deprecation_warnings = []
|
44
|
-
|
45
|
-
# Raise an error on page load if there are pending migrations.
|
46
|
-
config.active_record.migration_error = :page_load
|
47
|
-
|
48
|
-
# Highlight code that triggered database queries in logs.
|
49
|
-
config.active_record.verbose_query_logs = true
|
50
|
-
|
51
|
-
|
52
|
-
# Raises error for missing translations.
|
53
|
-
# config.i18n.raise_on_missing_translations = true
|
54
|
-
|
55
|
-
# Annotate rendered view with file names.
|
56
|
-
# config.action_view.annotate_rendered_view_with_filenames = true
|
57
|
-
|
58
|
-
# Uncomment if you wish to allow Action Cable access from any origin.
|
59
|
-
# config.action_cable.disable_request_forgery_protection = true
|
60
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
2
|
-
|
3
|
-
Rails.application.configure do
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
-
|
6
|
-
# Code is not reloaded between requests.
|
7
|
-
config.cache_classes = true
|
8
|
-
|
9
|
-
# Eager load code on boot. This eager loads most of Rails and
|
10
|
-
# your application in memory, allowing both threaded web servers
|
11
|
-
# and those relying on copy on write to perform better.
|
12
|
-
# Rake tasks automatically ignore this option for performance.
|
13
|
-
config.eager_load = true
|
14
|
-
|
15
|
-
# Full error reports are disabled and caching is turned on.
|
16
|
-
config.consider_all_requests_local = false
|
17
|
-
|
18
|
-
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
19
|
-
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
20
|
-
# config.require_master_key = true
|
21
|
-
|
22
|
-
# Disable serving static files from the `/public` folder by default since
|
23
|
-
# Apache or NGINX already handles this.
|
24
|
-
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
25
|
-
|
26
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
27
|
-
# config.asset_host = "http://assets.example.com"
|
28
|
-
|
29
|
-
# Specifies the header that your server uses for sending files.
|
30
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
31
|
-
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
32
|
-
|
33
|
-
# Store uploaded files on the local file system (see config/storage.yml for options).
|
34
|
-
config.active_storage.service = :local
|
35
|
-
|
36
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
37
|
-
# config.force_ssl = true
|
38
|
-
|
39
|
-
# Include generic and useful information about system operation, but avoid logging too much
|
40
|
-
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
41
|
-
config.log_level = :info
|
42
|
-
|
43
|
-
# Prepend all log lines with the following tags.
|
44
|
-
config.log_tags = [ :request_id ]
|
45
|
-
|
46
|
-
# Use a different cache store in production.
|
47
|
-
# config.cache_store = :mem_cache_store
|
48
|
-
|
49
|
-
# Use a real queuing backend for Active Job (and separate queues per environment).
|
50
|
-
# config.active_job.queue_adapter = :resque
|
51
|
-
# config.active_job.queue_name_prefix = "ranking_production"
|
52
|
-
|
53
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
54
|
-
# the I18n.default_locale when a translation cannot be found).
|
55
|
-
config.i18n.fallbacks = true
|
56
|
-
|
57
|
-
# Don't log any deprecations.
|
58
|
-
config.active_support.report_deprecations = false
|
59
|
-
|
60
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
61
|
-
config.log_formatter = ::Logger::Formatter.new
|
62
|
-
|
63
|
-
# Use a different logger for distributed setups.
|
64
|
-
# require "syslog/logger"
|
65
|
-
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
66
|
-
|
67
|
-
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
68
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
69
|
-
logger.formatter = config.log_formatter
|
70
|
-
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
71
|
-
end
|
72
|
-
|
73
|
-
# Do not dump schema after migrations.
|
74
|
-
config.active_record.dump_schema_after_migration = false
|
75
|
-
end
|