masumsoft / express-cassandra

Cassandra ORM/ODM/OGM for NodeJS with support for Apache Cassandra, ScyllaDB, Datastax Enterprise, Elassandra & JanusGraph.
http://express-cassandra.readthedocs.io
GNU Lesser General Public License v3.0
232 stars 68 forks source link

UDT (User Defined Types) schema mismatch #128

Closed ahmedosama94 closed 6 years ago

ahmedosama94 commented 7 years ago

When using a user defined type, the first time the table is created, express-cassandra handles it smoothly, but when the table is already created there is always an apollo.model.tablecreation.schemamismatch error thrown, and then it attempts to drop and recreate the column.

ahmedosama94 commented 7 years ago

Gives this message on each run (migration set to alter), if it is helpful: model schema for table "table" has new incompatible type for field "field"

ahmedosama94 commented 7 years ago

@masumsoft I found the issue to be using FROZEN in uppercase in the set's typeDef, solved the issue by changing ({ type: "set", typeDef: "<FROZEN>" }) to ({ type: "set", typeDef: "<frozen>" }), so the problem turns out to be case insensitivity on schema load on and case sensitivity on schema matching. I hope this is useful.

masumsoft commented 7 years ago

@ahmedosama94 thanks for the update, though I didn't have much time to fix this issue yet, your findings would definitely help dig out the problem faster. Current version 2 milestone has a lot of new things in progress and I'm hopeful it would be resolved soon with the 2.0.0 release. For now use lowercased definitions.