論理削除と、そこでのElasticsearch活用 | 論理削除 Casual Talks #1 / soft_delete

B4af310b9addde33ca707737adfc50ab?s=47 misoobu
August 31, 2015
15k

論理削除と、そこでのElasticsearch活用 | 論理削除 Casual Talks #1 / soft_delete

イベント: 論理削除 Casual Talks #1 : ATND https://atnd.org/events/68902
発表者: https://twitter.com/misoobu

B4af310b9addde33ca707737adfc50ab?s=128

misoobu

August 31, 2015
Tweet

Transcript

  1. 8.

    ࡟আϑϥάྫ user_comments id: int user_id: int comment: text deleted_at: datetime

    ࢀর SELECT * FROM user_comments WHERE user_id = 1 AND deleted_at IS NULL; ࡟আ UPDATE user_comments SET deleted_at = NOW() WHERE id = 1;
  2. 13.
  3. 14.

    ࡟আςʔϒϧྫ ΧʔυΛച٫͢Δ user_cards id: int user_id: int card_id: int level:

    int user_card_sale_histories id: int user_id: int card_id: int level: int money: int sold_at: datetime %&-&5& */4&35
  4. 21.

    &4ʹϩάΛೖΕΔ ࡟আͨ͠σʔλΛ&4ʹೖΕΔ { "user_comment_deleted_log": { "properties": { "user_id": { "type":

    "integer" }, "comment": { "type": "string" }, “deleted_at": { "type": "date" } } } } user_comments id: int user_id: int comment: text %&-&5& */4&35
  5. 22.

    &4Ͱͷσʔλઃܭ { "app_log_20150831": { "mappings": { "user_comment_deleted_log": { "properties": {

    "user_id": { "type": "integer" }, "comment": { "type": "string" }, "deleted_at": { "type": "date" } } } } } } index RDBͷσʔλϕʔεΈͨ ͍ͳ΍ͭɻ ೔୯ҐͰindex͢Δɻ type RDBͷςʔϒϧ Έ͍ͨͳ΍ͭɻ छྨͰtypeΛ෼͚Δɻ JOEFYͱUZQFʢͱVTFS@JEʣΛࢦఆͯ͠ɺϩάΛऔΓग़͢ field RDBͷΧϥϜΈ͍ͨͳ ΍ͭɻ