From 12a237b288c827ece345cbc48245164c3e4c57bd Mon Sep 17 00:00:00 2001 From: guzman-raphael Date: Wed, 8 Mar 2023 09:49:10 -0600 Subject: [PATCH 1/6] Use containers.Map over struct for name field flexibility, allow dashes in schema names, escape schema name in creation, update reverse proxy, bump version. --- +dj/+internal/GeneralRelvar.m | 2 +- +dj/Connection.m | 4 ++-- +dj/createSchema.m | 4 ++-- +dj/version.m | 2 +- LNX-docker-compose.yaml | 4 ++-- local-docker-compose.yaml | 4 ++-- tests/Prep.m | 4 ++-- tests/TestSchema.m | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/+dj/+internal/GeneralRelvar.m b/+dj/+internal/GeneralRelvar.m index 24be944b..981ee362 100644 --- a/+dj/+internal/GeneralRelvar.m +++ b/+dj/+internal/GeneralRelvar.m @@ -951,7 +951,7 @@ case isa(cond, 'dj.internal.GeneralRelvar') for j = 1:length(data) if ~isempty(data(j).(attr(i).name)) uuid = reshape(lower(dec2hex(data(j).(attr(i).name))).',1,[]); - data(j).(attr(i).name) = connection.schemas.(... + data(j).(attr(i).name) = connection.schemas(... attr(i).database).external.table(... attr(i).store).download_buffer(uuid); end diff --git a/+dj/Connection.m b/+dj/Connection.m index 94e555f2..3c6f284f 100644 --- a/+dj/Connection.m +++ b/+dj/Connection.m @@ -41,12 +41,12 @@ end self.foreignKeys = struct([]); self.packages = containers.Map; - self.schemas = struct(); + self.schemas = containers.Map; end function register(self, schema) - self.schemas.(schema.dbname) = schema; + self.schemas(schema.dbname) = schema; end function addPackage(self, dbname, package) diff --git a/+dj/createSchema.m b/+dj/createSchema.m index 19d4242a..2ae7255f 100644 --- a/+dj/createSchema.m +++ b/+dj/createSchema.m @@ -14,7 +14,7 @@ function createSchema(package, parentdir, db) if ~dbname disp 'No database name entered. Quitting.' - elseif isempty(regexp(dbname,'^[a-z][a-z0-9_]*$','once')) + elseif isempty(regexp(dbname,'^[a-z][a-z0-9_\-]*$','once')) error(['Invalid database name. Begin with a letter, only lowercase alphanumerical and ' ... 'underscores.']) else @@ -26,7 +26,7 @@ function createSchema(package, parentdir, db) if ~isempty(s.schema_name) disp 'database already exists' else - query(dj.conn, sprintf('create schema %s',dbname)) + query(dj.conn, sprintf('CREATE SCHEMA `%s`',dbname)) disp 'database created' end diff --git a/+dj/version.m b/+dj/version.m index b4b196c9..36a8e9bf 100644 --- a/+dj/version.m +++ b/+dj/version.m @@ -1,7 +1,7 @@ function varargout = version % report DataJoint version -v = struct('major', 3, 'minor', 5, 'bugfix', 0); +v = struct('major', 3, 'minor', 5, 'bugfix', 1); if nargout varargout{1}=v; diff --git a/LNX-docker-compose.yaml b/LNX-docker-compose.yaml index 13c6e09b..db791eb9 100644 --- a/LNX-docker-compose.yaml +++ b/LNX-docker-compose.yaml @@ -1,4 +1,4 @@ -# docker-compose -f LNX-docker-compose.yaml --env-file LNX.env up --exit-code-from app --build +# docker compose -f LNX-docker-compose.yaml --env-file LNX.env up --exit-code-from app --build version: '2.2' x-net: &net networks: @@ -29,7 +29,7 @@ services: interval: 1s fakeservices.datajoint.io: <<: *net - image: datajoint/nginx:v0.1.1 + image: datajoint/nginx:v0.2.4 environment: - ADD_db_TYPE=DATABASE - ADD_db_ENDPOINT=db:3306 diff --git a/local-docker-compose.yaml b/local-docker-compose.yaml index da303d95..b27e7926 100644 --- a/local-docker-compose.yaml +++ b/local-docker-compose.yaml @@ -1,4 +1,4 @@ -# docker-compose -f local-docker-compose.yaml --env-file LNX.env up --build +# docker compose -f local-docker-compose.yaml --env-file LNX.env up --build version: '2.4' x-net: &net networks: @@ -34,7 +34,7 @@ services: interval: 1s fakeservices.datajoint.io: <<: *net - image: datajoint/nginx:v0.1.1 + image: datajoint/nginx:v0.2.4 environment: - ADD_db_TYPE=DATABASE - ADD_db_ENDPOINT=db:3306 diff --git a/tests/Prep.m b/tests/Prep.m index 743879c1..baefe0a5 100644 --- a/tests/Prep.m +++ b/tests/Prep.m @@ -115,8 +115,8 @@ function dispose(testCase) curr_conn.query('SET FOREIGN_KEY_CHECKS=0;'); res = curr_conn.query(['SHOW DATABASES LIKE "' testCase.PREFIX '_%";']); for i = 1:length(res.(['Database (' testCase.PREFIX '_%)'])) - curr_conn.query(['DROP DATABASE ' ... - res.(['Database (' testCase.PREFIX '_%)']){i} ';']); + curr_conn.query(['DROP DATABASE `' ... + res.(['Database (' testCase.PREFIX '_%)']){i} '`;']); end curr_conn.query('SET FOREIGN_KEY_CHECKS=1;'); diff --git a/tests/TestSchema.m b/tests/TestSchema.m index 98820535..5c01861d 100644 --- a/tests/TestSchema.m +++ b/tests/TestSchema.m @@ -100,8 +100,8 @@ function TestSchema_testNew(testCase) % setup dj.config.restore; dj.config('safemode', false); - dj.new('new.Student', 'M', pwd , 'djtest_new'); - rmdir('+new', 's'); + dj.new('new_space.Student', 'M', pwd , 'djtest_new-space'); + rmdir('+new_space', 's'); end function TestSchema_testVirtual(testCase) st = dbstack; From 1ad6da04ebf5ae8992f62599edf98870fdbd5421 Mon Sep 17 00:00:00 2001 From: guzman-raphael Date: Wed, 8 Mar 2023 09:53:14 -0600 Subject: [PATCH 2/6] Add changelog. --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa03919b..20b7fc2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,15 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. +## [3.5.1] - TBD + ++ Bugfix: Allow schemas named with dashes + ## [3.5.0] - 2022-03-21 + Bugfix: Cascading delete for renamed foreign keys (#379) PR #386 + Minor: Add renaming the same attribute multiple times within a single projection PR #386 + Minor: Add config for reading values with 32-bit dimensions (datajoint/mym#86) PR #395 -[3.5.0]: https://github.com/datajoint/element-deeplabcut/releases/tag/3.5.0 +[3.5.1]: https://github.com/datajoint/datajoint-matlab/compare/3.5.0...3.5.1 +[3.5.0]: https://github.com/datajoint/datajoint-matlab/releases/tag/3.50 From 5765643fafd26ec39461bbfe299ce1e6dba09a61 Mon Sep 17 00:00:00 2001 From: guzman-raphael Date: Wed, 8 Mar 2023 09:58:48 -0600 Subject: [PATCH 3/6] Update changelog. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20b7fc2a..f3a0e660 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,5 +13,5 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and + Minor: Add renaming the same attribute multiple times within a single projection PR #386 + Minor: Add config for reading values with 32-bit dimensions (datajoint/mym#86) PR #395 -[3.5.1]: https://github.com/datajoint/datajoint-matlab/compare/3.5.0...3.5.1 -[3.5.0]: https://github.com/datajoint/datajoint-matlab/releases/tag/3.50 +[3.5.1]: https://github.com/datajoint/datajoint-matlab/compare/v3.5.0...v3.5.1 +[3.5.0]: https://github.com/datajoint/datajoint-matlab/releases/tag/v3.5.0 From 14ff5d63d422fbfd74944deaa9934748681e9dfb Mon Sep 17 00:00:00 2001 From: guzman-raphael Date: Wed, 8 Mar 2023 10:11:17 -0600 Subject: [PATCH 4/6] Upload compiled DJ toolbox. --- .github/workflows/development.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/development.yaml b/.github/workflows/development.yaml index 39d2d61c..79508a34 100644 --- a/.github/workflows/development.yaml +++ b/.github/workflows/development.yaml @@ -37,6 +37,12 @@ jobs: COMPOSE_HTTP_TIMEOUT: "120" run: | docker-compose -f LNX-docker-compose.yaml up --build --exit-code-from app + - name: Add toolbox artifact + uses: actions/upload-artifact@v3 + with: + name: dj-toolbox-${{matrix.matlab_version}} + path: DataJoint.mltbx + retention-days: 1 publish-docs: if: | github.event_name == 'push' && From f0c2b7f3b8ded891fa6bcd87fc469250d398f729 Mon Sep 17 00:00:00 2001 From: guzman-raphael Date: Mon, 27 Mar 2023 15:54:38 -0500 Subject: [PATCH 5/6] Update release date. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3a0e660..0e82fe1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. -## [3.5.1] - TBD +## [3.5.1] - 2023-03-27 + Bugfix: Allow schemas named with dashes From b107b46f443445c2a6ce6b6aa0618c8038ee2238 Mon Sep 17 00:00:00 2001 From: guzman-raphael Date: Mon, 27 Mar 2023 16:18:28 -0500 Subject: [PATCH 6/6] Update error message. --- +dj/createSchema.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/+dj/createSchema.m b/+dj/createSchema.m index 2ae7255f..62b649b8 100644 --- a/+dj/createSchema.m +++ b/+dj/createSchema.m @@ -15,8 +15,8 @@ function createSchema(package, parentdir, db) if ~dbname disp 'No database name entered. Quitting.' elseif isempty(regexp(dbname,'^[a-z][a-z0-9_\-]*$','once')) - error(['Invalid database name. Begin with a letter, only lowercase alphanumerical and ' ... - 'underscores.']) + error(['Invalid database name. Valid name must begin with a letter and include ' ... + 'only lowercase alphanumerical, dashes, and underscores.']) else % create database s = query(dj.conn, ...