Upgrade to Pro — share decks privately, control downloads, hide ads and more …

sequelize.pdf

 sequelize.pdf

sequelize と sequelize-autoの紹介

52ecfbc87e5145ed5cd8cd81de9cffa8?s=128

Kazunori-Kimura

June 11, 2018
Tweet

Transcript

  1. OQNͷศརͳύοέʔδ 4FRVFMJ[F TFRVFMJ[FBVUP  ໦ଜݑن

  2. 4FRVFMJ[F 03Ϛούʔ w 1PTUHSF42- w .Z42- w 42-JUF w .442-4FSWFS

    IUUQEPDTTFRVFMJ[FKTDPN  
  3. αϯϓϧίʔυ const User = sequelize.define('user', { username: Sequelize.STRING, birthday: Sequelize.DATE

    }); sequelize.sync() .then(() => User.create({ username: 'janedoe', birthday: new Date(1980, 6, 20) })) .then(jane => { console.log(jane.toJSON()); });  
  4. αϯϓϧίʔυ const User = sequelize.define('user', { username: Sequelize.STRING, birthday: Sequelize.DATE

    }); sequelize.sync() .then(() => User.create({ username: 'janedoe', birthday: new Date(1980, 6, 20) })) .then(jane => { console.log(jane.toJSON()); });   Ϟσϧఆٛ
  5. αϯϓϧίʔυ const User = sequelize.define('user', { username: Sequelize.STRING, birthday: Sequelize.DATE

    }); sequelize.sync() .then(() => User.create({ username: 'janedoe', birthday: new Date(1980, 6, 20) })) .then(jane => { console.log(jane.toJSON()); });   ςʔϒϧ࡞੒
  6. αϯϓϧίʔυ const User = sequelize.define('user', { username: Sequelize.STRING, birthday: Sequelize.DATE

    }); sequelize.sync() .then(() => User.create({ username: 'janedoe', birthday: new Date(1980, 6, 20) })) .then(jane => { console.log(jane.toJSON()); });   Promiseϕʔε
  7. αϯϓϧίʔυ const User = sequelize.define('user', { username: Sequelize.STRING, birthday: Sequelize.DATE

    }); sequelize.sync() .then(() => User.create({ username: 'janedoe', birthday: new Date(1980, 6, 20) })) .then(jane => { console.log(jane.toJSON()); });   INSERTॲཧ
  8. αϯϓϧίʔυ const User = sequelize.define('user', { username: Sequelize.STRING, birthday: Sequelize.DATE

    }); await sequelize.sync(); const jane = await User.create({ username: 'janedoe', birthday: new Date(1980, 6, 20) }); console.log(jane.toJSON());  
  9. ίʔυϑΝʔετ ίʔυ͔Βςʔϒϧͷ࡞੒͕Մೳ 42-Λॻ͘ඞཁ͕ͳ͍  

  10. ίʔυϑΝʔετ ίʔυ͔Βςʔϒϧͷ࡞੒͕Մೳ 42-Λॻ͘ඞཁ͕ͳ͍ Ϟσϧఆ͕ٛ݁ߏ໘౗͍͘͞ ςʔϒϧ͕ଟ਺͋ͬͨ৔߹ʹख͕͔͔ؒΔ  

  11. TFRVFMJ[FBVUP "VUPNBUJDBMMZHFOFSBUFCBSFTFRVFMJ[F NPEFMTGSPNZPVSEBUBCBTF IUUQTHJUIVCDPNTFRVFMJ[FTFRVFMJ[F BVUP  

  12. %FNP TFRVFMJ[FBVUPΛ࢖༻ͯ͠MPDBMIPTUͷTBNQMF σʔλϕʔε .Z42- ͔ΒϞσϧΛੜ੒ ςʔϒϧ  

  13. None
  14. ·ͱΊ 4FRVFMJ[F͸/PEFKTͷ03Ϛούʔ 1SPNJTFϕʔε ͢Ͱʹ%#͕͋Ε͹TFRVFMJ[FBVUPΛ࢖͏