loopbackio / loopback-connector-cassandra

Cassandra connector for the LoopBack framework.
Other
13 stars 22 forks source link

Default to TEXT. Dropping using VARCHAR #58

Closed shenghu closed 6 years ago

shenghu commented 6 years ago

Description

When defining property in model using 'String' or 'JSON', current code uses VARCHAR as datatype. However cassandra always uses TEXT to define the column. E.g. create table "test" ( id uuid primary key, value VARCHAR); generates table

cqlsh:test> desc table "test";

CREATE TABLE test.test (
    id uuid PRIMARY KEY,
    value text
) WITH bloom_filter_fp_chance = 0.01
...

Thus, when doing autoupdate, loopback-connector-cassandra always thinks there is schema change as the datatype is VARCHAR from model definition while it is TEXT from database.

In Cassandra, varchar is a synonym for text. From https://datastax-oss.atlassian.net/browse/JAVA-402, I think loopback-connector-cassandra should drop using VARCHAR to avoid unnecessary issue like migration.

Also Cassandra dropping support to alter column type today.

Related issues

Checklist

shenghu commented 6 years ago

@jannyHou can you review this PR? Thanks.

shenghu commented 6 years ago

Closed as it is included in PR #59