I have got an error while deploying prisma. I have created a very simple table in relationship which couldn’t end in success. I tried multiple sources and multiple table definitions but I always got this error “Duplicate column name”.
Database:mysql
type Contact @db(name: “contact”) {
id: Int! @id
info: String!
type: String!
customerid: Customer
}
type Customer @db(name: “customer”) {
id: Int! @id
contact: [Contact]
firstname: String!
lastname: String!
}
Error:
Contact (Type)
-
Created type
Contact
-
Created field
id
of typeInt!
-
Created field
info
of typeString!
-
Created field
type
of typeString!
-
Created field
customerid
of typeCustomer
Customer (Type)
-
Created type
Customer
-
Created field
id
of typeInt!
-
Created field
contact
of type[Contact!]!
-
Created field
firstname
of typeString!
-
Created field
lastname
of typeString!
ContactToCustomer (Relation)
- Created an inline relation between
Contact
andCustomer
in the columncustomerid
of tableContact
Applying changes 27.9s
▸ The Migration failed and has not been performed. This is very likely not a transient issue.
▸ java.sql.SQLSyntaxErrorException: (conn=924) Duplicate column name ‘customerid’
▸ at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:163)
▸ at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:106)
▸ at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:235)
▸ at org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:224)
▸ at org.mariadb.jdbc.MariaDbPreparedStatementClient.execute(MariaDbPreparedStatementClient.java:159)
▸ at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
▸ at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
▸ at slick.jdbc.StatementInvoker.results(StatementInvoker.scala:38)
▸ at slick.jdbc.StatementInvoker.iteratorTo(StatementInvoker.scala:21)
▸ at slick.jdbc.Invoker.first(Invoker.scala:30)
▸ at slick.jdbc.Invoker.first$(Invoker.scala:29)
▸ at slick.jdbc.StatementInvoker.first(StatementInvoker.scala:15)
▸ at slick.jdbc.StreamingInvokerAction$HeadAction.run(StreamingInvokerAction.scala:52)
▸ at slick.jdbc.StreamingInvokerAction$HeadAction.run(StreamingInvokerAction.scala:51)
▸ at slick.basic.BasicBackend$DatabaseDef$$anon$2.liftedTree1$1(BasicBackend.scala:275)
▸ at slick.basic.BasicBackend$DatabaseDef$$anon$2.run(BasicBackend.scala:275)
▸ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
▸ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
▸ at java.lang.Thread.run(Thread.java:748)
▸ Caused by: java.sql.SQLException: Duplicate column name ‘customerid’
▸ Query is: ALTER TABLE testdb
.contact
▸ ADD COLUMN customerid
int NULL ,
▸ ADD FOREIGN KEY (customerid
) REFERENCES testdb
.customer
(id
) ON DELETE SET NULL;
▸
▸ at org.mariadb.jdbc.internal.util.LogQueryTool.exceptionWithQuery(LogQueryTool.java:146)
▸ at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:217)
▸ at org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:218)
▸ … 15 more
▸