Introspection Failed because foreign key references another schema


#1

I am trying to create a prisma service over an existing Postgres DB. I have tried to set up via Introspection, but it failed whenever it was attempting to because:
Failed to resolve FK constraint partners_x_channels_x_objectives.channel_id -> channels.channel_id

The second time that I tried to create a service, I did not specify a schema and then went and edited the datamodel.prisma file in order to change the data model since no introspection of the schema that I wanted happened. However, that failed as well. Can you point me in the right direction?

"types\":\"type partners {\\n  id: Int! @pgColumn(name: \\\"partner_id\\\") @unique\\n  name: String\\n  
description: String\\n  created_at: DateTime\\n}\\n\\n\",\"dryRun\":true,\"secrets\":null,\"subscriptions\": 
[]}","code":"0","stack_trace":"scala.sys.package$.error(package.scala:26)\\n com.prisma.deploy.connector.jdbc.DatabaseInspectorImpl.mColumnToModel(DatabaseInspectorImpl.scala:143)\\n com.prisma.deploy.connector.jdbc.DatabaseInspectorImpl.$anonfun$mTableToModel$6(DatabaseInspectorImpl.scala:41)\\n scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)\\n scala.collection.Iterator.foreach(Iterator.scala:937)\\n scala.collection.Iterator.foreach$(Iterator.scala:937)\\n scala.collection.AbstractIterator.foreach(Iterator.scala:1425)\\n scala.collection.IterableLike.foreach(IterableLike.scala:70)\\n scala.collection.IterableLike.foreach$(IterableLike.scala:69)\\n scala.collection.AbstractIterable.foreach(Iterable.scala:54)\\n scala.collection.TraversableLike.map(TraversableLike.scala:233)\\n scala.collection.TraversableLike.map$(TraversableLike.scala:226)\\n scala.collection.AbstractTraversable.map(Traversable.scala:104)\\n com.prisma.deploy.connector.jdbc.DatabaseInspectorImpl.$anonfun$mTableToModel$5(DatabaseInspectorImpl.scala:39)\\n slick.dbio.DBIOAction.$anonfun$map$1(DBIOAction.scala:43)\\n slick.basic.BasicBackend$DatabaseDef.$anonfun$runInContextInline$1(BasicBackend.scala:171)\\n scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:303)\\n scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)\\n scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)\\n akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)\\n akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)\\n scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)\\n scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81)\\n akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)\\n akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)\\n akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44)\\n akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)\\n akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)\\n akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)\\n akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)","message":"Encountered unknown SQL type 1111 with column click_conversion_window. MColumn(MQName(core.advertisers_test),click_conversion_window,1111,interval,Some(49),Some(6),10,Some(true),None,None,49,20,Some(true),None,None,Some(false))"}}

#2

Hi @rynslmns

It looks like a bug to me. Can you please open a github issue for this: https://github.com/prisma/prisma/issues/new?template=bug_report.md


#3

I opened the bug on Github.

https://github.com/prisma/prisma/issues/4348