typeorm_metadata table not in migrations when generating view sql
See original GitHub issueIssue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem: When generating the SQL for a view with the cli command “migration:generate” the command creates a table called typeorm_metadata in the database without adding it to the migrations file. If you drop the schema and run the migrations again or run the migration on another machine it fails because the table doesn’t exist.
A solution would be if the migration:run command creates the typeorm_metadata table if it doesn’t exist like migration:generate does or if the migration:generate command adds the create SQL script to the migration.
A workaround is to add the sql create script for typeorm_metadata to your migrations manually.
Up:
CREATE TABLE `typeorm_metadata` (`type` varchar(255) NOT NULL,`database` varchar(255) DEFAULT NULL,`schema` varchar(255) DEFAULT NULL,`table` varchar(255) DEFAULT NULL,`name` varchar(255) DEFAULT NULL,`value` text) ENGINE=InnoDB
Down:
DROP TABLE typeorm_metadata
Issue Analytics
- State:
- Created 4 years ago
- Reactions:37
- Comments:20 (7 by maintainers)
Top Related StackOverflow Question
Same query for PG:
still persists