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
570
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
910
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
SwiftUIで単方向アーキテクチャを導入して得られた成果
takuyaosawa
0
120
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
180
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
180
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
3.4k
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
190
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
140
はてなにおけるfujiwara-wareの活用やecspressoのCI/CD構成 / Fujiwara Tech Conference 2025
cohalz
3
3.1k
Оптимизируем производительность блока Казначейство
lamodatech
0
980
盆栽転じて家具となる / Bonsai and Furnitures
aereal
0
2.1k
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
2.3k
AWS re:Invent 2024個人的まとめ
satoshi256kbyte
0
140
テストコード書いてみませんか?
onopon
2
360
Featured
See All Featured
Speed Design
sergeychernyshev
25
750
Designing Experiences People Love
moore
139
23k
Thoughts on Productivity
jonyablonski
68
4.4k
Visualization
eitanlees
146
15k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Measuring & Analyzing Core Web Vitals
bluesmoon
5
210
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Six Lessons from altMBA
skipperchong
27
3.6k
Documentation Writing (for coders)
carmenintech
67
4.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
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ܥσʔλҠߦͲ͏͢Δͷ? •
ଞʹ͋Γ·͕͢·ͨػձ͕͋Ε͓͠͠·͢ɻΑ ͔͘Βͳ͍Αɺͱ͍͏ํޙͰฉ͍͍ͯͩ͘͞ɻ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ