Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Pascal Lehr
    @plehr
    I've a problem with multiple connections on node.js with typescript...
    AlreadyHasActiveConnectionError: Is there a doc how to use the ConnectionManager correct?
    Umed Khudoiberdiev
    @pleerock
    you should be able to use multiple connections just make sure they have different names
    Umed Khudoiberdiev
    @pleerock
    guys if some want to start contributing there is #486 place where you can start doing this :)
    Roel
    @roelzkie15
    @pleerock Hi there, i would like to ask if typeorm supports raw sql queries? thanks!
    Umed Khudoiberdiev
    @pleerock
    yes it does
    Vince H.
    @esdoppio
    @pleerock hey, I got some weird exception from typeorm. Could you help out?
    const get_owner_id:Tiger.DbGetWorkOwnerId = async function get_owner_id(work_id:number) {
      const result:any = await user_work_repo
          .createQueryBuilder('user_works')
          .select('user_id')
          .where('user_works.id = :work_id', { work_id })
          .execute();
    
      return result[0] && result[0].user_id;
    }
    This is the original version of the function, which worked fine.
    Later I found out that I could use the findOneById instead.
    So I changed it to
    const get_owner_id:Tiger.DbGetWorkOwnerId = async function get_owner_id(work_id:number) {
      const result:any = await user_work_repo.findOneById(work_id);
      return result && result.user_id;
    }
    Vince H.
    @esdoppio
    which throws
    TypeError: date.getFullYear is not a function
        at Function.DataTransformationUtils.normalizeHydratedDate (/usr/src/app/node_modules/typeorm/util/DataTransformationUtils.js:23:47)
        at MysqlDriver.prepareHydratedValue (/usr/src/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:227:74)
        at /usr/src/app/node_modules/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js:89:42
        at Array.forEach (native)
        at RawSqlResultsToEntityTransformer.transformIntoSingleResult (/usr/src/app/node_modules/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js:85:26)
        at /usr/src/app/node_modules/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js:48:26
        at Array.map (native)
        at RawSqlResultsToEntityTransformer.groupAndTransform (/usr/src/app/node_modules/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js:45:14)
        at RawSqlResultsToEntityTransformer.transform (/usr/src/app/node_modules/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js:24:21)
        at QueryBuilder.rawResultsToEntities (/usr/src/app/node_modules/typeorm/query-builder/QueryBuilder.js:1032:28)
        at /usr/src/app/node_modules/typeorm/query-builder/QueryBuilder.js:731:46
        at process._tickCallback (internal/process/next_tick.js:109:7)
    I tried going into the codebase typeorm, but couldn't figure out what went wrong.
    Lopierdis
    @Lopierdis
    hello, anyone else encounter this:
    WARNING in ./~/typeorm/platform/PlatformTools.js
    30:23-85 Critical dependency: the request of a dependency is an expression
    David Brokaw
    @dgbrokaw

    Hi, I'm trying to run typeorm tests using docker. I'm up-to-date with the master branch. Windows 10.

    I have started the composed container. When I run npm test, a one-to-one test fails:

     1) one-to-one insert post and details (has inverse relation + full cascade options) "before all" hook: reloadDatabase:
        Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

    This is the log from the container:

    typeorm-mysql | 2017-07-18T18:35:07.507516Z 3 [Note] Aborted connection 3 to db: 'test' user: 'test' host: '172.19.0.1' (Got an error reading communication packets)

    I was wondering if this is expected, or does anyone know what may be the problem? Thanks.

    David Brokaw
    @dgbrokaw
    ^^^
    Since this issue was arising from mysql, and I'm developing in postgres, I changed the "skip" option in ormconfig.json to true for all but postgres. This does not help test files where a single db type is specified to test (e.g. test/integrations/sample2-one-to-one.ts:24), where it says the connection options for the db are not specified. But, where there is no single db specified (uses createTestingConnections instead of setupSingleTestingConnection, the tests run. Fortunately the tests I'm concerned with are defined as such. Am I correct in thinking that the tests are using the postgres driver if the only configuration not skipped in ormconfig.json is the postgres one?
    Banashek
    @Banashek
    Hello quick question. How can I project a type from a querybuilder query? Say I wanted to do a query on my users and map it into a userVM that only contains a subset of the fields of the user table (i.e. without password).
    normally I could just select the subset of fields, but i'm not sure if there is some sort of mapping function to another declared type for the output of the query
    on version 0.0.11 btw
    Banashek
    @Banashek
    hmm it looks like select just seems to be broken for me. even if I call it with any sort of parameter, it will generate a valid query, but .getMany() will return 0 results. copy and pasting the query into psql shows valid output however
    ah it looks like since because I'm selecting a subset of the original entity's properties, that getMany() declares the results a failure. using getManyRaw() with the subset of properties seems to work fine.
    Banashek
    @Banashek
    now I'm wondering if there is a way to specify the type for getRawMany(). I see it's defined as a generic here, but I'm not sure if there is a way to call something like getRawMany<UserVM>()
    Dinu-Iulian Popovici
    @popovicidinu
    Hi all. Quick question about .update(). If I have an entity with multiple relationships to other entities, if I perform an update, are the related objects "preloaded" from the database and update if required? I'm basically receiving a JSON with all the details, and the JSON is mapped directly to the object. Unfortunately I get ER_DUP_ENTRY: Duplicate entry ... for key ... .
    Carlos Esteban Lopez Jaramillo
    @luchillo17
    Hi there, anyone knows if i can extract or introspect the relations in any way? only need the name.
    Sergey Orlov
    @apologetics
    repository. metadata. relations
    Carlos Esteban Lopez Jaramillo
    @luchillo17
    Omg i was getting it from the global variable used by TypeORM
    cvhberger
    @cvhberger
    Hi. Column names are at the moment in camel case (using the alpha version). How can I set it to snake case?
    (found something with naming strategy, but couldnt find out how to use it actually)
    @pleerock
    cvhberger
    @cvhberger
    Is it possible that entities/tables are named as plural in database? eg class User -> Table: users
    Jack Murphy
    @rightisleft
    Does the stable version support the bytea column type for postgres?
    Jack Murphy
    @rightisleft
    i get { DataTypeNotSupportedByDriverError: Specified type (bytea) is not supported by Postgres driver.
    but it looks like that might be alpha 35 and im running 0.11
    Umed Khudoiberdiev
    @pleerock

    Is it possible that entities/tables are named as plural in database? eg class User -> Table: users

    no. Do that manually

    Hi. Column names are at the moment in camel case (using the alpha version). How can I set it to snake case?

    you can set column name in decorator property, e.g. @Column({ name: “some_thing" }). Naming strategies arent completely finished functionality so I don’t recommend you to use it yet. But you can try if you want

    @rightisleft yeah u need to update to the latest
    cvhberger
    @cvhberger
    @pleerock Thank you
    cvhberger
    @cvhberger
    @pleerock As my application is modular, there it is difficult to provide an array of entities while connecting to the DB. Is it possible to add entities later? eg a method of the connection object?
    Umed Khudoiberdiev
    @pleerock
    why it is?
    just provide directory then
    entities: [“modules/**/entity/*.js”]
    cvhberger
    @cvhberger
    Yes, I'll trie that. Thanks.
    Matthias Posch
    @mattposch
    @pleerock writing to you regarding typeorm/typeorm#1052, what's your preferred communication channel, should I create github issues or write here?
    Umed Khudoiberdiev
    @pleerock
    if its not a chat but an issue then always post it on github
    btw guys who still don’t know this is very old typeorm channel
    new one is here