Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
EC-CUBE3のデータベース構造のお話
Search
amidaike
November 05, 2015
Programming
1
560
EC-CUBE3のデータベース構造のお話
amidaike
November 05, 2015
Tweet
Share
More Decks by amidaike
See All by amidaike
EC-CUBE3勉強会新しいデザインを作成してみよう
amidaike
0
450
EC-CUBE 3.0勉強会
amidaike
1
900
EC-CUBE3プラグイン勉強会
amidaike
0
460
EC-CUBE3デザイナー向け勉強会 #4
amidaike
0
300
EC-CUBE3コードリーディング #5
amidaike
1
1.5k
EC-CUBE3デザイナー向け勉強会 #1
amidaike
0
280
EC-CUBE3デザイナー向け勉強会 #3
amidaike
1
210
EC-CUBE3コードリーディング #4
amidaike
0
1.3k
EC-CUBE3デザイナー向け勉強会 #2
amidaike
1
2.7k
Other Decks in Programming
See All in Programming
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
210
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Remix on Hono on Cloudflare Workers
yusukebe
1
290
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
Jakarta EE meets AI
ivargrimstad
0
160
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
8.9k
The Cult of Friendly URLs
andyhume
78
6k
Embracing the Ebb and Flow
colly
84
4.5k
A better future with KSS
kneath
238
17k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Thoughts on Productivity
jonyablonski
67
4.3k
GitHub's CSS Performance
jonrohan
1030
460k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
A Tale of Four Properties
chriscoyier
156
23k
Transcript
EC-CUBE3ͷ σʔλϕʔεߏͷ͓ EC-CUBEؔϢʔβάϧʔϓ 2015-11-04
ࣗݾհ גࣜձࣾΩϡʔϧ ɹࢁଜ ਗ਼࢙ γεςϜΤϯδχΞ EC-CUBE3ͷίϛολʔ(@k-yamamura) ͯ͠·͢
αϚϦʔ 1.৽͘͠ͳͬͨDBεΩʔϚ 2.EC-CUBE3ʹͳΓআ͞Εͨςʔϒϧ 3.PostgreSQLͱMySQLͲͪΒΛ͑ྑ͍ͷ? 4.EC-CUBE3Ξοϓσʔτ࣌ͷDB·ΘΓͷҙ 5.QAͳͲ
1.৽͘͠ͳͬͨDBεΩʔϚ
৽͘͠ͳͬͨDBεΩʔϚ • EC-CUBE2͔ΒEC-CUBE3ͷDBεΩʔϚͷݟ͠ʹ͋ͨΓORMͰѻ͍ ͍͢ܗࣜʹมߋ • EC-CUBE2͔ΒҎԼͷ༰Λݟ͠(v2.13Λର) ςʔϒϧ໊໋໊نΛఆΊͯमਖ਼Λ࣮ࢪ ར༻͍ͯ͠ͳ͍ςʔϒϧ/ΧϥϜͷআ ֎෦ΩʔͷՃ ϓϥάΠϯͰར༻͢Δςʔϒϧຊମ͔Β
• ෳ߹ओΩʔར༻ͤͣɺαϩήʔτΩʔΛར༻(ଟରଟআ͘) • ͨͩ͠ɺEC-CUBE2ܥͷΧϥϜ໊শɺσʔλܕݪଇมߋ͠ͳ͍
৽͘͠ͳͬͨDBεΩʔϚ • ໋໊نͷϧʔϧ ল໊ུশͷഇࢭ : dtb_deliv → dtb_delivery ୯ܗʹมߋ :
dtb_products → dtb_product εωʔΫέʔεͰ໋໊ : dtb_class_category • ςʔϒϧʹछผʹΑΓϓϨϑΟΫεΛ͚ͭΔ Ϛελςʔϒϧ : mtb_hogehoge σʔλςʔϒϧ : dtb_hogehoge ϓϥάΠϯؔ࿈ : plg_hogehoge
৽͘͠ͳͬͨDBεΩʔϚ • ֎෦ΩʔͷՃ dtb_productɹɹdtb_product_class • ϓϥάΠϯ͔Βຊମͷඪ४ςʔϒϧʹରͯ͠Χελ ϚΠζඇਪ όʔδϣϯΞοϓ͕ࠔɺଞͷϓϥάΠϯͱͷڝ߹ • ෳ߹ओΩʔͰͳ͘αϩήʔτΩʔΛར༻
ORMͰѻ͍͘͢͢ΔͨΊαϩήʔτΩʔΛར༻
৽͘͠ͳͬͨDBεΩʔϚ • 3ܥͷERਤҎԼͷURLΛࢀর https://github.com/EC-CUBE/eccube3-doc/tree/ master/ER-D • 2ܥͷERਤ(όʔδϣϯݹ͍Ͱ͕͢)ҎԼͷ URLͷPDFϑΝΠϧΛࢀর https://github.com/EC-CUBE/eccube3-doc →ςʔϒϧఆٛॻҰԠ࠷৽
৽͘͠ͳͬͨDBεΩʔϚ • EC-CUBE2Ͱͷؔ࿈ใ
৽͘͠ͳͬͨDBεΩʔϚ • EC-CUBE3Ͱͷؔ࿈ใ
৽͘͠ͳͬͨDBεΩʔϚ • EC-CUBE2Ͱͷडؔ࿈ใ
৽͘͠ͳͬͨDBεΩʔϚ • EC-CUBE3Ͱͷडؔ࿈ใ
৽͘͠ͳͬͨDBεΩʔϚ • EC-CUBE2Ͱͷސ٬ؔ࿈ใ
৽͘͠ͳͬͨDBεΩʔϚ • EC-CUBE3Ͱͷސ٬ؔ࿈ใ
2.EC-CUBE3ʹͳΓআ͞Εͨ ςʔϒϧ
EC-CUBE3ʹͳΓআ͞Εͨςʔϒϧ • EC-CUBE3όʔδϣϯΞοϓ͢Δʹ͋ͨΓػ ೳͷݟ͕͠ߦΘΕͨͨΊɺςʔϒϧෆཁ ͱͳΓআ • 3ܥͰ৽ͨʹ৽ن࡞͞Εͨςʔϒϧଘࡏ͢ Δ͕ɺػೳͷݟ͠ʹΑΓ৽ن࡞͞Εͨςʔ ϒϧ͕ຆͲͰ͋Γ2ܥ͔Βಛʹมߋͳ͠
3ܥͰআ͞Εͨςʔϒϧ
3ܥͰআ͞Εͨςʔϒϧ ςʔϒϧ໊ ཧςʔϒϧ໊ dtb_api_account APIΞΧϯτ dtb_api_config APIઃఆ dtb_best_products ͓͢͢Ίใ dtb_bkup
όοΫΞοϓ dtb_class ن֨ใ(dtb_class_name໊শมߋ) dtb_csv_sql CSVৄࡉઃఆSQLใ dtb_holiday ٳใ dtb_index_list ΠϯσοΫεҰཡ dtb_kiyaku نใ(dtb_help໊শมߋ) dtb_mailmaga_template ϝϧϚΨςϯϓϨʔτใ
3ܥͰআ͞Εͨςʔϒϧ ςʔϒϧ໊ ཧςʔϒϧ໊ dtb_maker ϝʔΧʔ dtb_maker_count ϝʔΧʔΧϯτ dtb_mobile_ext_session_id ϞόΠϧηογϣϯใ dtb_module
Ϟδϡʔϧใ dtb_module_update_logs Ϟδϡʔϧߋ৽ϩάใ dtb_order_temp डҰ࣌ใ dtb_other_deliv ͦͷଞͷૹઌใ (dtb_customer_address໊শมߋ) dtb_ownersstore_settings ΦʔφʔζετΞઃఆ dtb_plugin_hookpoint ϓϥάΠϯϑοΫϙΠϯτ
3ܥͰআ͞Εͨςʔϒϧ ςʔϒϧ໊ ཧςʔϒϧ໊ dtb_product_status εςʔλεใ dtb_recommend_products ؔ࿈ใ dtb_review ϨϏϡʔใ dtb_send_customer
ސ٬ϝʔϧૹ৴ཤྺ dtb_send_history ϝʔϧૹ৴ཤྺ dtb_update Ϟδϡʔϧߋ৽ใ mtb_allowed_tag ڐՄλά mtb_auth_excludes ཧը໘ೝূআ֎ mtb_constants ఆϚελ
3ܥͰআ͞Εͨςʔϒϧ ςʔϒϧ໊ ཧςʔϒϧ໊ mtb_delivery_date ൃૹ(dtb_delivery_dateʹมߋ) mtb_disable_logout ϩάΞτແޮϖʔδ mtb_magazine_type ϝϧϚΨछผ mtb_mail_magazine_type
ϝʔϧϚΨδϯछผ mtb_mail_template ϝʔϧςϯϓϨʔτ mtb_mail_tpl_path ϝʔϧςϯϓϨʔτύε mtb_mail_type ϝʔϧछผ mtb_mobile_domain ϞόΠϧυϝΠϯ໊ mtb_ownersstoer_err ΦʔφʔζετΞΤϥʔछผ
3ܥͰআ͞Εͨςʔϒϧ ςʔϒϧ໊ ཧςʔϒϧ໊ mtb_permission ཧը໘ΞΫηεݖݶ mtb_product_status_color εςʔλε৭ mtb_recommend ͓͢͢ΊϨϕϧ mtb_reminder
ύεϫʔυ࣭Ϛελ mtb_review_deny_url ϨϏϡʔڋ൱URL mtb_status εςʔλε mtb_status_image εςʔλεը૾ mtb_target ϒϩοΫλʔήοτ mtb_wday ༵
3ܥͰ৽ن࡞͞Εͨςʔϒϧ
3ܥͰ৽ن࡞͞Εͨςʔϒϧ ςʔϒϧ໊ ཧςʔϒϧ໊ dtb_plugin_event_handler ϓϥάΠϯΠϕϯτϋϯυϥʔ༻ dtb_product_image ը૾ dtb_product_stock ࡏݿใ dtb_product_tag
λά mtb_csv_type CSVग़ྗใ mtb_product_list_order_by ฒͼସ͑ใ mtb_tag λά
2ܥͱ3ܥͷςʔϒϧରൺ
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ dtb_api_account APIΞΧϯτ × dtb_api_config APIઃఆ ×
dtb_baseinfo ళجຊใ dtb_base_info dtb_best_products ͓͢͢Ίใ × dtb_bkup όοΫΞοϓ × dtb_bloc ϒϩοΫใ dtb_block dtb_blocposition ϒϩοΫهࣄใ dtb_block_position dtb_category ΧςΰϦใ dtb_category dtb_category_count ΧςΰϦใ dtb_category_count
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ dtb_category_total_count ΧςΰϦ߹ܭใ dtb_category_total_count dtb_class ن֨ใ dtb_class_name
dtb_classcategory ن֨ྨใ dtb_class_category dtb_csv CSVใ dtb_csv dtb_csv_sql CSVৄࡉઃఆSQLใ × dtb_customer ސ٬ใ dtb_customer dtb_customer_favorite_pro ducts ͓ؾʹೖΓใ dtb_customer_favorite_pro duct dtb_deliv ૹۀऀใ dtb_delivery dtb_delivfee ૹྉใ dtb_delivery_fee
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ dtb_delivtime ૹ࣌ؒใ dtb_delivery_time dtb_holiday ٳใ ×
dtb_index_list ΠϯσοΫεҰཡ × dtb_kiyaku نใ dtb_help dtb_mail_history डϝʔϧૹ৴ཤྺ dtb_mail_history dtb_mailmaga_template ϝϧϚΨςϯϓϨʔτ ใ × dtb_mailtemplate ϝʔϧςϯϓϨʔτใ dtb_mail_template dtb_maker ϝʔΧʔ × dtb_maker_count ϝʔΧʔΧϯτ ×
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ dtb_member ཧऀใ dtb_member dtb_mobile_ext_session_id ϞόΠϧηογϣϯใ ×
dtb_module Ϟδϡʔϧใ × dtb_module_update_log Ϟδϡʔϧߋ৽ϩάใ × dtb_news ৽ணใ dtb_news dtb_order डใ dtb_order dtb_order_detail डৄࡉใ dtb_order_detail dtb_order_temp डҰ࣌ใ × dtb_other_deliv ͦͷଞͷૹઌใ dtb_customer_address
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ dtb_ownersstore_settings ΦʔφʔζετΞઃఆ × dtb_pagelayout ϖʔδϨΠΞτใ dtb_page_layout
dtb_payment ࢧํ๏ใ dtb_payment dtb_payment_options ࢧબࢶใ dtb_payment_option dtb_plugin ϓϥάΠϯใ dtb_plugin dtb_plugin_hookpoint ϓϥάΠϯϑοΫϙΠϯ τ × dtb_products ใ dtb_product dtb_product_categories ΧςΰϦؔ࿈ dtb_product_category dtb_product_class ن֨ใ dtb_product_class
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ dtb_product_status εςʔλεใ × dtb_recommend_products ؔ࿈ใ ×
dtb_review ϨϏϡʔআ๏ × dtb_send_customer ސ٬ϝʔϧૹ৴ཤྺ × dtb_send_history ϝʔϧૹ৴ཤྺ × dtb_session ηογϣϯใ dtb_session dtb_shipment_item ૹใ dtb_shipment_item dtb_shipping ͓ಧ͚ઌใ dtb_shipping dtb_tax_rule ফඅ੫ϧʔϧ dtb_tax_rule
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ dtb_templates ςϯϓϨʔτใ dtb_template dtb_update Ϟδϡʔϧߋ৽ใ ×
mtb_allowed_tag ڐՄλά × mtb_auth_excludes ཧը໘ೝূআ֎ × mtb_authority ཧऀϚελ mtb_authority mtb_constants ఆϚελ × mtb_country ࠃϚελ mtb_country mtb_customer_order_statu s ސ٬දࣔ༻डεςʔλ ε mtb_cusotmer_order_statu s mtb_customer_status ސ٬εςʔλε mtb_customer_status
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ mtb_db σʔλϕʔεछผ mtb_db mtb_delivery_date ൃૹ dtb_delivery_date
mtb_device_type छผ mtb_device_type mtb_disable_logout ϩάΞτແޮϖʔδ × mtb_disp ެ։ϑϥά mtb_disp mtb_job ৬ۀϚελ mtb_job mtb_magazine_type ϝϧϚΨछผ × mtb_mail_magazine_type ϝʔϧϚΨδϯछผ × mtb_mail_template ϝʔϧςϯϓϨʔτ ×
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ mtb_mail_tpl_path ϝʔϧςϯϓϨʔτύε × mtb_mail_type ϝʔϧछผ ×
mtb_mobile_domain ϞόΠϧυϝΠϯ໊ × mtb_order_status डঢ়ଶ mtb_order_status mtb_order_status_color डεςʔλε৭ mtb_order_status_color mtb_ownersstoer_err ΦʔφʔζετΞΤϥʔ छผ × mtb_page_max ϖʔδ࠷େදࣔ mtb_page_max mtb_permission ཧը໘ΞΫηεݖݶ × mtb_pref ಓݝϚελ mtb_pref
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ mtb_product_list_max Ұཡ࠷େදࣔ mtb_product_list_max mtb_product_status_color εςʔλε৭ ×
mtb_product_type छผϚελ mtb_product_type mtb_recommend ͓͢͢ΊϨϕϧ × mtb_reminder ύεϫʔυ࣭Ϛελ × mtb_review_deny_url ϨϏϡʔڋ൱URL × mtb_sex ੑผϚελ mtb_sex mtb_status εςʔλε × mtb_status_image εςʔλεը૾ ×
2ܥͱ3ܥͷςʔϒϧରൺ 2ܥςʔϒϧ ཧςʔϒϧ໊ 3ܥςʔϒϧ mtb_target ϒϩοΫλʔήοτ × mtb_taxrule ՝੫نଇϚελ mtb_taxrule
mtb_wday ༵ × mtb_work ཧऀՔಇঢ়ଶ mtb_work mtb_zip ༣ศ൪߸ mtb_zip
3.PostgreSQLͱMySQLͲͪΒ Λ͑ྑ͍ͷ?
PostgreSQLͱMySQLͲͪΒΛ ͑ྑ͍ͷ? • EC-CUBE3Doctrineͱ͍͏ORMΛ͍ͬͯΔͨ ΊɺPostgreSQLͱMySQLͷҧ͍ΞϓϦ͔Βͷ؍ ͰݟΔͱͲͪΒΛͬͯҧ͍ແ͠ • ύϑΥʔϚϯεͷ؍ͰΈΔͱαʔόڥʹґΔ ͱ͜Ζ͕େ͖͍ͨΊɺ͕ࣗಘҙͱ͢ΔํΛ͑ ྑ͍
• ҰݴͰ͓͑͢Δͱҧ͍ͳ͠ʂ
PostgreSQLͱMySQLͲͪΒΛ ͑ྑ͍ͷ? • ݅(dtb-product)ʹ20,000݅Λ༻ҙͯ͠ PostgreSQLͱMySQLͷಈ࡞Λ͓ݟͤ͠·͢ɻ
4.EC-CUBE3Ξοϓσʔτ࣌ͷ DB·ΘΓͷҙ
EC-CUBE3Ξοϓσʔτ࣌ͷDB ·ΘΓͷҙ • EC-CUBE3͔ΒຊମͷόʔδϣϯΞοϓʹͳ͍ɺDBͷ όʔδϣϯΞοϓmigrationϑΝΠϧΛͬͯΞοϓσʔ τՄೳ ˠsrc/Eccube/Resource/doctrine/migrationԼʹଘࡏ͢Δ ϑΝΠϧΛݩʹmigration͕࣮ߦ͞ΕΔ • ຊମΞοϓσʔτʹͳ͍DBͷมߋ͕ൃੜͨ͠߹ɺ
http://υϝΠϯ/install.php/migration Λ࣮ߦ͢Δ͜ͱͰɺmigration͕࣮ߦ͞ΕDB͕࠷৽Խ͞ΕΔ
EC-CUBE3Ξοϓσʔτ࣌ͷDB ·ΘΓͷҙ • Πϯετʔϧ࣌doctrine_migraion_versionsͱ͍ ͏ςʔϒϧ͕࡞͞ΕΔ͕ɺmigrationཧ༻ ςʔϒϧͱͯࣗ͠ಈతʹ࡞͞ΕΔςʔϒϧͷ ͨΊ৮Βͳ͍͜ͱ • ༨ஊͰ͕͢ɺEC-CUBE2ܥ͔ΒEC-CUBE3ͷ σʔλϕʔεҠߦπʔϧݱঢ়ఏڙ༧ఆͳ͠
EC-CUBE3Ξοϓσʔτ࣌ͷDB ·ΘΓͷҙ • ϓϥάΠϯ͔Βຊମͷςʔϒϧʹରͯ͠ͷΧελϚΠζඇ ਪ ˠ࣮ݱ͢ΔͨΊʹϓϥάΠϯΠϯετʔϧ࣌ʹϚΠάϨʔ γϣϯػೳΛͬͯϓϥάΠϯ༻ͷςʔϒϧΛ࡞ͯ͠ѻ͏ ͷ͕·͍͠ • mtb_constants͕ແ͘ͳΓɺΘΓʹconstant.ymlΛ༻͢Δ
͜ͱʹͳ͕ͬͨɺݱࡏEC-CUBE3Ͱ༻͞Ε͍ͯͳ͍߲ ଘࡏ͢ΔͨΊɺকདྷ༻͞Ε͍ͯͳ͍߲আ͞ΕΔՄ ೳੑ͋Γ
ࠓ͓͠ग़དྷͳ͔ͬͨ͜ͱ • େ෯ʹมΘͬͨΧϥϜͷςʔϒϧ • ֤ςʔϒϧͷؔ࿈ੑ • ֤ػೳͰ༻͞Ε͍ͯΔςʔϒϧ • 2ܥ͔Β3ܥσʔλҠߦͲ͏͢Δͷ? •
ଞʹ͋Γ·͕͢·ͨػձ͕͋Ε͓͠͠·͢ɻΑ ͔͘Βͳ͍Αɺͱ͍͏ํޙͰฉ͍͍ͯͩ͘͞ɻ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ