Khi tôi chạyPG :: DependentObjectsStillExist: ERROR khi sử dụng rspec
$rspec "/any_file"
tải rspec trong file schema.rb để thiết lập cơ sở dữ liệu.
hiểu biết của tôi là khi nói đến dòng này
create_table "queue_classic_jobs", force: true do |t|; end
RSpec chạy một lệnh
DROP TABLE "queue_classic_jobs"
.
Nó trows lỗi này
PG::DependentObjectsStillExist: ERROR: cannot drop table queue_classic_jobs because
other objects depend on it (ActiveRecord::StatementInvalid)
DETAIL: function lock_head(character varying) depends on type queue_classic_jobs
function lock_head(character varying,integer) depends on type queue_classic_jobs
HINT: Use DROP ... CASCADE to drop the dependent objects too.
: DROP TABLE "queue_classic_jobs"
Có vẻ với tôi như tôi phải làm rspec
DROP TABLE "queue_classic_jobs" CASCADE
Nhưng làm thế nào?
giải pháp có thể xảy ra: trong đường ray giao diện điều khiển chạy: 'ActiveRecord :: Base.connection.execute (DROP TABLE "queue_classic_jobs" ' CASCADE ') '. Điều này loại bỏ các đối tượng phụ thuộc vào bảng. –