Skip to content
Snippets Groups Projects
Commit 1fc9953c authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Destroy all related todos when removing a project

parent 2db00dd5
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -16,6 +16,9 @@ v 8.6.0 (unreleased)
- Increase the notes polling timeout over time (Roberto Dip)
- Show labels in dashboard and group milestone views
 
v 8.5.5
- Fix: Destroy all related todos when removing a project
v 8.5.4
- Do not cache requests for badges (including builds badge)
 
Loading
Loading
Loading
Loading
@@ -151,6 +151,7 @@ class Project < ActiveRecord::Base
has_many :releases, dependent: :destroy
has_many :lfs_objects_projects, dependent: :destroy
has_many :lfs_objects, through: :lfs_objects_projects
has_many :todos, dependent: :destroy
 
has_one :import_data, dependent: :destroy, class_name: "ProjectImportData"
 
Loading
Loading
class FixTodos < ActiveRecord::Migration
def up
execute <<-SQL
DELETE FROM todos
WHERE NOT EXISTS (
SELECT *
FROM projects
WHERE projects.id = todos.id
)
SQL
end
def down
end
end
Loading
Loading
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
 
ActiveRecord::Schema.define(version: 20160222153918) do
ActiveRecord::Schema.define(version: 20160308040034) do
 
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Loading
Loading
Loading
Loading
@@ -68,6 +68,7 @@ describe Project, models: true do
it { is_expected.to have_many(:runners) }
it { is_expected.to have_many(:variables) }
it { is_expected.to have_many(:triggers) }
it { is_expected.to have_many(:todos).dependent(:destroy) }
end
 
describe 'modules' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment