Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static columns #17

Open
theRemix opened this issue Jun 4, 2015 · 0 comments
Open

Static columns #17

theRemix opened this issue Jun 4, 2015 · 0 comments

Comments

@theRemix
Copy link

theRemix commented Jun 4, 2015

allow columns to be defined as static, example schema:

{
    fields:{
        username: "text",
        id: {
            "type":"uuid",
            "default": {"$db_function": "uuid()"}
        },
        name:{
            "type":"text",
            "static":true
        },
        surname:{
            "type":"text",
            "static":true
        },
        favorites:{
            "type":"text",
            "static":false
        },
        likes:"text",
    },
    key:[["username"],"id"]
}

which would build this table

CREATE TABLE tests.teststaticfields (
    username text,
    id uuid,
    favorites text,
    likes text,
    name text static,
    surname text static,
    PRIMARY KEY (username, id)
) WITH CLUSTERING ORDER BY (id ASC)
...

and produce these columns

 keyspace_name | columnfamily_name | column_name | component_index | index_name | index_options | index_type | type           | validator
---------------+-------------------+-------------+-----------------+------------+---------------+------------+----------------+------------------------------------------
         tests |  teststaticfields |   favorites |               1 |       null |          null |       null |        regular | org.apache.cassandra.db.marshal.UTF8Type
         tests |  teststaticfields |          id |               0 |       null |          null |       null | clustering_key | org.apache.cassandra.db.marshal.UUIDType
         tests |  teststaticfields |       likes |               1 |       null |          null |       null |        regular | org.apache.cassandra.db.marshal.UTF8Type
         tests |  teststaticfields |        name |               1 |       null |          null |       null |         static | org.apache.cassandra.db.marshal.UTF8Type
         tests |  teststaticfields |     surname |               1 |       null |          null |       null |         static | org.apache.cassandra.db.marshal.UTF8Type
         tests |  teststaticfields |    username |            null |       null |          null |       null |  partition_key | org.apache.cassandra.db.marshal.UTF8Type
theRemix added a commit to theRemix/apollo-cassandra that referenced this issue Jun 4, 2015
theRemix added a commit to theRemix/apollo-cassandra that referenced this issue Jun 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant