我杀了我的项目BD,但明天我需要它

时间:2014-03-14 02:09:55

标签: ruby-on-rails sqlite github

我几分钟前完成了我的项目。我做了一个提交,之后我想清除DB因为有很多测试记录。所以我在DBconsole

中运行了这个
sqlite> delete from users where id;
sqlite> delete from users where id=1;
sqlite> delete from posts where id=1;
sqlite> delete from votes where id=1;

在此之后我的项目不起作用((。它返回:

  

我们很抱歉,但出了点问题。

如果您是应用程序所有者,请检查日志以获取更多信息。 在每一页,甚至静态!!!!

明天我需要我的项目。我从Git恢复,但错误并没有消失。

我的日志看起来像这样:

    Started GET "/" for 127.0.0.1 at 2014-03-14 04:08:40 +0200
Processing by PostsController#index as HTML
   (0.4ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."statut" = 1
   (0.3ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."statut" = 2
   (0.4ms)  SELECT COUNT(*) FROM "posts" WHERE ("posts"."statut" BETWEEN 3 AND 4)
  Post Load (0.7ms)  SELECT "posts".* FROM "posts" WHERE "posts"."statut" = 1 ORDER BY created_at DESC LIMIT 10
  Post Load (0.6ms)  SELECT "posts".* FROM "posts" WHERE "posts"."statut" = 2 ORDER BY created_at DESC LIMIT 10
  Post Load (0.5ms)  SELECT "posts".* FROM "posts" WHERE ("posts"."statut" BETWEEN 3 AND 4) ORDER BY created_at DESC LIMIT 10
  Rendered posts/index.html.erb within layouts/application (23.5ms)
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."statut" = 1
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."statut" = 2
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE ("posts"."statut" BETWEEN 3 AND 4)
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."statut" = 1
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."statut" = 2
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE ("posts"."statut" BETWEEN 3 AND 4)
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."statut" = 1
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."statut" = 2
  CACHE (0.0ms)  SELECT COUNT(*) FROM "posts" WHERE ("posts"."statut" BETWEEN 3 AND 4)
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", 8]]
Completed 500 Internal Server Error in 74ms

这是主页面。帮我!!我可以给你一个混蛋,我需要修理它。

1 个答案:

答案 0 :(得分:0)

您使用此声明删除了所有用户。

delete from users where id;

所以日志中的行

User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", 8]]

无法加载ID为8的用户,因为该表为空。也许您需要添加一个对您的程序起作用至关重要的用户。