最近写的网站,和教程上一样,在开发测试环境是 sqlite3 数据库,在部署用的是 heroku 的 postgres 数据库,我在本地开发环境下看是没有问题的,显示很正常,
但是在 herokuapp 上就会报错,
这种的要咋整呢?直接把本地的数据库也整成 pg 么?但是之前试过会报错啊。。。
如下是 problems/index.html.erb
<% provide(:title, 'Problems List') %>
<h1>Problems List</h1>
<table border="1" align=center>
<tr>
<th></th>
<th>Total</th>
<th>BL</th>
<th>Component</th>
</tr>
<!--从一开始到现在所有问题数量及细分-->
<tr>
<th width=80px>All</th>
<td width=80px><%= @problems.count %></td>
<td width=80px><%= @problems.where("lob"=>"BL").count %></td>
<td width=80px><%= @problems.where("lob"=>"Component").count %></td>
</tr>
<!--去年一年内产生问题数量及细分-->
<tr>
<th width=80px>Last Year</th>
<td width=80px><%= @problems.find_by_sql("select * from problems where detected_at > date('now','start of year','-1 year') AND detected_at < date('now','start of year','1 second')").count %></td>
<td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'BL' AND detected_at > date('now','start of year','-1 year') AND detected_at < date('now','start of year','1 second')").count %></td>
<td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'Component' AND detected_at > date('now','start of year','-1 year') AND detected_at < date('now','start of year','1 second')").count %></td>
</tr>
<!--滚动的12个月内产生的问题数量及细分,包括本月数据,今天是2020.2.15,查询2019.2.15-至今的数据-->
<tr>
<th width=130px>Previous 12 Month</th>
<td width=80px><%= @problems.find_by_sql("select * from problems where detected_at > date('now','start of day','-12 month') AND detected_at < date('now')").count %></td>
<td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'BL' AND detected_at > date('now','start of day','-12 month') AND detected_at < date('now')").count %></td>
<td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'Component' AND detected_at > date('now','start of day','-12 month') AND detected_at < date('now')").count %></td>
</tr>
<!--上个月产生的问题数量及细分,不包括本月数据-->
<tr>
<th>Last Month</th>
<td width=80px><%= @problems.find_by_sql("select * from problems where detected_at > date('now','start of month','-1 month') AND detected_at < date('now','start of month','-1 second')").count %></td>
<td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'BL' AND detected_at > date('now','start of month',' -1 month') AND detected_at < date('now','start of month','-1 second')").count %></td>
<td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'Component' AND detected_at > date('now','start of month',' -1 month') AND detected_at < date('now','start of month','-1 second')").count %></td>
</tr>
<!--本月产生问题及细分-->
<tr>
<th>This Month</th>
<td width=80px><%= @problems.find_by_sql("select * from problems where detected_at > date('now','start of month','1 second')").count %></td>
<td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'BL' AND detected_at > date('now','start of month','1 second')").count %></td>
<td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'Component' AND detected_at > date('now','start of month','1 second')").count %></td>
</tr>
</table>
<span class="button">
<p>
<%= link_to "Download", problems_path(format: "csv"),class: "btn btn-success" %>
<!--Search function to be finished -->
<!--<div>-->
<!-- <form class="navbar-form d-none d-lg-flex mr-2 form-search active" action="/search" method="GET">-->
<!-- <i class="fa btn-search fa-search"></i>-->
<!-- <input class="form-control" name="q" type="text" value placeholder="Search..."> -->
<!-- </form>-->
<!--</div>-->
</p>
</span>
<table border = "1" width = 100%>
<tr>
<th align="center">User</th>
<th>Product Name</th>
<th>Detected at</th>
<th>Supplier</th>
<th>CR No.</th>
<th>CR Link</th>
<th class="tha">Description</th>
<th>Status</th>
<th colspan="3">Operation</th>
</tr>
<tbody>
<% @problems.each do |problem| %>
<tr>
<%= will_paginate %>
<td align=center><%= link_to problem.user.name, problem.user %></td>
<td align=center><%= problem.productname %></td>
<td align=center><%= problem.detected_at.strftime("%Y-%m-%d")%></td>
<td align=center><%= problem.supplier %></td>
<td align=center><%= problem.crno %></td>
<span>
<% if problem.link.to_s.blank? %>
<td></td>
<% else %>
<td align=center><%= link_to "Link",problem.link, :target => '_blank' %></td>
<% end %>
</span>
<td width=50% align=left><%= problem.description %></td>
<td align=center><%= problem.status %></td>
<span class="DO">
<% if current_user?(problem.user) %>
<td align=center width =3%><%= link_to "Detail", problem %></td>
<td align=center width =3%><%= link_to "Edit", edit_problem_path(problem) %></td>
<td width = 3%><%= link_to "Delete", problem, method: :delete, data: { confirm: "You sure?" } %></td>
<% else %>
<td><%= link_to "Detail", problem%></td>
<td></td>
<td></td>
<% end %>
</span>
<%= will_paginate %>
</tr>
<% end %>
</tbody>
</table>
heroku log:
ubuntu:~/environment/SEQ_Rails5.2.0 (master) $ heroku logs
2020-02-18T15:57:00.802023+00:00 app[web.1]: I, [2020-02-18T15:57:00.801952 #8] INFO -- : [713c5fd0-b627-428a-a505-cfd10da014c5] Completed 200 OK in 273ms (Views: 235.2ms | ActiveRecord: 7.3ms)
2020-02-18T15:57:00.804529+00:00 heroku[router]: at=info method=GET path="/" host=seq6.herokuapp.com request_id=713c5fd0-b627-428a-a505-cfd10da014c5 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=1ms service=279ms status=200 bytes=7353 protocol=https
2020-02-18T15:57:28.082160+00:00 app[web.1]: I, [2020-02-18T15:57:28.082054 #10] INFO -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] Started POST "/problems" for 58.220.95.42 at 2020-02-18 15:57:28 +0000
2020-02-18T15:57:28.082965+00:00 app[web.1]: I, [2020-02-18T15:57:28.082906 #10] INFO -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] Processing by ProblemsController#create as HTML
2020-02-18T15:57:28.083048+00:00 app[web.1]: I, [2020-02-18T15:57:28.082996 #10] INFO -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] Parameters: {"utf8"=>"✓", "authenticity_token"=>"8lWnf2/7/ciIe4q8DztzJvvIgLFQTA2jYtPjNfkfhJf71Q4ZkaQ8VXIOe6ELd5JxAD34N+7F3Wr0tn0h9WlNxw==", "problem"=>{"productid"=>"001", "productname"=>"Test", "detected_at(1i)"=>"2020", "detected_at(2i)"=>"2", "detected_at(3i)"=>"18", "description"=>"Oline test", "supplier"=>"G-shank", "lob"=>"Component", "status"=>"Open", "crno"=>"001", "link"=>"https://www.baidu.com"}, "commit"=>"Submit"}
2020-02-18T15:57:28.087494+00:00 app[web.1]: D, [2020-02-18T15:57:28.087426 #10] DEBUG -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2020-02-18T15:57:28.125359+00:00 app[web.1]: D, [2020-02-18T15:57:28.125223 #10] DEBUG -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] (0.8ms) BEGIN
2020-02-18T15:57:28.131310+00:00 app[web.1]: D, [2020-02-18T15:57:28.131202 #10] DEBUG -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] Problem Create (2.9ms) INSERT INTO "problems" ("detected_at", "description", "lob", "status", "productid", "productname", "crno", "link", "supplier", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id" [["detected_at", "2020-02-18 00:00:00"], ["description", "Oline test"], ["lob", "Component"], ["status", "Open"], ["productid", "001"], ["productname", "Test"], ["crno", "001"], ["link", "https://www.baidu.com"], ["supplier", "G-shank"], ["user_id", 1], ["created_at", "2020-02-18 15:57:28.126483"], ["updated_at", "2020-02-18 15:57:28.126483"]]
2020-02-18T15:57:28.134075+00:00 app[web.1]: D, [2020-02-18T15:57:28.133980 #10] DEBUG -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] (2.2ms) COMMIT
2020-02-18T15:57:28.134712+00:00 app[web.1]: I, [2020-02-18T15:57:28.134618 #10] INFO -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] Redirected to https://seq6.herokuapp.com/
2020-02-18T15:57:28.134983+00:00 app[web.1]: I, [2020-02-18T15:57:28.134890 #10] INFO -- : [ff6e6a9c-5866-4908-98b7-c58dd0dd651b] Completed 302 Found in 52ms (ActiveRecord: 12.6ms)
2020-02-18T15:57:28.137392+00:00 heroku[router]: at=info method=POST path="/problems" host=seq6.herokuapp.com request_id=ff6e6a9c-5866-4908-98b7-c58dd0dd651b fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=0ms service=57ms status=302 bytes=994 protocol=https
2020-02-18T15:57:29.419249+00:00 heroku[router]: at=info method=GET path="/" host=seq6.herokuapp.com request_id=a4d2e770-4a2a-4582-a69c-833bd48adaec fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=0ms service=24ms status=200 bytes=8459 protocol=https
2020-02-18T15:57:29.395417+00:00 app[web.1]: I, [2020-02-18T15:57:29.395315 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Started GET "/" for 58.220.95.42 at 2020-02-18 15:57:29 +0000
2020-02-18T15:57:29.396244+00:00 app[web.1]: I, [2020-02-18T15:57:29.396168 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Processing by StaticPagesController#home as HTML
2020-02-18T15:57:29.398927+00:00 app[web.1]: D, [2020-02-18T15:57:29.398854 #8] DEBUG -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2020-02-18T15:57:29.400729+00:00 app[web.1]: I, [2020-02-18T15:57:29.400644 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendering static_pages/home.html.erb within layouts/application
2020-02-18T15:57:29.402860+00:00 app[web.1]: D, [2020-02-18T15:57:29.402787 #8] DEBUG -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] (1.1ms) SELECT COUNT(*) FROM "problems" WHERE "problems"."user_id" = $1 [["user_id", 1]]
2020-02-18T15:57:29.403031+00:00 app[web.1]: I, [2020-02-18T15:57:29.402963 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered shared/_user_info.html.erb (2.1ms)
2020-02-18T15:57:29.403473+00:00 app[web.1]: I, [2020-02-18T15:57:29.403404 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered shared/_error_messages.html.erb (0.0ms)
2020-02-18T15:57:29.406990+00:00 app[web.1]: I, [2020-02-18T15:57:29.406913 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered shared/_problem_form.html.erb (3.8ms)
2020-02-18T15:57:29.408439+00:00 app[web.1]: D, [2020-02-18T15:57:29.408364 #8] DEBUG -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] (0.9ms) SELECT COUNT(*) FROM "problems" WHERE (user_id = 1)
2020-02-18T15:57:29.410262+00:00 app[web.1]: D, [2020-02-18T15:57:29.410184 #8] DEBUG -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Problem Load (1.2ms) SELECT "problems".* FROM "problems" WHERE (user_id = 1) ORDER BY "problems"."created_at" DESC LIMIT $1 OFFSET $2 [["LIMIT", 30], ["OFFSET", 0]]
2020-02-18T15:57:29.413594+00:00 app[web.1]: D, [2020-02-18T15:57:29.413503 #8] DEBUG -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2020-02-18T15:57:29.414153+00:00 app[web.1]: I, [2020-02-18T15:57:29.414079 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered collection of problems/_problem.html.erb [1 times] (2.9ms)
2020-02-18T15:57:29.414332+00:00 app[web.1]: I, [2020-02-18T15:57:29.414266 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered shared/_feed.html.erb (7.2ms)
2020-02-18T15:57:29.414438+00:00 app[web.1]: I, [2020-02-18T15:57:29.414375 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered static_pages/home.html.erb within layouts/application (13.6ms)
2020-02-18T15:57:29.415019+00:00 app[web.1]: I, [2020-02-18T15:57:29.414951 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered layouts/_shim.html.erb (0.0ms)
2020-02-18T15:57:29.415616+00:00 app[web.1]: I, [2020-02-18T15:57:29.415534 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered layouts/_header.html.erb (0.4ms)
2020-02-18T15:57:29.415885+00:00 app[web.1]: I, [2020-02-18T15:57:29.415810 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Rendered layouts/_footer.html.erb (0.1ms)
2020-02-18T15:57:29.416172+00:00 app[web.1]: I, [2020-02-18T15:57:29.416100 #8] INFO -- : [a4d2e770-4a2a-4582-a69c-833bd48adaec] Completed 200 OK in 20ms (Views: 12.3ms | ActiveRecord: 4.2ms)
2020-02-18T15:57:30.532439+00:00 heroku[router]: at=info method=GET path="/assets/application-d283aae496f2056cf7291fdec8f108d447106cf2e12c69faf064db254b4bcda1.js" host=seq6.herokuapp.com request_id=af8e7a07-2864-41a3-9688-fbf149b5f2e7 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=0ms service=1ms status=304 bytes=112 protocol=https
2020-02-18T15:57:30.551913+00:00 heroku[router]: at=info method=GET path="/assets/application-7b7f66883d7ab50ceac9557c180d2088a847d5408d58c39d179c789af310fafe.css" host=seq6.herokuapp.com request_id=a64bf8a1-264f-4970-ad9b-08a193a4c784 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=1ms service=2ms status=304 bytes=112 protocol=https
2020-02-18T15:57:30.645428+00:00 heroku[router]: at=info method=GET path="/assets/se-logo-white-91a31cc55317c3643962a790342733788eb02cf59f89e114157c6efd7042aab3.png" host=seq6.herokuapp.com request_id=7d4d126e-da25-4881-b0c6-9a879c31b810 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=1ms service=2ms status=304 bytes=112 protocol=https
2020-02-18T15:57:32.057874+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=seq6.herokuapp.com request_id=aab871f8-905c-44c3-8de6-40efe6ad0fe1 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=0ms service=1ms status=304 bytes=112 protocol=https
2020-02-18T15:59:00.511894+00:00 heroku[router]: at=info method=POST path="/problems" host=seq6.herokuapp.com request_id=8bc54d4f-f5b1-4c44-b63c-a546c93271ed fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=1ms service=21ms status=302 bytes=1000 protocol=https
2020-02-18T15:59:00.493534+00:00 app[web.1]: I, [2020-02-18T15:59:00.493428 #8] INFO -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] Started POST "/problems" for 58.220.95.42 at 2020-02-18 15:59:00 +0000
2020-02-18T15:59:00.494479+00:00 app[web.1]: I, [2020-02-18T15:59:00.494409 #8] INFO -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] Processing by ProblemsController#create as HTML
2020-02-18T15:59:00.494565+00:00 app[web.1]: I, [2020-02-18T15:59:00.494501 #8] INFO -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] Parameters: {"utf8"=>"✓", "authenticity_token"=>"5tG3tNSS3oQl8MG2gGLzq31cnV5hRD/j9WOPqg6RkMSkUYKISagvyyNwfWvVbLFROmwJP5N0HYba8i8wn7jTZw==", "problem"=>{"productid"=>"LPHA39363", "productname"=>"Component Sample", "detected_at(1i)"=>"2020", "detected_at(2i)"=>"2", "detected_at(3i)"=>"18", "description"=>"Copper Mark", "supplier"=>"G-shank", "lob"=>"Component", "status"=>"Open", "crno"=>"CR-2547236", "link"=>"https://se.lightning.force.com/lightning/r/ComplaintRequest__c/a8s1H000001B6MVQA0/view"}, "commit"=>"Submit"}
2020-02-18T15:59:00.497601+00:00 app[web.1]: D, [2020-02-18T15:59:00.497531 #8] DEBUG -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2020-02-18T15:59:00.501042+00:00 app[web.1]: D, [2020-02-18T15:59:00.500973 #8] DEBUG -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] (0.7ms) BEGIN
2020-02-18T15:59:00.504225+00:00 app[web.1]: D, [2020-02-18T15:59:00.504140 #8] DEBUG -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] Problem Create (1.3ms) INSERT INTO "problems" ("detected_at", "description", "lob", "status", "productid", "productname", "crno", "link", "supplier", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id" [["detected_at", "2020-02-18 00:00:00"], ["description", "Copper Mark"], ["lob", "Component"], ["status", "Open"], ["productid"], ["productname", "Component Sample"], ["user_id", 1], ["created_at", "2020-02-18 15:59:00.501748"], ["updated_at", "2020-02-18 15:59:00.501748"]]
2020-02-18T15:59:00.506423+00:00 app[web.1]: D, [2020-02-18T15:59:00.506353 #8] DEBUG -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] (1.9ms) COMMIT
2020-02-18T15:59:00.507014+00:00 app[web.1]: I, [2020-02-18T15:59:00.506941 #8] INFO -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] Redirected to https://seq6.herokuapp.com/
2020-02-18T15:59:00.507206+00:00 app[web.1]: I, [2020-02-18T15:59:00.507145 #8] INFO -- : [8bc54d4f-f5b1-4c44-b63c-a546c93271ed] Completed 302 Found in 13ms (ActiveRecord: 4.7ms)
2020-02-18T15:59:00.836106+00:00 heroku[router]: at=info method=GET path="/" host=seq6.herokuapp.com request_id=c81ebf94-fb17-4011-ad5d-f5fcac7c93d4 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=1ms service=41ms status=200 bytes=9589 protocol=https
2020-02-18T15:59:00.794159+00:00 app[web.1]: I, [2020-02-18T15:59:00.794024 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Started GET "/" for 58.220.95.42 at 2020-02-18 15:59:00 +0000
2020-02-18T15:59:00.795079+00:00 app[web.1]: I, [2020-02-18T15:59:00.795004 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Processing by StaticPagesController#home as HTML
2020-02-18T15:59:00.797695+00:00 app[web.1]: D, [2020-02-18T15:59:00.797618 #10] DEBUG -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2020-02-18T15:59:00.800775+00:00 app[web.1]: I, [2020-02-18T15:59:00.800688 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendering static_pages/home.html.erb within layouts/application
2020-02-18T15:59:00.804555+00:00 app[web.1]: D, [2020-02-18T15:59:00.804467 #10] DEBUG -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] (1.2ms) SELECT COUNT(*) FROM "problems" WHERE "problems"."user_id" = $1 [["user_id", 1]]
2020-02-18T15:59:00.804802+00:00 app[web.1]: I, [2020-02-18T15:59:00.804739 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered shared/_user_info.html.erb (3.0ms)
2020-02-18T15:59:00.807273+00:00 app[web.1]: I, [2020-02-18T15:59:00.807200 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered shared/_error_messages.html.erb (0.4ms)
2020-02-18T15:59:00.811456+00:00 app[web.1]: I, [2020-02-18T15:59:00.811385 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered shared/_problem_form.html.erb (6.2ms)
2020-02-18T15:59:00.814334+00:00 app[web.1]: D, [2020-02-18T15:59:00.814105 #10] DEBUG -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] (1.2ms) SELECT COUNT(*) FROM "problems" WHERE (user_id = 1)
2020-02-18T15:59:00.816098+00:00 app[web.1]: D, [2020-02-18T15:59:00.815984 #10] DEBUG -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Problem Load (1.1ms) SELECT "problems".* FROM "problems" WHERE (user_id = 1) ORDER BY "problems"."created_at" DESC LIMIT $1 OFFSET $2 [["LIMIT", 30], ["OFFSET", 0]]
2020-02-18T15:59:00.819255+00:00 app[web.1]: D, [2020-02-18T15:59:00.819166 #10] DEBUG -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2020-02-18T15:59:00.821142+00:00 app[web.1]: D, [2020-02-18T15:59:00.821053 #10] DEBUG -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2020-02-18T15:59:00.821977+00:00 app[web.1]: I, [2020-02-18T15:59:00.821895 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered collection of problems/_problem.html.erb [2 times] (4.8ms)
2020-02-18T15:59:00.822213+00:00 app[web.1]: I, [2020-02-18T15:59:00.822132 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered shared/_feed.html.erb (10.2ms)
2020-02-18T15:59:00.822378+00:00 app[web.1]: I, [2020-02-18T15:59:00.822311 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered static_pages/home.html.erb within layouts/application (21.5ms)
2020-02-18T15:59:00.823582+00:00 app[web.1]: I, [2020-02-18T15:59:00.823501 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered layouts/_shim.html.erb (0.1ms)
2020-02-18T15:59:00.824352+00:00 app[web.1]: I, [2020-02-18T15:59:00.824284 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered layouts/_header.html.erb (0.6ms)
2020-02-18T15:59:00.824597+00:00 app[web.1]: I, [2020-02-18T15:59:00.824536 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Rendered layouts/_footer.html.erb (0.1ms)
2020-02-18T15:59:00.824924+00:00 app[web.1]: I, [2020-02-18T15:59:00.824846 #10] INFO -- : [c81ebf94-fb17-4011-ad5d-f5fcac7c93d4] Completed 200 OK in 30ms (Views: 21.3ms | ActiveRecord: 4.4ms)
2020-02-18T15:59:01.469663+00:00 heroku[router]: at=info method=GET path="/assets/application-7b7f66883d7ab50ceac9557c180d2088a847d5408d58c39d179c789af310fafe.css" host=seq6.herokuapp.com request_id=b6e2d915-33a0-44fd-8647-0ef537273bd9 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=1ms service=5ms status=304 bytes=112 protocol=https
2020-02-18T15:59:01.787299+00:00 heroku[router]: at=info method=GET path="/assets/se-logo-white-91a31cc55317c3643962a790342733788eb02cf59f89e114157c6efd7042aab3.png" host=seq6.herokuapp.com request_id=e7797cc7-b4b5-420d-9e86-7282479b3582 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=1ms service=5ms status=304 bytes=112 protocol=https
2020-02-18T15:59:02.603285+00:00 heroku[router]: at=info method=GET path="/assets/application-d283aae496f2056cf7291fdec8f108d447106cf2e12c69faf064db254b4bcda1.js" host=seq6.herokuapp.com request_id=a6e56b91-ecea-440c-b8d4-5e76b84bc9b7 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=0ms service=2ms status=304 bytes=112 protocol=https
2020-02-18T15:59:02.935910+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=seq6.herokuapp.com request_id=30c2ce8a-4161-40af-b398-5518a6152ac0 fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=0ms service=1ms status=304 bytes=112 protocol=https
2020-02-18T15:59:18.240664+00:00 heroku[router]: at=info method=GET path="/problems" host=seq6.herokuapp.com request_id=01f5fad1-47af-4e1e-98e7-44e00ab719cc fwd="218.81.13.62,58.220.95.42" dyno=web.1 connect=0ms service=25ms status=500 bytes=1891 protocol=https
2020-02-18T15:59:18.215499+00:00 app[web.1]: I, [2020-02-18T15:59:18.215345 #8] INFO -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] Started GET "/problems" for 58.220.95.42 at 2020-02-18 15:59:18 +0000
2020-02-18T15:59:18.216635+00:00 app[web.1]: I, [2020-02-18T15:59:18.216555 #8] INFO -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] Processing by ProblemsController#index as HTML
2020-02-18T15:59:18.221539+00:00 app[web.1]: D, [2020-02-18T15:59:18.221363 #8] DEBUG -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2020-02-18T15:59:18.223733+00:00 app[web.1]: I, [2020-02-18T15:59:18.223669 #8] INFO -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] Rendering problems/index.html.erb within layouts/application
2020-02-18T15:59:18.225879+00:00 app[web.1]: D, [2020-02-18T15:59:18.225813 #8] DEBUG -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] (1.1ms) SELECT COUNT(*) FROM "problems"
2020-02-18T15:59:18.228447+00:00 app[web.1]: D, [2020-02-18T15:59:18.228281 #8] DEBUG -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] (1.6ms) SELECT COUNT(*) FROM "problems" WHERE "problems"."lob" = $1 [["lob", "BL"]]
2020-02-18T15:59:18.230207+00:00 app[web.1]: D, [2020-02-18T15:59:18.230119 #8] DEBUG -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] (1.0ms) SELECT COUNT(*) FROM "problems" WHERE "problems"."lob" = $1 [["lob", "Component"]]
2020-02-18T15:59:18.233321+00:00 app[web.1]: D, [2020-02-18T15:59:18.233233 #8] DEBUG -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] Problem Load (2.7ms) select * from problems where detected_at > date('now','start of year','-1 year') AND detected_at < date('now','start of year','1 second')
2020-02-18T15:59:18.234250+00:00 app[web.1]: I, [2020-02-18T15:59:18.234178 #8] INFO -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] Rendered problems/index.html.erb within layouts/application (10.4ms)
2020-02-18T15:59:18.234566+00:00 app[web.1]: I, [2020-02-18T15:59:18.234497 #8] INFO -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] Completed 500 Internal Server Error in 18ms (ActiveRecord: 7.4ms)
2020-02-18T15:59:18.235885+00:00 app[web.1]: F, [2020-02-18T15:59:18.235785 #8] FATAL -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc]
2020-02-18T15:59:18.236207+00:00 app[web.1]: F, [2020-02-18T15:59:18.236111 #8] FATAL -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] ActionView::Template::Error (PG::UndefinedFunction: ERROR: function date(unknown, unknown, unknown) does not exist
2020-02-18T15:59:18.236210+00:00 app[web.1]: LINE 1: select * from problems where detected_at > date('now','start...
2020-02-18T15:59:18.236211+00:00 app[web.1]: ^
2020-02-18T15:59:18.236212+00:00 app[web.1]: HINT: No function matches the given name and argument types. You might need to add explicit type casts.
2020-02-18T15:59:18.236213+00:00 app[web.1]: : select * from problems where detected_at > date('now','start of year','-1 year') AND detected_at < date('now','start of year','1 second')):
2020-02-18T15:59:18.236599+00:00 app[web.1]: F, [2020-02-18T15:59:18.236531 #8] FATAL -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] 20: <!--去年一年内产生问题数量及细分-->
2020-02-18T15:59:18.236600+00:00 app[web.1]: [01f5fad1-47af-4e1e-98e7-44e00ab719cc] 21: <tr>
2020-02-18T15:59:18.236600+00:00 app[web.1]: [01f5fad1-47af-4e1e-98e7-44e00ab719cc] 22: <th width=80px>Last Year</th>
2020-02-18T15:59:18.236601+00:00 app[web.1]: [01f5fad1-47af-4e1e-98e7-44e00ab719cc] 23: <td width=80px><%= @problems.find_by_sql("select * from problems where detected_at > date('now','start of year','-1 year') AND detected_at < date('now','start of year','1 second')").count %></td>
2020-02-18T15:59:18.236601+00:00 app[web.1]: [01f5fad1-47af-4e1e-98e7-44e00ab719cc] 24: <td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'BL' AND detected_at > date('now','start of year','-1 year') AND detected_at < date('now','start of year','1 second')").count %></td>
2020-02-18T15:59:18.236602+00:00 app[web.1]: [01f5fad1-47af-4e1e-98e7-44e00ab719cc] 25: <td width=80px><%= @problems.find_by_sql("select * from problems where lob = 'Component' AND detected_at > date('now','start of year','-1 year') AND detected_at < date('now','start of year','1 second')").count %></td>
2020-02-18T15:59:18.236602+00:00 app[web.1]: [01f5fad1-47af-4e1e-98e7-44e00ab719cc] 26: </tr>
2020-02-18T15:59:18.236701+00:00 app[web.1]: F, [2020-02-18T15:59:18.236639 #8] FATAL -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc]
2020-02-18T15:59:18.236808+00:00 app[web.1]: F, [2020-02-18T15:59:18.236746 #8] FATAL -- : [01f5fad1-47af-4e1e-98e7-44e00ab719cc] app/views/problems/index.html.erb:23:in `_app_views_problems_index_html_erb___932626950221506039_47343375589820'
2020-02-18T16:36:04.469330+00:00 heroku[web.1]: Idling
2020-02-18T16:36:04.473752+00:00 heroku[web.1]: State changed from up to down
2020-02-18T16:36:05.388424+00:00 app[web.1]: [4] - Gracefully shutting down workers...
2020-02-18T16:36:05.375947+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-02-18T16:36:05.491257+00:00 heroku[web.1]: Process exited with status 143