question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ionic 4 mangles table names when using --prod

See original GitHub issue

Issue type:

[ ] question [x] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[x] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [ ] sqlite [ ] sqljs [ ] react-native

TypeORM version:

[x] latest [x] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem: Can’t make Ionic work using the --prod flag. Everything works perfectly when using ionic cordova run android or ionic cordova run android --release but as soon as we add the --prod flag, things start to break. My SQL queries show that all the Queries running look like FROM TABLE a irrespective of what model is being used.

I have tried the workaround suggested in Ionic example: https://github.com/typeorm/ionic-example

  • Using table name with Entity @Entity('user')
  • Getting the repository using the table name getRepository('user')

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
AmirTugicommented, Jul 11, 2018

@pleerock Is there a solution/ a tool for checking that cyclic dependency with the mangle option? I still want to use the uglify ability.

2reactions
kunalgrover05commented, May 18, 2018

Also confirmed with ionic-example repository that I am able to reproduce the same problem. Observations which are common across both my app and ionic-example.

  • The tables are used as “a” or “n” for all SELECT statements
query:  SELECT "n"."id" AS "n_id", "n"."name" AS "n_name" FROM "category" "n" WHERE (("n"."id" = ?) OR ("n"."id" = ?)) -- PARAMETERS: [1,2]
  • Error received when trying to save Post in the Ionic-example.
Uncaught (in promise): Error: Cyclic dependency: "n"
  • INSERTs work when the table does not have any foreign key. In the Ionic-example, if I try to save Category and Author separately they work, but whenever I try to save Post it fails.
query:  INSERT INTO "category"("name") VALUES (?) -- PARAMETERS: ["Programming"]

I believe what is happening is in some queries tables get renamed to “a” and it fails since there’s a cyclic dependency between the Table we are creating data and the FK relation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic 4 prevent shorten the class names for prod build
I am building an ionic 4 app and using class names references in the local offline pouch DB it works fine. But when...
Read more >
How to Create Data Tables with Ionic 4 - YouTube
An updated version on how to build a data table inside your Ionic 4 app using the ngx-datatable package! Learn Ionic...
Read more >
How to Build an Ionic 4 App with SQLite Database & Queries ...
CREATE TABLE IF NOT EXISTS developer(id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT,skills TEXT,img TEXT); INSERT or IGNORE INTO developer ...
Read more >
Rename an Excel table - Microsoft Support
Rename an Excel table to make it easier to find and refer to in formulas and ... Use valid characters — Always begin...
Read more >
Names for tables, databases, and columns - Amazon Athena
Use lower case for table names and table column names in Athena. Athena accepts mixed case in DDL and DML queries, but lower...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found