deezus blog

.Net Core、Typescriptを中心に技術的ノウハウを公開しています

dacでWordPressのDBをextractしてみる

dacを使えばデータベース構造をyamlにすることができます
インストール直後の状態でextractすると以下のようになりました

tables:
  wp_commentmeta:
    columns:
      meta_id:
        id: true
      comment_id:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      meta_key:
        type: varchar
        length: 255
      meta_value:
        type: longtext
    indexes:
      comment_id:
        columns:
          comment_id: asc
      meta_key:
        columns:
          meta_key: asc
  wp_comments:
    columns:
      comment_ID:
        id: true
      comment_post_ID:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      comment_author:
        type: tinytext
        notNull: true
      comment_author_email:
        type: varchar
        length: 100
        notNull: true
      comment_author_url:
        type: varchar
        length: 200
        notNull: true
      comment_author_IP:
        type: varchar
        length: 100
        notNull: true
      comment_date:
        type: datetime
        notNull: true
        default: '0000-00-00 00:00:00'
      comment_date_gmt:
        type: datetime
        notNull: true
        default: '0000-00-00 00:00:00'
      comment_content:
        type: text
        notNull: true
      comment_karma:
        type: int
        notNull: true
        default: '0'
      comment_approved:
        type: varchar
        length: 20
        notNull: true
        default: '1'
      comment_agent:
        type: varchar
        length: 255
        notNull: true
      comment_type:
        type: varchar
        length: 20
        notNull: true
      comment_parent:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      user_id:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
    indexes:
      comment_post_ID:
        columns:
          comment_post_ID: asc
      comment_approved_date_gmt:
        columns:
          comment_approved: asc
          comment_date_gmt: asc
      comment_date_gmt:
        columns:
          comment_date_gmt: asc
      comment_parent:
        columns:
          comment_parent: asc
      comment_author_email:
        columns:
          comment_author_email: asc
  wp_links:
    columns:
      link_id:
        id: true
      link_url:
        type: varchar
        length: 255
        notNull: true
      link_name:
        type: varchar
        length: 255
        notNull: true
      link_image:
        type: varchar
        length: 255
        notNull: true
      link_target:
        type: varchar
        length: 25
        notNull: true
      link_description:
        type: varchar
        length: 255
        notNull: true
      link_visible:
        type: varchar
        length: 20
        notNull: true
        default: 'Y'
      link_owner:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '1'
      link_rating:
        type: int
        notNull: true
        default: '0'
      link_updated:
        type: datetime
        notNull: true
        default: '0000-00-00 00:00:00'
      link_rel:
        type: varchar
        length: 255
        notNull: true
      link_notes:
        type: mediumtext
        notNull: true
      link_rss:
        type: varchar
        length: 255
        notNull: true
    indexes:
      link_visible:
        columns:
          link_visible: asc
  wp_options:
    columns:
      option_id:
        id: true
      option_name:
        type: varchar
        length: 191
        notNull: true
      option_value:
        type: longtext
        notNull: true
      autoload:
        type: varchar
        length: 20
        notNull: true
        default: 'yes'
    indexes:
      option_name:
        unique: true
        columns:
          option_name: asc
  wp_postmeta:
    columns:
      meta_id:
        id: true
      post_id:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      meta_key:
        type: varchar
        length: 255
      meta_value:
        type: longtext
    indexes:
      post_id:
        columns:
          post_id: asc
      meta_key:
        columns:
          meta_key: asc
  wp_posts:
    columns:
      ID:
        id: true
      post_author:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      post_date:
        type: datetime
        notNull: true
        default: '0000-00-00 00:00:00'
      post_date_gmt:
        type: datetime
        notNull: true
        default: '0000-00-00 00:00:00'
      post_content:
        type: longtext
        notNull: true
      post_title:
        type: text
        notNull: true
      post_excerpt:
        type: text
        notNull: true
      post_status:
        type: varchar
        length: 20
        notNull: true
        default: publish
      comment_status:
        type: varchar
        length: 20
        notNull: true
        default: open
      ping_status:
        type: varchar
        length: 20
        notNull: true
        default: open
      post_password:
        type: varchar
        length: 255
        notNull: true
      post_name:
        type: varchar
        length: 200
        notNull: true
      to_ping:
        type: text
        notNull: true
      pinged:
        type: text
        notNull: true
      post_modified:
        type: datetime
        notNull: true
        default: '0000-00-00 00:00:00'
      post_modified_gmt:
        type: datetime
        notNull: true
        default: '0000-00-00 00:00:00'
      post_content_filtered:
        type: longtext
        notNull: true
      post_parent:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      guid:
        type: varchar
        length: 255
        notNull: true
      menu_order:
        type: int
        notNull: true
        default: '0'
      post_type:
        type: varchar
        length: 20
        notNull: true
        default: post
      post_mime_type:
        type: varchar
        length: 100
        notNull: true
      comment_count:
        type: bigint
        length: 20
        notNull: true
        default: '0'
    indexes:
      post_name:
        columns:
          post_name: asc
      type_status_date:
        columns:
          post_type: asc
          post_status: asc
          post_date: asc
          ID: asc
      post_parent:
        columns:
          post_parent: asc
      post_author:
        columns:
          post_author: asc
  wp_term_relationships:
    columns:
      object_id:
        type: bigint unsigned
        length: 20
        pk: true
        notNull: true
        default: '0'
      term_taxonomy_id:
        type: bigint unsigned
        length: 20
        pk: true
        notNull: true
        default: '0'
      term_order:
        type: int
        notNull: true
        default: '0'
    indexes:
      term_taxonomy_id:
        columns:
          term_taxonomy_id: asc
  wp_term_taxonomy:
    columns:
      term_taxonomy_id:
        id: true
      term_id:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      taxonomy:
        type: varchar
        length: 32
        notNull: true
      description:
        type: longtext
        notNull: true
      parent:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      count:
        type: bigint
        length: 20
        notNull: true
        default: '0'
    indexes:
      term_id_taxonomy:
        unique: true
        columns:
          term_id: asc
          taxonomy: asc
      taxonomy:
        columns:
          taxonomy: asc
  wp_termmeta:
    columns:
      meta_id:
        id: true
      term_id:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      meta_key:
        type: varchar
        length: 255
      meta_value:
        type: longtext
    indexes:
      term_id:
        columns:
          term_id: asc
      meta_key:
        columns:
          meta_key: asc
  wp_terms:
    columns:
      term_id:
        id: true
      name:
        type: varchar
        length: 200
        notNull: true
      slug:
        type: varchar
        length: 200
        notNull: true
      term_group:
        type: bigint
        length: 10
        notNull: true
        default: '0'
    indexes:
      slug:
        columns:
          slug: asc
      name:
        columns:
          name: asc
  wp_usermeta:
    columns:
      umeta_id:
        id: true
      user_id:
        type: bigint unsigned
        length: 20
        notNull: true
        default: '0'
      meta_key:
        type: varchar
        length: 255
      meta_value:
        type: longtext
    indexes:
      user_id:
        columns:
          user_id: asc
      meta_key:
        columns:
          meta_key: asc
  wp_users:
    columns:
      ID:
        id: true
      user_login:
        type: varchar
        length: 60
        notNull: true
      user_pass:
        type: varchar
        length: 255
        notNull: true
      user_nicename:
        type: varchar
        length: 50
        notNull: true
      user_email:
        type: varchar
        length: 100
        notNull: true
      user_url:
        type: varchar
        length: 100
        notNull: true
      user_registered:
        type: datetime
        notNull: true
        default: '0000-00-00 00:00:00'
      user_activation_key:
        type: varchar
        length: 255
        notNull: true
      user_status:
        type: int
        notNull: true
        default: '0'
      display_name:
        type: varchar
        length: 250
        notNull: true
    indexes:
      user_login_key:
        columns:
          user_login: asc
      user_nicename:
        columns:
          user_nicename: asc
      user_email:
        columns:
          user_email: asc