-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sqlite uuid relationships #1128
Comments
Just gave it a shot with postgres (v10, I think), seems to work fine. |
Hi,
Example code: @Entity('project')
export class Project {
@PrimaryGeneratedColumn('uuid')
public id: string;
@ManyToOne(type => User)
public user: User
}
@Entity('user')
export class User {
@PrimaryGeneratedColumn('uuid')
public id: string;
@Column({ name: 'name', type: 'varchar', length: 255 })
public name: string
}
createConnection({
type: 'cordova',
location: 'default',
database: 'test',
entities: [
Project,
User
],
synchronize: true,
}).then(conn => {
console.log('ready!')
}) I'm using:
|
Hi, I too am getting the same error using sqlite. I enabled logging and I noticed that my entities with With @Entity()
export class User {
@PrimaryColumn('uuid')
id: string;
} CREATE TABLE "user" ("id" varchar NOT NULL, PRIMARY KEY(id)) With @Entity()
export class Message {
@PrimaryGeneratedColumn('uuid')
id: string;
} CREATE TABLE "message" ("id" varchar NOT NULL) I'm using:
|
This issue is fixed and released in |
When using
@PrimaryKeyGenerated('uuid')
for entities with relationships (@ManyToOne() and @OneToMany()
, specifically), I'm getting errors similar to the following:Here's an example which should reproduce the issue, I think. I'm not 100% sure I'm doing it correctly, because I'm new to typeorm, but swapping from
@PrimaryKeyGenerated('uuid')
to just@PrimaryKeyGenerated()
and anumber
instead of astring
seems to work.Here are my versions:
0.1.1
3.1.13
Haven't tried it with anything other than sqlite just yet. Might try in postgres in a second, if I get a chance.
The text was updated successfully, but these errors were encountered: