deniswsrosa / liquicouch

LiquiCouch is a data migration tool for Java, Scala, Kotlin (or any other JVM lang) inspired by Liquibase
15 stars 2 forks source link

Capabilities #4

Open johnthomas22 opened 4 years ago

johnthomas22 commented 4 years ago

Denis,

Not clear exactly what you can, and cannot, do with LiquiCouch. Maybe the examples could be made clearer by getting them to do some actual work.

For example, how would it call out to a series of couchbase-cli bucket-create and user-manage commands, followed by some cmimport json creating data and cbqs creating indexes?

Regards,

JT

deniswsrosa commented 4 years ago

Hi John,

Right now Liquicouch is a simple repository of all the migrations that have been already executed. Very similar to what Liquibase does.

The code is executed right after your application starts, so you can use the bucket and cluster objects provided by Couchbase SDK to run whatever migrations you need. For instance, to create an index your code could look like the following:

` ... @Autowire private Bucket bucket;

@ChangeSet(order = "1", id = "someChangeId", author = "testAuthor") public void myMigration() { bucket.query(N1qlQuery.simple("CREATE INDEX xyz ON myBucket(userId) WHERE _class = 'com.example.User'")) }

... `

Regarding creating buckets, it will assume that you have at least one bucket where you can first connect. From there you can use the standard API to create a new bucket: cluster.clusterManager().insertBucket(...)

Here is the class: https://docs.couchbase.com/sdk-api/couchbase-java-client-2.4.5/com/couchbase/client/java/cluster/ClusterManager.html#insertBucket-com.couchbase.client.java.cluster.BucketSettings-

There is no feature yet which allows you to automatically load data into couchbase. Thanks for that, that will be the next feature I should work on.

johnthomas22 commented 4 years ago

Thanks Denis. Will run this by my colleagues.

Regards,

John Thomas

On Wed, 27 May 2020 at 18:18, deniswsrosa notifications@github.com wrote:

Hi John,

Right now Liquicouch is a simple repository of all the migrations that have been already executed. Very similar to what Liquibase does.

The code is executed right after your application starts, so you can use the bucket and cluster objects provided by Couchbase SDK to run whatever migrations you need. For instance, to create an index your code could look like the following:

` ... @autowire https://github.com/autowire private Bucket bucket;

@Changeset https://github.com/Changeset(order = "1", id = "someChangeId", author = "testAuthor") public void myMigration() { bucket.query(N1qlQuery.simple("CREATE INDEX xyz ON myBucket(userId) WHERE _class = 'com.example.User'")) }

... `

Regarding creating buckets, it will assume that you have at least one bucket where you can first connect. From there you can use the standard API to create a new bucket: cluster.clusterManager().insertBucket(...)

Here is the class:

https://docs.couchbase.com/sdk-api/couchbase-java-client-2.4.5/com/couchbase/client/java/cluster/ClusterManager.html#insertBucket-com.couchbase.client.java.cluster.BucketSettings-

There is no feature yet which allows you to automatically load data into couchbase. Thanks for that, that will be the next feature I should work on.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/deniswsrosa/liquicouch/issues/4#issuecomment-634814225, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2RGQ6XF2IZQJ6I2ZJAOFLRTVDOVANCNFSM4NMDLVRA .