<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>takamizawa46</author_name>
  <author_url>https://blog.hatena.ne.jp/takamizawa46/</author_url>
  <blog_title>やわらかテック</blog_title>
  <blog_url>https://www.okb-shelf.work/</blog_url>
  <categories>
    <anon>JavaScript</anon>
  </categories>
  <description>業務でsequelizeというNode.js製のORMマッパーを触る機会がありました。 単体テストを実行する度に、データベース(MySQL)のテーブルをクリア(全削除)するために制約を無視してTRUNCATEを全テーブルに対して実行したいのですがsequelizeでは対応するメソッドは提供されていませんでした。 // 外部キー制約のあるデータが存在しているとエラーになる await sequelize.truncate({ cascade: true, restartIdentity: true }); // テーブルに対応するモデル1つずつに対して実行する必要がある await User.d…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.okb-shelf.work%2Fentry%2Ftruncate_all_table&quot; title=&quot;sequelizeで全テーブルに対してTRUNCATEを実行する - やわらかテック&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/t/takamizawa46/20231112/20231112222154.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2023-11-17 17:02:53</published>
  <title>sequelizeで全テーブルに対してTRUNCATEを実行する</title>
  <type>rich</type>
  <url>https://www.okb-shelf.work/entry/truncate_all_table</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
