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..62b649b8 100644 --- a/+dj/createSchema.m +++ b/+dj/createSchema.m @@ -14,9 +14,9 @@ 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.']) + elseif isempty(regexp(dbname,'^[a-z][a-z0-9_\-]*$','once')) + 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, ... @@ -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/.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' && diff --git a/CHANGELOG.md b/CHANGELOG.md index aa03919b..0e82fe1a 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] - 2023-03-27 + ++ 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/v3.5.0...v3.5.1 +[3.5.0]: https://github.com/datajoint/datajoint-matlab/releases/tag/v3.5.0 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;