࣮ࡍʹಈ͔ͯ͠Έͯൃੜͨ͠
• ੑผσʔλ int͡Όͳ͍ͷʁ.
• Zero Date
• with timezone
• etc...
57
Slide 58
Slide 58 text
Zero Date
MySQLͰ 0000-00-00 Λ
DatetimeܕͷΧϥϜʹొ͢Δࣄ͕ग़དྷΔɻ
PostgreSQLͰ 0000-00-00 Λ
ʹΩϟετ͢Δࣄવग़དྷͳ͍ɻ
• DMSͰϨϓϦέʔγϣϯ͠Α͏ͱͨ࣌͠ͰίέΔɻ
• hoge_date NOT NULL DEFAULT '0000-00-00' ͷڪා...
58
Slide 59
Slide 59 text
Zero Dateͷରॲ
• ·ͣɺจࣈྻͰड͚ͱΔɻ
ALTER TABLE hoge
ALTER COLUMN hoge_date TYPE VARCHAR(35);
- BEFORE τϦΨʔͰ จࣈྻҰகͰஔ͢Δɻ
if (NEW.hoge_date === '0000-00-00 00:00:00') {
NEW.hoge_date = '0001-01-01 00:00:00';
}
59
Slide 60
Slide 60 text
with timezone
MySQLͷJSTͰདྷΔ(͕ɺTimezoneͷใͳ͍)ɻ
PostgreSQLͰͦͷ··Insert͢Δɻ(UTCͱͯ͠ѻΘΕΔ)
↓
ʮύʔςΟͷ։࠵͕ਂͷ1͔࣌Β2࣌ͬͯͳͬͯ·͢Αʁʯ
JSTΛUTCʹมͨ͠ঢ়ଶͰೖΕΔɻ
60