Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Lyth0
    @Lyth0

    @reggi I looked into the github code. Found something like:

    hasRelation<T>(target: ObjectType<T>|string, relation: string|string[]): boolean {
            const entityMetadata = this.connection.getMetadata(target);
            const relations = relation instanceof Array ? relation : [relation];
            return relations.every(relation => {
                return !!entityMetadata.findRelationWithPropertyPath(relation);
            });
        }

    may this help you? :o

    Thomas Reggi
    @reggi
    @Lyth0 I tried using this.connection.getMetadata, for some reason it was taking for ever to run
    Lyth0
    @Lyth0
    give me a second. I try to run it on my code
    I got the response instantly :o
    getConnection().getMetadata(Entity);
    Thomas Reggi
    @reggi
    hmmmm
    weird
    I'll look into this thanks @Lyth0
    carrow
    @carrowheap
    Hi everyone, I'm new to TypeORM, after npm run typeorm migration:run there isn't any table created in the database while I've an entity in my project. can someone help me to solve this problem.
    organisation_not_found.png
    organisation_entity.png
    Thomas Reggi
    @reggi
    @carrowheap I've never migrated manually, once you set up the entities and make a connection the tables are created automatically.
    Question: I am trying to query on deep relations, can this be done? https://stackoverflow.com/questions/56993963/query-by-deep-properties-on-relations
    Thomas Reggi
    @reggi
    Trying to do this the legitimate way using .createQueryBuilder() and it's not returning the correct data, but the raw SQL is. Any ideas what I'm missing?
    typeorm/typeorm#4423
    Mark Everett
    @TreeMan360
    hey, what is the instance scope for a subscriber? Is it a singleton or per-request?
    i.e can I safely store previous value as a member variable in beforeUpdate and then compare changes in afterInsert? Or will this suffer from concurrency issues?
    Aaron Rice
    @adrice727
    I'm running into a databaseColumn type for User#email is not defined and cannot be guessed error when starting my server. I've seen typeorm/typeorm#2897, but I don't understand how the babel plugin is supposed to fix the issue.
    carrow
    @carrowheap
    HI everyone, is there any way to clear content show by typeorm schema:log ?
    Thomas Reggi
    @reggi
    Thomas Sieverding
    @Bajix
    If you define a join table and have two one-to-many relationships with it, can you also have a many-to-many?
    Looking at the example there, couldnt that be taken a step further to define a many to many using the defined/extended table?
    Alessandro Tagliapietra
    @alex88
    Hi everyone, does having a composite primary key with a number and a many to one column work?

    I've tried with

    @ManyToOne(type => Invoice, invoice => invoice.lines, {
      primary: true
    })
    invoice: Invoice;
    
    @PrimaryColumn()
    @Column()
    orderLineNum: number;

    but it overwrites the primary key with the many to one primary key and then after the migration only one column is primary

    Alessandro Tagliapietra
    @alex88

    seems that

      @ManyToOne(type => Invoice, invoice => invoice.lines, {
        primary: true
      })
      invoice: Invoice;
    
      @Column({
        primary: true
      })
      orderLineNum: number;

    is the way to go

    remibruyere
    @remibruyere
    Hi, i go a problem with migrations, when one or more migration are already applied on the database, typeorm can't find the changes between the code and the live version of the database. That return me the message : "No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command"
    I can generate the first migration without any problem. But i can't for the next migrations
    If someone already know this bug / how to fix it. That can help me a lot. Thank's
    Tomasz Gałkowski
    @galkowskit
    @remibruyere I know this won't be much help, but we gave up on TypeORMs migrations. My advice is (it saved us a lot of headaches): disable autosync and write migrations by hand (create empty migration via typeorm CLI). :(
    aaronfulkerson
    @aaronfulkerson
    typeorm/typeorm#3067
    typeorm/typeorm#4473
    I hate to be that guy but could we get some action on these issues?
    exequielc
    @exequielc

    Hi, I'm using this old sql.js v0.5.0 and don't understand how to change the conection in order to upgrade to 1.0

    I'm using the Ionic implementation.

    let dbOptions: ConnectionOptions;
     dbOptions = {
              type: 'sqljs',
              location: 'browser',
              autoSave: true
     };
     Object.assign(dbOptions, {
          synchronize: true,
          autoSchemaSync: true,
          migrationsRun: true,
          entities: [    tables   ]
        });
         return createConnection(dbOptions).then(connection => {
          console.log("Data Access connected!");
          return connection;
        }).catch(error => {
          //console.log("Data Access Error : ", );
          return null;
        });
    Sam Grönblom
    @sgronblo

    Does this work in typeorm?

    @Entity()
    class Foo {
      @PrimaryGeneratedColumn() id: number
      nestedProp: {
        @Column() greeting: string
      }
    }

    Basically setting a nested property.

    Sam Grönblom
    @sgronblo

    Hey, I'm trying out migrations:generate on an empty DB with postgres. For some reason the generated migration is doing the following:

    • Create the table as expected based on a single @Entity I have defined
    • Drop all the columns of the previously created table
    • Recreate all the columns that it just deleted

    This seems buggy to me.

    Sam Grönblom
    @sgronblo
    Seems like there are a lot of issues on GH related to migrations:generate
    Is this channel kind of dead or?
    Jemli Fathi
    @jemliF

    hello guys
    I am facing a tough day due to FindConditions/FindManyOptions in Repository.find method.
    most of the worst, I've got this error :

    [Nest] 26433 - 2019-09-06 12:37:02 [ExceptionsHandler] Maximum call stack size exceeded +3373ms
    RangeError: Maximum call stack size exceeded
    at String.split (<anonymous>)
    at Function.QueryBuilderUtils.isAliasProperty (/home/fethijemli/Documents/dev/node/nest/CIO-FORUM-BACKEND/src/query-builder/QueryBuilderUtils.ts:17:15)
    at JoinAttribute.getValue (/home/fethijemli/Documents/dev/node/nest/CIO-FORUM-BACKEND/src/query-builder/JoinAttribute.ts:143:40)
    at JoinAttribute.get [as relation] (/home/fethijemli/Documents/dev/node/nest/CIO-FORUM-BACKEND/src/query-builder/JoinAttribute.ts:162:53)
    at JoinAttribute.get [as metadata] (/home/fethijemli/Documents/dev/node/nest/CIO-FORUM-BACKEND/src/query-builder/JoinAttribute.ts:175:18)
    at SelectQueryBuilder.join (/home/fethijemli/Documents/dev/node/nest/CIO-FORUM-BACKEND/src/query-builder/SelectQueryBuilder.ts:1299:27)
    at SelectQueryBuilder.leftJoin (/home/fethijemli/Documents/dev/node/nest/CIO-FORUM-BACKEND/src/query-builder/SelectQueryBuilder.ts:284:14)
    at SelectQueryBuilder.leftJoinAndSelect (/home/fethijemli/Documents/dev/node/nest/CIO-FORUM-BACKEND/src/query-builder/SelectQueryBuilder.ts:364:14)
    at /home/fethijemli/Documents/dev/node/nest/CIO-FORUM-BACKEND/src/find-options/FindOptionsUtils.ts:246:16
    at Array.forEach (<anonymous>)

    Salvatore Iovene
    @siovene
    Hello. I can't seem to inject anything in an EventSubscriber. Whatever I try to inject, is undefined. What might be wrong?
    Salvatore Iovene
    @siovene
    Here is some of the relevant code: http://dpaste.com/335CT48
    Deyve Vieira
    @deyvedvm_twitter

    Hi,

    Can I use migrations with synchronized database is true?

    Sam Grönblom
    @sgronblo
    Can you specify the order of columns in a composite primary key?
    Sam Grönblom
    @sgronblo
    I think I am running into this bug: typeorm/typeorm#1668 which part of the code should I look at to see why the quotation is missing?
    Christopher
    @christopher-avila
    Ey there! I have one question related with a best practice of adapting TypeORM to a microservice stack. I have several microservices developed in typescript, each one of them using typeGraphQL with different queries and mutation to different models. I'm wondering if there is a way to dynamically use TypeORM (i.e singleton pattern in an adapter common library) and define entities in a different place that the adapter is defined.
    So a new microservice added should ask for the entities it needs. I've taken a look to the custom repositories and separate entity definition, but I need some light on this.
    Thource
    @Thource_gitlab
    I've got 2 entities, Account and Item, after creating an Account, an Item needs to be created too. I'm thinking of doing this in AfterInsert, but if the Item creation fails, I want the Account to be deleted from the database, as if it were all in one transaction, anyone got any ideas?
    Sam Grönblom
    @sgronblo
    Aren't you describing a simple transaction?
    Jorgen V
    @jvik
    Can I ask for help here, or is this channel for development of TypeORM?
    Sam Grönblom
    @sgronblo
    You can try both, no guarantees either will work :)
    Saulo S. Toledo
    @saulotoledo
    Hi guys. I am using Webpack in a project with TypeORM and I am having an issue with RepositoryNotFoundError. The connection is created by an internal code I should not change, so I was trying to use ormconfig.js to solve the issue. Do you have a suggestion of an approach to make that work automatically? I already separated the bundles in Webpack, each entity is transpiled to a separated js file.
    Saulo S. Toledo
    @saulotoledo
    Hi all. Is there an official way to get the table prefix in a migration file?
    I have queries like "ALTER TABLE 'table_name'...", but I would like to load the table prefix from there.