Skip to content

typeorm_metadata table not in migrations when generating view sql #4923

@timojokinen

Description

@timojokinen

Issue 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions