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
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.2k
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
750
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
190
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
320
ある日突然あなたが管理しているサーバーにDDoSが来たらどうなるでしょう?知ってるようで何も知らなかったDDoS攻撃と対策 #phpcon.2024
akase244
2
7.5k
Go の GC の不得意な部分を克服したい
taiyow
3
930
GitHubで育つ コラボレーション文化 : ニフティでのインナーソース挑戦事例 - 2024-12-16 GitHub Universe 2024 Recap in ZOZO
niftycorp
PRO
0
820
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
6
1.3k
KubeCon NA 2024の全DB関連セッションを紹介
nnaka2992
0
100
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
210
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
930
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
200
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
The Language of Interfaces
destraynor
155
24k
YesSQL, Process and Tooling at Scale
rocio
170
14k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
Designing for humans not robots
tammielis
250
25k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Code Reviewing Like a Champion
maltzj
521
39k
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ܥσʔλҠߦͲ͏͢Δͷ? •
ଞʹ͋Γ·͕͢·ͨػձ͕͋Ε͓͠͠·͢ɻΑ ͔͘Βͳ͍Αɺͱ͍͏ํޙͰฉ͍͍ͯͩ͘͞ɻ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ