query: SELECT VERSION() AS version
query: SELECT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'devintro' AND TABLE_NAME = 'migrations'
query: SELECT FROM devintro.migrations migrations ORDER BY id DESC
0 migrations are already loaded in the database.
2 migrations were found in the source code.
2 migrations are new migrations must be executed.
query: START TRANSACTION
query:
ALTER TABLE post
CHANGE COLUMN likes_count post_like_count INT DEFAULT 0
query failed:
ALTER TABLE post
CHANGE COLUMN likes_count post_like_count INT DEFAULT 0
error: Error: Table 'devintro.post' doesn't exist
Migration "RenameLikesCountToPostLikeCount1234567890123" failed, error: Table 'devintro.post' doesn't exist
query: ROLLBACK
Error during migration run:
QueryFailedError: Table 'devintro.post' doesn't exist
at Query.onResult (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\typeorm\src\driver\mysql\MysqlQueryRunner.ts:246:33)
at Query.execute (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\commands\command.js:36:14)
at PoolConnection.handlePacket (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:481:34)
at PacketParser.onPacket (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket. (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:104:25)
at Socket.emit (node:events:519:28)
at Socket.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) {
query: '\n' +
' ALTER TABLE post\n' +
' CHANGE COLUMN likes_count post_like_count INT DEFAULT 0\n' +
' ',
parameters: undefined,
driverError: Error: Table 'devintro.post' doesn't exist
at Packet.asError (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\packets\packet.js:738:17)
at Query.execute (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\commands\command.js:29:26)
at PoolConnection.handlePacket (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:481:34)
at PacketParser.onPacket (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket. (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:104:25)
at Socket.emit (node:events:519:28)
at Socket.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) {
code: 'ER_NO_SUCH_TABLE',
errno: 1146,
sqlState: '42S02',
sqlMessage: "Table 'devintro.post' doesn't exist",
sql: '\n' +
' ALTER TABLE post\n' +
' CHANGE COLUMN likes_count post_like_count INT DEFAULT 0\n' +
' '
},
code: 'ER_NO_SUCH_TABLE',
errno: 1146,
sqlState: '42S02',
sqlMessage: "Table 'devintro.post' doesn't exist",
sql: '\n' +
' ALTER TABLE post\n' +
' CHANGE COLUMN likes_count post_like_count INT DEFAULT 0\n' +
' '
}
C:\Users\yongj\Desktop\workSpace\Devlntro_api>
위와 같은 오류가 뜨면서 자동으로 안됨.
revert 후에 다시 실행해봐도 안됨. 혹시 괜찮은 방법 있으면 말해주길
일단은 수동으로 쿼리문 입력하여 해결함
C:\Users\yongj\Desktop\workSpace\Devlntro_api>npm run typeorm -- migration:run --dataSource ormconfig.ts
query: SELECT VERSION() AS version query: SELECT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'devintro' AND TABLE_NAME = 'migrations' query: SELECT FROM devintro.migrations migrations ORDER BY id DESC 0 migrations are already loaded in the database. 2 migrations were found in the source code. 2 migrations are new migrations must be executed. query: START TRANSACTION query: ALTER TABLE post CHANGE COLUMN likes_count post_like_count INT DEFAULT 0
query failed: ALTER TABLE post CHANGE COLUMN likes_count post_like_count INT DEFAULT 0
error: Error: Table 'devintro.post' doesn't exist Migration "RenameLikesCountToPostLikeCount1234567890123" failed, error: Table 'devintro.post' doesn't exist query: ROLLBACK Error during migration run: QueryFailedError: Table 'devintro.post' doesn't exist at Query.onResult (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\typeorm\src\driver\mysql\MysqlQueryRunner.ts:246:33) at Query.execute (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\commands\command.js:36:14) at PoolConnection.handlePacket (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:481:34) at PacketParser.onPacket (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:97:12) at PacketParser.executeStart (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\packet_parser.js:75:16) at Socket. (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:104:25)
at Socket.emit (node:events:519:28)
at Socket.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) {
query: '\n' +
' ALTER TABLE post\n' +
' CHANGE COLUMN likes_count post_like_count INT DEFAULT 0\n' +
' ',
parameters: undefined,
driverError: Error: Table 'devintro.post' doesn't exist
at Packet.asError (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\packets\packet.js:738:17)
at Query.execute (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\commands\command.js:29:26)
at PoolConnection.handlePacket (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:481:34)
at PacketParser.onPacket (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket. (C:\Users\yongj\Desktop\workSpace\Devlntro_api\node_modules\mysql2\lib\connection.js:104:25)
at Socket.emit (node:events:519:28)
at Socket.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) {
code: 'ER_NO_SUCH_TABLE',
errno: 1146,
sqlState: '42S02',
sqlMessage: "Table 'devintro.post' doesn't exist",
sql: '\n' +
' ALTER TABLE post\n' +
' CHANGE COLUMN likes_count post_like_count INT DEFAULT 0\n' +
' '
},
code: 'ER_NO_SUCH_TABLE',
errno: 1146,
sqlState: '42S02',
sqlMessage: "Table 'devintro.post' doesn't exist",
sql: '\n' +
' ALTER TABLE post\n' +
' CHANGE COLUMN likes_count post_like_count INT DEFAULT 0\n' +
' '
}
C:\Users\yongj\Desktop\workSpace\Devlntro_api>
위와 같은 오류가 뜨면서 자동으로 안됨. revert 후에 다시 실행해봐도 안됨. 혹시 괜찮은 방법 있으면 말해주길 일단은 수동으로 쿼리문 입력하여 해결함