๐Ÿ“ Rails ใง config/database.yml ใ‚ˆใ‚Šใ‚‚ ENV['DATABASE_URL'] ใฎ่จญๅฎšใŒๅ„ชๅ…ˆใ•ใ‚Œใ‚‹่ฉฑ

MySQL ใ‚’ๅˆฉ็”จใ™ใ‚‹ Rails ใƒ—ใƒญใ‚ธใ‚งใ‚ฏใƒˆใ‚’่ตทๅ‹•ใ—ใ‚ˆใ†ใจใ—ใŸใจใ“ใ‚ใ€ไธ‹่จ˜ใฎใ‚จใƒฉใƒผใŒ็™บ็”Ÿใ—ใพใ—ใŸใ€‚ bin/rails s # ใƒ‡ใƒผใ‚ฟใƒ™ใƒผใ‚นใ‚ขใƒ€ใƒ—ใ‚ฟใƒผใซใฏ mysql2 ใ‚’้ธๆŠžใ—ใฆใ„ใ‚‹็Šถๆ…‹ใชใฎใซ postgresql ใงๆŽฅ็ถšใ—ใ‚ˆใ†ใจใ—ใฆใ„ใ‚‹ Error loading the 'postgresql' Active Record adapter. Missing a gem it depends on? pg is not part of the bundle. Add it to your Gemfile. (LoadError) # config/database.yml ใƒ•ใ‚กใ‚คใƒซใฎไธญ่บซไธ€้ƒจๆŠœ็ฒ‹ # mysql2 ใ‚’ใƒ‡ใƒผใ‚ฟใƒ™ใƒผใ‚นใ‚ขใƒ€ใƒ—ใ‚ฟใƒผใจใ—ใฆๅˆฉ็”จใ—ใฆใ„ใ‚‹ใŸใ‚ใ€ # PostgreSQL ๆŽฅ็ถšใฎใŸใ‚ใฎ pg ใƒฉใ‚คใƒ–ใƒฉใƒชใฎ่ฟฝๅŠ ใ‚’ๆฑ‚ใ‚ใ‚‹ใ‚จใƒฉใƒผใŒ็™บ็”Ÿใ—ใฆใ„ใ‚‹ใฎใฏไฝ•ใ‹ใŠใ‹ใ—ใ„ใ€‚ใ€‚ default: &default adapter: mysql2 #... ไฝ•ใงใ‚„ใ€ใ€ใจๆ€ใ„ Rails ใฎใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆใ‚’่ชญใ‚“ใงใ„ใŸๆ‰€ใ€ๅ…ฌๅผใ‚ตใ‚คใƒˆใซ Connection Preference ใซ้–ขใ™ใ‚‹่จ˜่ฟฐใ‚’่ฆ‹ใคใ‘ใพใ—ใŸใ€‚ Since pool is not in the ENV[โ€˜DATABASE_URLโ€™] provided connection information its information is merged in....

May 29, 2021 ยท Me