Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Mark as Deleted for Backend Api #1144

Merged
merged 9 commits into from Sep 22, 2019

Conversation

duduribeiro
Copy link
Contributor

@duduribeiro duduribeiro commented Sep 2, 2019

What this PR does / why we need it:
This commit changed the behave of the destroy action from the
Backend API controller to make it delete the object in background.

Which issue(s) this PR fixes

THREESCALE-3343

@duduribeiro duduribeiro self-assigned this Sep 2, 2019
@duduribeiro duduribeiro force-pushed the implement_mark_as_deleted_for_backend_apis branch from ed36f41 to 9a59922 Compare September 2, 2019 21:38
@hallelujah
Copy link
Contributor

So I am thinking of not really use any other column but only do it when the service is not a product

@hallelujah
Copy link
Contributor

I do not think this column is needed at all,
If the only service tied to it is an old service

@duduribeiro duduribeiro force-pushed the implement_mark_as_deleted_for_backend_apis branch from 9a59922 to b3cb4cf Compare September 3, 2019 18:14
@duduribeiro duduribeiro marked this pull request as ready for review September 3, 2019 18:19
@duduribeiro duduribeiro requested a review from a team September 3, 2019 18:19
@Martouta Martouta added the Priority: Blocker This PR is a blocker. Everyone should review and help to close it ASAP. label Sep 4, 2019
@hallelujah
Copy link
Contributor

So decision is to use the mark as deleted because of the points that @Martouta issued.
Those are really valid, and we should just follow what we have in Service

@duduribeiro duduribeiro force-pushed the implement_mark_as_deleted_for_backend_apis branch from b3cb4cf to 2173fdc Compare September 4, 2019 15:38
@codecov
Copy link

codecov bot commented Sep 4, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@4c3d753). Click here to learn what that means.
The diff coverage is 52.63%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1144   +/-   ##
=========================================
  Coverage          ?   67.65%           
=========================================
  Files             ?     1590           
  Lines             ?    43312           
  Branches          ?        0           
=========================================
  Hits              ?    29301           
  Misses            ?    14011           
  Partials          ?        0
Impacted Files Coverage Δ
...ers/provider/admin/backend_apis/base_controller.rb 85.71% <0%> (ø)
...trollers/provider/admin/backend_apis_controller.rb 47.5% <0%> (ø)
...p/controllers/admin/api/backend_apis_controller.rb 61.29% <0%> (ø)
...llers/admin/api/backend_apis/metrics_controller.rb 60% <0%> (ø)
app/models/backend_api.rb 91.66% <90.9%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c3d753...315ca82. Read the comment docs.

@duduribeiro duduribeiro force-pushed the implement_mark_as_deleted_for_backend_apis branch from 2173fdc to ec5d8f1 Compare September 4, 2019 17:34
@Martouta Martouta self-requested a review September 5, 2019 08:12
Martouta
Martouta previously approved these changes Sep 5, 2019
Copy link
Contributor

@Martouta Martouta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 🥇 🚀

@hallelujah hallelujah changed the title Implement Mark as Deleted for Backend Api [DO NOT MERGE]Implement Mark as Deleted for Backend Api Sep 5, 2019
@Martouta Martouta requested a review from a team September 5, 2019 08:21
@Martouta Martouta added the on hold Waiting for or blocked by something else. label Sep 5, 2019
@duduribeiro duduribeiro force-pushed the implement_mark_as_deleted_for_backend_apis branch from ec5d8f1 to 7c0f080 Compare September 5, 2019 13:28
@duduribeiro duduribeiro force-pushed the implement_mark_as_deleted_for_backend_apis branch from 7c0f080 to 0b0eb50 Compare September 5, 2019 19:29
Martouta
Martouta previously approved these changes Sep 5, 2019
@Martouta Martouta added the Priority: Blocker This PR is a blocker. Everyone should review and help to close it ASAP. label Sep 20, 2019
@Martouta Martouta force-pushed the implement_mark_as_deleted_for_backend_apis branch 2 times, most recently from 315ca82 to 87b4dec Compare September 21, 2019 11:39
disable_ddl_transaction! if System::Database.postgres?

def change
add_column :backend_apis, :state, :string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a default here I think. On SaaS:

irb(main):001:0> BackendApi.count
=> 37183

It will be blocking but reasonably, and in fact it might not block at all, there are very few requests that modifies the private_endpoint

class BackfillStateForBackendApis < ActiveRecord::Migration
disable_ddl_transaction!

def change
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extract it to a rake task so we can do it after migration from 2.6 to 2.7

@@ -16,6 +17,7 @@ class BackendApi < ApplicationRecord
delegate :default_api_backend, to: :class

validates :name, length: { maximum: 511 }, presence: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I was wondering

Why do we have 511 characters here????

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hahahahaha good question 😂 i will check 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t.string "name", limit: 511, null: false

c2204dc#diff-e2de550cd7105b0cc383c49f401ca88dR6

@Martouta Martouta changed the title Implement Mark as Deleted for Backend Api [WIP] Implement Mark as Deleted for Backend Api Sep 21, 2019
@Martouta Martouta force-pushed the implement_mark_as_deleted_for_backend_apis branch 2 times, most recently from 805b0e7 to 35af93a Compare September 21, 2019 14:52
@Martouta Martouta changed the title [WIP] Implement Mark as Deleted for Backend Api Implement Mark as Deleted for Backend Api Sep 21, 2019
@Martouta Martouta requested review from a team and hallelujah September 21, 2019 15:28
@Martouta Martouta force-pushed the implement_mark_as_deleted_for_backend_apis branch from e4f1b30 to cbe0c84 Compare September 21, 2019 16:01
@Martouta Martouta force-pushed the implement_mark_as_deleted_for_backend_apis branch from cbe0c84 to c98f764 Compare September 21, 2019 16:35
@Martouta Martouta added Priority: High Closes a JIRA issue in our sprint and removed Priority: Blocker This PR is a blocker. Everyone should review and help to close it ASAP. labels Sep 22, 2019
disable_ddl_transaction! if System::Database.postgres?

def change
safety_assured { add_column :backend_apis, :state, :string, default: :published, null: false }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fill up the DB 😉

@Martouta Martouta merged commit f02c25a into master Sep 22, 2019
@Martouta Martouta deleted the implement_mark_as_deleted_for_backend_apis branch September 22, 2019 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIAP Priority: High Closes a JIRA issue in our sprint
Projects
None yet
3 participants