Skip to content

Ignore column when generating migration #11277

@alexeychikk

Description

@alexeychikk

Feature Description

There is an option to ignore entity when generating migration

@Entity({ synchronize: false })

But there is no such option for @Column().

The Solution

It would be nice to have @Column({ synchronize: false })

Considered Alternatives

I didn't find any alternatives to this

Additional Context

The problem is that I have a column like this one:

  @Column({ insert: false, update: false, select: false })
  fooBar?: boolean;

It's not persisted to DB, I assign a result of custom .addSelect(...) to it.
But when I generate a migration, typeorm treats it as real column and generates ALTER TABLE ... for it.
So I need a mechanism to ignore a column in migration generation.

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugquestionsize-mModerately complex tasks involving multiple steps. Estimated effort: Half a day to 1 day

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions