diff --git a/.circleci/config.yml b/.circleci/config.yml index 9a362f5..704ab90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ workflows: context: dockerhub-deploy requires: - tools/setup - - tools/integrationtest-postgresql-mariadb: + - tools/integrationtest-postgresql-mysql-mssql: context: dockerhub-deploy requires: - tools/setup @@ -33,7 +33,7 @@ workflows: requires: - tools/setup - tools/format - - tools/integrationtest-postgresql-mariadb + - tools/integrationtest-postgresql-mysql-mssql - tools/build - tools/deploy-release: jarname: "datahike-jdbc" @@ -46,5 +46,5 @@ workflows: requires: - tools/setup - tools/format - - tools/integrationtest-postgresql-mariadb + - tools/integrationtest-postgresql-mysql-mssql - tools/build diff --git a/.gitignore b/.gitignore index c21b2df..89b4032 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -pom.xml pom.xml.asc *.jar *.class diff --git a/bin/run-integrationtests b/bin/run-integrationtests index aaa89ad..7398ec9 100755 --- a/bin/run-integrationtests +++ b/bin/run-integrationtests @@ -11,21 +11,29 @@ function setup_PG() { fi } -function setup_MARIA() { +function setup_MYSQL() { if [ -z ${CIRCLECI} ]; then - echo $(docker run --detach --publish 3306:3306 --env MYSQL_RANDOM_ROOT_PASSWORD=true --env MYSQL_DATABASE=config-test --env MYSQL_USER=alice --env MYSQL_PASSWORD=foo docker.io/mariadb:10) + echo $(docker run --detach --publish 3306:3306 --env MYSQL_RANDOM_ROOT_PASSWORD=true --env MYSQL_DATABASE=config-test --env MYSQL_USER=alice --env MYSQL_PASSWORD=foo docker.io/mysql:8) + fi +} + +function setup_MSSQL() { + if [ -z ${CIRCLECI} ]; then + echo $(docker run --detach --publish 1433:1433 --env ACCEPT_EULA=Y --env SA_PASSWORD=passwordA1! --env MSSQL_PID=Developer --env MSSQL_TCP_PORT=1433 mcr.microsoft.com/mssql/server:2019-latest) fi } function teardown() { if [ -z ${CIRCLECI} ]; then docker rm -f ${PG_NAME} - docker rm -f ${MARIA_NAME} + docker rm -f ${MYSQL_NAME} + docker rm -f ${MSSQL_NAME} fi } PG_NAME=$(setup_PG) -MARIA_NAME=$(setup_MARIA) +MYSQL_NAME=$(setup_MYSQL) +MSSQL_NAME=$(setup_MSSQL) sleep 5 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e1bf70e --- /dev/null +++ b/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + io.replikativ + datahike-jdbc + jar + datahike-jdbc + A JDBC backend for Datahike + 0.1.2-SNAPSHOT + https://datahike.io + + + Eclipse + http://www.eclipse.org/legal/epl-v10.html + + + + scm:git:git@github.com:replikativ/datahike-jdbc.git + scm:git:git@github.com/replikativ/datahike-jdbc.git + https://github.com/replikativ/datahike-jdbc + + + + org.clojure + clojure + 1.10.3 + + + io.replikativ + konserve-jdbc + 0.1.1 + + + io.replikativ + superv.async + 0.2.11 + + + + src + + + + clojars + https://repo.clojars.org/ + + + diff --git a/test/datahike_jdbc/core_test.cljc b/test/datahike_jdbc/core_test.cljc index 33477ae..61802e8 100644 --- a/test/datahike_jdbc/core_test.cljc +++ b/test/datahike_jdbc/core_test.cljc @@ -61,6 +61,36 @@ (d/delete-database config) (is (not (d/database-exists? config)))))) +(deftest ^:integration test-mssql + (let [config {:store {:backend :jdbc + :dbtype "sqlserver" + :user "sa" + :password "passwordA1!" + :dbname "tempdb"} + :schema-flexibility :write + :keep-history? false} + _ (d/delete-database config)] + (is (not (d/database-exists? config))) + (let [_ (d/create-database config) + conn (d/connect config)] + (d/transact conn [{:db/ident :name + :db/valueType :db.type/string + :db/cardinality :db.cardinality/one} + {:db/ident :age + :db/valueType :db.type/long + :db/cardinality :db.cardinality/one}]) + (d/transact conn [{:db/id 1, :name "Ivan", :age 15} + {:db/id 2, :name "Petr", :age 37} + {:db/id 3, :name "Ivan", :age 37} + {:db/id 4, :age 15}]) + (is (= (d/q '[:find ?e :where [?e :name]] @conn) + #{[3] [2] [1]})) + + (d/release conn) + (is (d/database-exists? config)) + (d/delete-database config) + (is (not (d/database-exists? config)))))) + (deftest ^:integration test-h2 (let [config {:store {:backend :jdbc :dbtype "h2"