Slide 1

Slide 1 text

খࢁ݈Ұ࿠(.01FQBCP *OD 1)1ΧϯϑΝϨϯε෱Ԭલ໷ࡇϦδΣΫτίϯ $*ϑϨϯυϦͳ%#υΩϡϝϯτੜ੒πʔϧͰ υΩϡϝϯτͷ࠷৽Λҡ࣋͠ଓ͚Δ

Slide 2

Slide 2 text

γχΞΤϯδχΞ খࢁ݈Ұ࿠!L-P8 ϗεςΟϯάࣄۀ෦ϗεςΟϯάάϧʔϓϚωʔδυΫϥ΢υνʔϜ IUUQTHJUIVCDPNL-P8

Slide 3

Slide 3 text

օ͞ΜͷϓϩδΣΫτʹ͸ σʔλϕʔεઃܭॻ΍&3ਤ͸ ͋Γ·͔͢ʁ

Slide 4

Slide 4 text

ͦΕ͸ߋ৽͞Ε͍ͯ·͔͢ʁ ࠷৽ͷঢ়ଶͰ͔͢ʁ

Slide 5

Slide 5 text

࠷ۙࢲ͕+0*/ͨ͠ ͋ΔϓϩδΣΫτͷ৔߹

Slide 6

Slide 6 text

Slide 7

Slide 7 text

͋ΔϓϩδΣΫτ -0-*101ϚωʔδυΫϥ΢υ ͷྫ w΋ͷ͍͢͝੎͍Ͱػೳ௥Ճ΍վળ͕܁Γฦ͞Ε͍ͯͨ w͍ΘΏΔ5JFSͳ୯७ͳ8FCΞϓϦέʔγϣϯͳͲͰ͸ͳ͘ɺϩʔϧ ͚ͩͰ΋ऑ΋͋Δɺ͍ΘΏΔ.JDSPTFSWJDFͳߏ੒ wͦͷ͏ͪॏཁͳঢ়ଶอ࣋Λ୲͏σʔλϕʔε͕ϩʔϧ wνʔϜϝϯόʔ͕༏लͰ͋Δ͜ͱ͔ΒσʔλϕʔεͷεΩʔϚมߋ΋ ;͘Ίಉ࣌ฒߦతʹߦΘΕ͍ͯͨ

Slide 8

Slide 8 text

͋ΔϓϩδΣΫτ -0-*101ϚωʔδυΫϥ΢υ ͷྫ wίʔυͷ؅ཧ͸(JU)VC ()& Ͱશͯ؅ཧ wΤϯδχΞ͚ͩͰͳ͘σβΠφʔ΋σΟϨΫλʔ΋(JU)VC্Ͱ׆ಈ wϓϩδΣΫτΛߏ੒͢ΔϦϙδτϦ͸ෳ਺ wϓϩάϥϛϯάݴޠ͸ͭͰ͸ͳ͘5ZQF4DSJQU΍(PͳͲෳ਺

Slide 9

Slide 9 text

଎͘ฒߦతͳ։ൃͷσʔλϕʔεεΩʔϚͷߋ৽՝୊ w୭΋͕σʔλϕʔεεΩʔϚͷશͯΛ೺Ѳ͍ͯ͠Δঢ়گͰ͸ͳ͔ͬͨ w ʮ͜ͷΧϥϜ͸ͲΜͳ༻్Ͱ࢖ΘΕΔΜͰ͔͢ʁʢࣗ෼ʣʯ w 4MBDLͰؾܰʹ࣭໰Ͱ͖Δ͠ɺௐ΂ͨΒΘ͔Δɻ͔͠͠ϫϯςϯϙ஗ΕΔ w୭΋͕σʔλϕʔεεΩʔϚͷ࠷৽ͷঢ়ଶΛ೺Ѳ͍ͯ͠Δঢ়گͰ͸ͳ ͔ͬͨ w ʮ͋ΕʁԶ͕࡞ͬͨϚΠάϨʔγϣϯ͕ద༻͞Εͯͳ͍ʯˠฒߦͰϚΠάϨʔγϣ ϯ͕ൃੜ͢Δ1VMM3FRVFTU͕͋ͬͨ݁ՌɺϚΠάϨʔγϣϯπʔϧͷϑΝΠϧ໊ ͷλΠϜελϯϓνΣοΫͰඈ͹͞Ε͍ͯͨ

Slide 10

Slide 10 text

࠷ॳͷࣗ෼ͷ޻෉ wνʔϜʹ+0*/ͨ͠͹͔ΓͰσʔλϕʔεͷશମ૾͕Θ͔Βͳ͔ͬͨ wͱΓ͋͑ͣ4DIBNB4QZΛ࢖ͬͯखݩʹσʔλϕʔευΩϡϝϯτΛ ࡞੒ͯ͠౎౓֬ೝ͍ͯͨ͠ wIUUQTDIFNBTQZPSH wશςʔϒϧશΧϥϜʹ$0..&/5Λ௥Ճ͢Δ1VMM3FRVFTUΛ͢ΔͳͲ wͱΓ͋͑ͣ҆৺

Slide 11

Slide 11 text

ͱ͜Ζ͕ɺ͋Δͱ͖

Slide 12

Slide 12 text

ϓϩμΫτΦʔφʔ ʮͲ͔͜ʹσʔλϕʔεઃܭॻͳ͍Ͱ͔͢Ͷʁʯ

Slide 13

Slide 13 text

ΤϯδχΞͰͳͯ͘΋42-Λۦ࢖͢Δձࣾͩͬͨ wσʔλϕʔεΛ೺Ѳ͍ͨ͠ͷ͸ΤϯδχΞ͚ͩͰ͸ͳ͔ͬͨ w։ൃ͍ͯ͠ΔΤϯδχΞ͸σʔλϕʔεͷεΩʔϚʹ͍ͭͯ࠷৽Ͱ͸ ͳ͍ʹͤΑ೺Ѳ͍ͯ͠Δʢ͠ͳ͍ͱ։ൃͰ͖ͳ͍ʣ w࣭໰΍֬ೝΛ͢Δͱ͖ʹ΋ΞλϦ͕͚ͭΒΕΔ wීஈผͷ͜ͱΛߟ͑Δඞཁ͕͋ΔσΟϨΫλʔ͸ͦ͏Ͱ͸ͳ͍ w͜Ε͸ʢྑ͍ҙຯͰʣ૝ఆ֎ɺ͜ͷ··ͩͱϚζ͍͔΋

Slide 14

Slide 14 text

UCMT

Slide 15

Slide 15 text

UCMT wUCMTJTB$*'SJFOEMZUPPMGPSEPDVNFOUBEBUBCBTF XSJUUFOJO(P wIUUQTHJUIVCDPNL-P8UCMT w.BSLEPXO ('. ܗࣜͰσʔλϕʔευΩϡϝϯτΛੜ੒ͯ͘͠ΕΔ$-* πʔϧ w$*ϑϨϯυϦʔͳίϚϯυ΋͋Δʢޙड़

Slide 16

Slide 16 text

Πϯετʔϧ w)PNFCSFXͰΠϯετʔϧՄೳ $ go get -u github.com/k1LoW/tbls $ brew install k1LoW/tbls/tbls w(P੡ͳͷͰHPHFUͰ΋ΠϯετʔϧͰ͖·͢

Slide 17

Slide 17 text

Φϓγϣϯ(SBQIWJ[ͷΠϯετʔϧ w&3ਤੜ੒ͷͨΊͷ(SBQIWJ[ΛΠϯετʔϧ͠·͢ $ brew install graphviz

Slide 18

Slide 18 text

AUCMTEPDAσʔλϕʔευΩϡϝϯτͷੜ੒ wAUCMTEPDAίϚϯυͰσʔλϕʔεʹ઀ଓͯ͠υΩϡϝϯτΛੜ੒͠·͢ $ tbls doc mysql://user:pass@hostname:3306/dbname ./dbdoc

Slide 19

Slide 19 text

ͦͯ͠(JU)VCʹίϛοτ

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

4".1-&

Slide 22

Slide 22 text

.BSLEPXOͰ͋Δྑ͞ w(JU)VC্Ͱ͸ࣗಈͰϨϯμϦϯά͞ΕΔ wJNH΋؆୯ʹઃஔͰ͖Δ wϚʔΫμ΢ϯͳͷͰHJUEJ⒎Ͱࠩ෼͕Θ͔Γ΍͍͢ wεΩʔϚߋ৽಺༰͕Θ͔Γ΍͍͢

Slide 23

Slide 23 text

lEJ⒎z

Slide 24

Slide 24 text

AUCMTEJ⒎AυΩϡϝϯτͱσʔλϕʔεͷࠩ෼ wAUCMTEPDAΛAUCMTEJ⒎Aʹม͑Δ͚ͩͰσʔλϕʔεʹ઀ଓͯ͠طଘͷ ੜ੒ࡁΈυΩϡϝϯτͱͷࠩ෼Λग़ྗ͠·͢ʢ(SBQIWJ[Ͱग़ྗͨ͠&3ਤ Ҏ֎ʣ wࠩ෼͕ͳ͍ͱ͖͸Կ΋ग़ྗ͠ͳ͍ $ tbls diff mysql://user:pass@hostname:3306/dbname ./dbdoc

Slide 25

Slide 25 text

lࠩ෼͕ͳ͍ͱ͖͸Կ΋ग़ྗ͠ͳ͍z

Slide 26

Slide 26 text

͜ͷ࢓૊ΈΛ࢖ͬͯ$*ʹ૊ΈࠐΉ

Slide 27

Slide 27 text

$*࿈ܞ wσʔλϕʔεΛ࣋ͭΞϓϦέʔγϣϯͷςετʹ͸࠷৽ʹϚΠάϨʔγϣ ϯ͞Εͨσʔλϕʔε͕༻ҙ͞Ε͍ͯΔ͸ͣɻ wͦͷσʔλϕʔεʹ઀ଓͯ͠AUCMTEJ⒎AΛ࣮ߦɺίϛοτࡁΈͷυΩϡϝ ϯτͷࠩ෼Λ֬ೝɺࠩ෼͕͋Ε͹Τϥʔʹ͢Δɻ wUCMTίϚϯυ͸(P੡ͳͷͰϫϯόΠφϦɻͭ·Γ$*ʹ૊ΈࠐΈ΍͍͢

Slide 28

Slide 28 text

ྫ͑͹ϫϯϥΠφʔ w5SBWJT$*΍$JSDMF$*ͷ:".-ϑΝΠϧʹهड़ͯ͠ར༻Ͱ͖·͢ script: - DIFF=`tbls diff mysql://user:pass@hostname:3306/ dbname ./dbdoc` && if [ ! -z "$DIFF" ]; then echo "document does not match database." >&2 ; tbls diff mysql://user:pass@hostname:3306/dbname ./dbdoc; exit 1; fi

Slide 29

Slide 29 text

ྫ͑͹.BLFpMF wANBLFEPDAͱANBLFUFTUEPDA doc: ## Document database schema tbls doc mysql://user:pass@hostname:3306/dbname ./dbdoc testdoc: ## Test database schema document $(eval DIFF := $(shell tbls diff mysql:// user:pass@hostname:3306/dbname ./dbdoc)) @test -z "$(DIFF)" || (echo "document does not match database." && tbls diff mysql://user:pass@hostname:3306/ dbname ./dbdoc && exit 1)

Slide 30

Slide 30 text

$*ϑϨϯυϦʔ

Slide 31

Slide 31 text

͞Βʹ

Slide 32

Slide 32 text

AŠBEEAϦϨʔγϣϯɺίϝϯτͷิ׬ wUCMT͸',ΛΈͯϦϨʔγϣϯΛ൑ఆͯ͠&3ਤΛ࡞੒͢Δ w͔͠͠ɺੈͷதʹ͸',͕͸ͬͯͳ͍σʔλϕʔε΋͋ΔʢΩʔϨεΤϯ τϦʣ wӡ༻தͷσʔλϕʔεʹ$0..&/5ͷߋ৽ͷͨΊʹ"-5&3͸ͨ͘͠ͳ͍ wͦͷͨΊʹAŠBEEAΦϓγϣϯͰ:".-ϑΝΠϧΛࢦఆ͢Δ͜ͱͰϦϨʔ γϣϯɺίϝϯτͷิ׬͕Ͱ͖·͢

Slide 33

Slide 33 text

ίϚϯυͰυΩϡϝϯτੜ੒ ίϚϯυͰυΩϡϝϯτςετ

Slide 34

Slide 34 text

.Z42- 1PTUHSF42-

Slide 35

Slide 35 text

σʔλϕʔε υΩϡϝϯτ͕ͳ͍ υΩϡϝϯτ͕࠷৽Ͱͳ͍ ϓϩδΣΫτΛ ๾໓͢Δͧʂʂ

Slide 36

Slide 36 text

5IBOLZPV ࠷৽ͷ࠾༻৘ใΛνΣοΫˠ !QC@SFDSVJU