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
[Introspection] "created_at timestamp with time zone not null default now()" doesn't work #1104
Comments
Can you provide an example what currently happens with tables like this @matthewmueller? Does it throw an error? Is the inferred model incorrect? |
Next steps:
|
Related to #487 |
Just in case another example is needed for testing, I created a simple schema in MySQL: CREATE TABLE Todo (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
description VARCHAR(255),
completedAt DATETIME,
createdAt DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updatedAt DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
); The output schema.prisma: model Todo {
completedAt DateTime?
createdAt DateTime
description String?
id Int @default(autoincrement()) @id
updatedAt DateTime
}
|
This should be fixed in the current Can you try and confirm this behaves as expected @matthewmueller and @danilofuchs? Thanks. |
Yes, indeed! model Todo {
completedAt DateTime?
createdAt DateTime
description String?
id Int @default(autoincrement()) @id
updatedAt DateTime
} NEW: model Todo {
completedAt DateTime?
createdAt DateTime @default(now())
description String
id Int @default(autoincrement()) @id
updatedAt DateTime @default(now())
} |
Many postgres schemas have something like:
or
I've talked to @do4gr and he says we handle this wrong:
The text was updated successfully, but these errors were encountered: