prisma2 version: [email protected], binary version: 30a33bde5b1d9f79e0a48491749528da76002e24
Following schema.prisma contains roles an enum attribute as array.
datasource db {
provider = "sqlite"
url = "file:../db/data.db"
}
generator photonjs {
provider = "photonjs"
}
model User {
id Int @id
email String @unique
roles Role[]
}
enum Role {
ADMIN
USER
}
Seed file:
import Photon from '@generated/photon';
const photon = new Photon();
async function main() {
const user1 = await photon.users.create({
data: {
email: '[email protected]',
roles: {
set: 'USER'
}
}
});
const user2 = await photon.users.create({
data: {
email: '[email protected]',
roles: {
set: 'ADMIN'
}
}
});
console.log(user1, user2);
}
main()
.catch(e => console.error(e))
.finally(async () => {
await photon.disconnect();
});
The following error occurs when executing ts-node prisma/seed.ts:
Error: Error in Photon:
ConnectorError(QueryError(SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("no such table: data.User_roles"))
stack backtrace:
0: backtrace::backtrace::trace::h5511721bea6fa8d5 (0x1032bb9de)
1: backtrace::capture::Backtrace::new_unresolved::h28f9c9663a9420c8 (0x1032bab38)
2: failure::backtrace::internal::InternalBacktrace::new::hbb41405b6d19ab81 (0x1032ba4a9)
3: <failure::backtrace::Backtrace as core::default::Default>::default::h0458ad281d4247c8 (0x1032ba695)
4: <sql_connector::error::SqlError as core::convert::From<rusqlite::error::Error>>::from::h56a3e12576e2ad6d (0x102be48cc)
5: sql_connector::database::sqlite::<impl sql_connector::transactional::Transaction for rusqlite::transaction::Transaction>::write::hcbd321a4ccfcd7cc (0x102bcda36)
6: sql_connector::transactional::Transaction::insert::h9f2b434c25edfa65 (0x1027cb8d4)
7: sql_connector::transactional::database_writer::create::execute::h2c63144580998c8d (0x102bf954d)
8: sql_connector::transactional::database_writer::<impl connector::database_writer::DatabaseWriter for sql_connector::database::SqlDatabase<T>>::execute::{{closure}}::create::hef864a06474fbea9 (0x102c36a07)
9: <sql_connector::database::sqlite::Sqlite as sql_connector::transactional::Transactional>::with_transaction::h139aada801227fe5 (0x1027c17d3)
10: sql_connector::transactional::database_writer::<impl connector::database_writer::DatabaseWriter for sql_connector::database::SqlDatabase<T>>::execute::hb31d5b14b577d4b8 (0x10284d486)
11: core::executor::write::WriteQueryExecutor::exec_one::h48f2e807cc785823 (0x102ce7006)
12: core::executor::write::WriteQueryExecutor::execute::h992b6a51be508cce (0x102ce695b)
13: core::executor::Executor::exec_all::h5cbc538ae21b3c80 (0x102d05aa4)
14: <prisma::req_handlers::graphql::GraphQlRequestHandler as prisma::req_handlers::RequestHandler>::handle::h7d76032243e11158 (0x10294d9ff)
15: prisma::http_handler::h5782a9905407eb5f (0x1028e838f)
16: <F as actix_web::with::FnWith<T,R>>::call_with::haa4a1a2255bc8611 (0x102945693)
17: <actix_web::with::WithHandlerFut<T,S,R> as futures::future::Future>::poll::hd3a8444797502a6e (0x10294ba12)
18: actix_web::pipeline::PipelineState<S,H>::poll::h147d5d5368789f0e (0x102825b06)
19: <actix_web::pipeline::Pipeline<S,H> as actix_web::server::handler::HttpHandlerTask>::poll_io::h39e2cc76fc5e8dd4 (0x102818fd0)
20: actix_web::server::h1::Http1Dispatcher<T,H>::poll_handler::hf7d43112cc4ed6f5 (0x1027eee0a)
21: actix_web::server::h1::Http1Dispatcher<T,H>::poll::h9c1da5bf8f5108dd (0x1028be063)
22: <actix_web::server::channel::HttpChannel<T,H> as futures::future::Future>::poll::had9f1b0a81e71dda (0x1028bcf39)
23: <actix_web::server::channel::HttpChannel<T,H> as futures::future::Future>::poll::had9f1b0a81e71dda (0x1028bddf3)
24: <actix_net::service::and_then::AndThenFuture<A,B> as futures::future::Future>::poll::h15ac475c98adc942 (0x1028178c6)
25: futures::future::chain::Chain<A,B,C>::poll::hb6e62549216884f5 (0x102813b44)
26: futures::task_impl::std::set::he4a7d579f87ab972 (0x102a2f5bd)
27: futures::task_impl::Spawn<T>::poll_future_notify::h1a5228822adb903e (0x102a485cf)
28: tokio_current_thread::CurrentRunner::set_spawn::h6965d5b16e375442 (0x102a29534)
29: tokio_current_thread::scheduler::Scheduler<U>::tick::h6c1934358ae3f6a8 (0x102a358c5)
30: tokio_current_thread::Entered<P>::block_on::he3da6e046995d1e4 (0x102a2a0ea)
31: std::thread::local::LocalKey<T>::with::h6ed9ac0420a84d3b (0x102a407c4)
32: std::thread::local::LocalKey<T>::with::h71f7d0c12da0393f (0x102a40d07)
33: std::thread::local::LocalKey<T>::with::h10c82d1197b9368d (0x102a3e9ec)
34: std::thread::local::LocalKey<T>::with::h38bd3e3c53efd4ea (0x102a3fec8)
35: tokio::runtime::current_thread::runtime::Runtime::block_on::hbad87c088a1c5a72 (0x102a2d952)
36: std::sys_common::backtrace::__rust_begin_short_backtrace::h690508ce542785d7 (0x102a46168)
37: std::panicking::try::do_call::h1536644c0a3cab79 (0x102a2bcbb)
38: __rust_maybe_catch_panic (0x1032ec4cf)
39: core::ops::function::FnOnce::call_once{{vtable.shim}}::h3508efbc713fc3ba (0x102a469f6)
40: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hf8766009c029bc09 (0x1032d36ce)
41: std::sys::unix::thread::Thread::new::thread_start::hfdef4649a42cf26c (0x1032ebace)
42: _pthread_body (0x7fff6cd792eb)
43: _pthread_start (0x7fff6cd7c249)))
at PhotonFetcher.<anonymous> (/Users/homer/wip/node_modules/@generated/photon/index.js:37:23)
at Generator.throw (<anonymous>)
at rejected (/Users/homer/wip/node_modules/@generated/photon/index.js:5:65)
at process._tickCallback (internal/process/next_tick.js:68:7)
I can confirm. Currently lift is not creating a column and a join table for scalar enum lists.
While String[] is working in the current alpha 2.0.0-alpha.36, Role[] is not creating a column.
Any updates on this issue? 馃
Ok, this is fixed now with [email protected], binary version: 4d17a0639165e5a8e54c7e5cf538ffdf114edb53
You might need to recreate the database

Cool, thanks works for me as well.
Most helpful comment
Ok, this is fixed now with
[email protected], binary version: 4d17a0639165e5a8e54c7e5cf538ffdf114edb53You might need to recreate the database