FluentMigrator create index with custom operator - fluent-migrator

Can I express following PostgreSQL statement using Fluent Migrator:
CREATE INDEX index1 ON table1(column1 text_pattern_ops)
Can't seem to have a proper methods?

There is no straight forward way to do it using the Fluent interface. You could probably do it by executing direct native sql via the Execute function.

Related

How can I make sure an object is not in the database using Codeception?

I'm working on a Symfony application and writing some tests using CodeCeption.
I need to make sure some entities are created in the database, for which I need to make sure they don't exist previous to the execution of the method under test.
Is there something like:
$I->dontHaveInRepository($entity)
?
I've checked the docs but didn't find a way to do this.
Thanks!
Codeception assertion methods usually starts with see.
have methods do some setup work, like inserting record to database.
All see methods have dontSee counterparts.
So the method you had been looking for is dontSeeInRepository method of Doctrine2 module

Call java function using XQuery in MarkLogic

Is it possible to call java function using XQuery in MarkLogic. ?
Please refer - https://stackoverflow.com/questions/65953901/calling-java-method-from-xquery
Example -
declare namespace math="java:java.lang.Math";
math:sqrt(2)
There's no way to directly call a Java function from MarkLogic XQuery. If the Java code is accessible through a web service, you can use xdmp:http-get and similar.
As noted by Martin, depending on what functionality you're trying to access, you might not need to use Java.

how to create gremlin custom predicate in javascript

I am trying to create a Regex custom predicate for my query
I am seeing this can be done from the gremlin console as below
f = {x,y -> x ==~ y}
g.V().has('desc',test(f,/^Dal.*/)).values('desc')
however I am wondering how I can create custom predicate in a Javascript client?
I am using npm package (https://www.npmjs.com/package/gremlin) and Typescript.
The example you found works because when working with a local (embedded) graph such as a TinkerGraph you can essentially create custom classes and closures in Java and/or Groovy. You can think of this as extending Gremlin locally.
However, the Gremlin JavaScript client is designed to work with a remote graph. Many hosted graph providers limit or block entirely the use of such code for reasons of security. If you have control over the Gremlin Server you are connecting to or the provider you are using allows for closures/lambdas then you may be able to take advantage of that, see [1].
If you control the Gremlin Server you are using you could potentially just add the scripts that create the custom predicates there in the configuration files. For completeness to help others who find this post I included a link to the discussion on predicates that I believe you are referring to in your question [2].
[1] https://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript-lambda
[2] http://www.kelvinlawrence.net/book/PracticalGremlin.html#pred

Validate EF Code first model against existing database

Is there a way to check that a DbContext matches the database when the database was not created by EF code first?
I am looking for similar functionality to Database.CompatibleWithModel but there is not metadata.
There is currently no way in EF to do this; however, you may be able to use the DDL script as a starting point for verifying that all the artifacts exist in the database. To get this script, use
string ddlScript = ((IObjectContextAdapter)myContext).ObjectContext.CreateDatabaseScript();
Some tools may be able to use this script to do a schema compare against your database. This will tell you if your model is compatible.
Have you tried using Entity Framework Power Tools.
you can use the tools to Reverse Engineer Code First - Generates POCO
classes, derived DbContext and Code First mapping for an existing
database.
And then maybe you can compare the reversed engineered information with what you already have.

Schema generation with Simple.Data?

Is there a way to perform database schema generation with the Simple.Data library (similar to how Fluent NHibernate does it)?
If not, is there a way to run DDL (Data Definition Language) commands against a database via the Simple.Data library?
Currently in some integration tests I am creating a SQL CE database on the fly, auto generating the schema (via Fluent NHibernate), running the tests (accessing the database via Simple.Data), then deleting the database after the tests run (for cleanup).
It would be nice to be able to perform the DDL stuff using Simple.Data and remove the Fluent NHibernate dependency.
I recommend using Fluent Migrator for building DB schema (https://github.com/schambers/fluentmigrator/). It's what Simple.Data migrations would probably look like, so there seems little point reinventing the wheel.
Simple.Data 0.10 will have a new InMemory adapter which is schema-less, to reduce testing friction. Will be out by the end of November.

Resources