in Education by
I am trying to connect to MySQL. I have defined the db connection vars in a .env file in my root dir, and I am initializing the connection in the app.module.ts file. the only issue I am facing now is when creating or running migrations using the CLI, I followed the typeorm docs here to configure the connection, however when I run typeorm migrate:create -n myNewTable, it should create the migration file in the specified directory, what it does instead is it creates it in the app root directory, similarily, I solved the issue by using the -d flag after the typeorm migrate:create to specify the directory, however when I try running my migration files, I get this No connection options were found in any of configurations file. here is my app.module.ts file. TypeOrmModule.forRoot({ type: 'mysql', host: process.env.TYPEORM_HOST, port: parseInt(process.env.TYPEORM_PORT, 10), username: process.env.TYPEORM_USERNAME, password: process.env.TYPEORM_PASSWORD, database: process.env.TYPEORM_DATABASE, synchronize: false, migrations: [process.env.TYPEORM_MIGRATIONS], cli: { migrationsDir: process.env.TYPEORM_MIGRATIONS_DIR, }, logging: (process.env.TYPEORM_LOGGING === 'true') ? true : false, entities: [__dirname + '/../**/*.entity{.ts,.js}'], }), Run code snippetExpand snippet and here is my .env file # use .ts for development, .js for production TYPEORM_CONNECTION = mysql TYPEORM_HOST = 127.0.0.1 TYPEORM_PORT = 3306 TYPEORM_USERNAME = TYPEORM_PASSWORD = TYPEORM_DATABASE = TYPEORM_SYNCHRONIZE = true TYPEORM_MIGRATIONSRUN = true TYPEORM_LOGGING = true TYPEORM_ENTITIES = src/**/**.entity.ts #TYPEORM_ENTITIES = src/**/**.entity.js TYPEORM_SUBSCRIBERS = src/subscriber/*.ts #TYPEORM_SUBSCRIBERS = src/subscriber/*.js TYPEORM_MIGRATIONS = src/database/migration/*.ts TYPEORM_MIGRATIONS_DIR = src/database/migration TYPEORM_SUBSCRIBERS_DIR = src/subscriber Run code snippetExpand snippet any help/hint is highly appreciated, thanks in advance. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Try to change your entities dir in ormconfig.json or .env, it worked for me as: "entities": ["dist/**/**.entity{.ts,.js}"]

Related questions

0 votes
    I want to map a Mysql bit data column against a boolean property with TypeOrm. I'm using the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I'm trying to configure SSL for Kafka Connect REST API (2.11-2.1.0). The problem I tried two ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 14, 2022 in Education by JackTerrance
0 votes
    I am trying to connect to remote site via https and download some information. I am doing this: library("httr") library("XML") library(RCurl) url...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I'm using MySqldb with Python 2.7 to allow Python to make connections to another MySQL server import ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I want to connect to db on EC2 from my local machine, I am not able to do and have tried everything- I ... to connect to the database Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I want to use python to connect to a MySQL database, how can I do that? Select the correct answer from above options...
asked Jan 23, 2022 in Education by JackTerrance
0 votes
    Which of the following package is used to connect MySQL RDBMS with R? (a) RMySQL vignette (b) MySQL ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 31, 2021 in Education by JackTerrance
0 votes
    I'm developing a Nestjs micro-service and need to run the build in dist folder using below command and ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    Installed Postgres-XC $>sudo apt-get install postgres-xc then $ postgres -V postgres (PostgreSQL) 9.2. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 14, 2022 in Education by JackTerrance
0 votes
    Last few weeks me and few colleagues are encountering crashes of Remote debugger tools in case we're using ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 12, 2022 in Education by JackTerrance
0 votes
    FirebaseAuth.AuthStateListener mAuthListener; private FirebaseAuth mAuth; EditText name, email, password; Button submit; ... Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 22, 2022 in Education by JackTerrance
0 votes
    I have been trying to connect to my prod server from my dev using connect to remote (which gets ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 8, 2022 in Education by JackTerrance
0 votes
    I am developing Outlook add-ins which populates all the available shared mailboxes in to combo box and sends ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I am trying to declare a list which can either be full of type 'a' data or type 'b' at a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I am developing Outlook add-ins which populates all the available shared mailboxes in to combo box and sends ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
...