Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-mysqlbackend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-mysqlbackend
Commits
1b9eea03
Verified
Commit
1b9eea03
authored
Sep 13, 2020
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
426e8bcd
No related branches found
No related tags found
1 merge request
!12
DRAFT: ENH: file system: core
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
patches/patch20200623-3.0.0rc2/patch.sh
+0
-44
0 additions, 44 deletions
patches/patch20200623-3.0.0rc2/patch.sh
patches/patch20200623-3.0.0rc2/patch.sql
+0
-72
0 additions, 72 deletions
patches/patch20200623-3.0.0rc2/patch.sql
with
0 additions
and
116 deletions
patches/patch20200623-3.0.0rc2/patch.sh
deleted
100755 → 0
+
0
−
44
View file @
426e8bcd
#!/bin/bash
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# ** end header
#
# Refactors the entities table and move all names to name_data
# Update mysql schema to version v3.0.0-rc1
NEW_VERSION
=
"v3.0.0-rc2"
OLD_VERSION
=
"v3.0.0-rc1"
if
[
-z
"
$UTILSPATH
"
]
;
then
UTILSPATH
=
"../utils"
fi
.
$UTILSPATH
/patch_header.sh
$*
check_version
$OLD_VERSION
mysql_execute_file
$PATCH_DIR
/patch.sql
update_version
$NEW_VERSION
success
This diff is collapsed.
Click to expand it.
patches/patch20200623-3.0.0rc2/patch.sql
deleted
100644 → 0
+
0
−
72
View file @
426e8bcd
-- USE _caosdb_schema_unit_tests;
-- REMOVE SQLITE datatype
DELETE
FROM
name_data
WHERE
entity_id
=
50
;
DELETE
FROM
entities
WHERE
id
=
50
;
ALTER
TABLE
files
ADD
UNIQUE
(
`path`
);
ALTER
TABLE
files
ADD
COLUMN
IF
NOT
EXISTS
(
mimetype
VARBINARY
(
255
)
DEFAULT
NULL
,
fileStorage
VARBINARY
(
255
)
NOT
NULL
DEFAULT
"DEFAULT"
,
storageId
VARBINARY
(
255
)
DEFAULT
NULL
);
ALTER
TABLE
entities
MODIFY
COLUMN
`role`
enum
(
'RECORDTYPE'
,
'RECORD'
,
'FILE'
,
'DOMAIN'
,
'PROPERTY'
,
'DATATYPE'
,
'ROLE'
,
'QUERYTEMPLATE'
,
'DIRECTORY'
)
COLLATE
utf8_unicode_ci
NOT
NULL
;
INSERT
INTO
entities
(
id
,
description
,
role
,
acl
)
VALUES
(
9
,
"The directory role."
,
"ROLE"
,
0
);
INSERT
INTO
name_data
(
domain_id
,
entity_id
,
property_id
,
value
,
status
,
pidx
)
VALUES
(
0
,
9
,
20
,
"DIRECTORY"
,
"FIX"
,
0
);
UPDATE
files
SET
storageId
=
path
;
ALTER
TABLE
files
MODIFY
COLUMN
storageId
VARBINARY
(
255
)
NOT
NULL
;
DROP
PROCEDURE
IF
EXISTS
_create_dirs
;
DELIMITER
//
CREATE
PROCEDURE
_create_dirs
()
BEGIN
DECLARE
done
BOOLEAN
DEFAULT
FALSE
;
DECLARE
_file_id
INT
UNSIGNED
DEFAULT
NULL
;
DECLARE
_path
VARCHAR
(
255
)
DEFAULT
NULL
;
DECLARE
dir_id
INT
UNSIGNED
DEFAULT
NULL
;
DECLARE
dir_path
VARCHAR
(
255
)
DEFAULT
""
;
DECLARE
dir_exists
BOOLEAN
DEFAULT
FALSE
;
DECLARE
cur
CURSOR
FOR
SELECT
file_id
,
path
FROM
files
;
DECLARE
CONTINUE
HANDLER
FOR
NOT
FOUND
SET
done
=
TRUE
;
OPEN
cur
;
loop1
:
LOOP
FETCH
cur
INTO
_file_id
,
_path
;
IF
done
THEN
LEAVE
loop1
;
END
IF
;
-- TODO
loop2
:
LOOP
SELECT
REGEXP_SUBSTR
(
_path
,
CONCAT
(
"(?U)^"
,
dir_path
,
".*/"
))
INTO
dir_path
;
IF
dir_path
=
""
THEN
SET
dir_exists
=
FALSE
;
SET
done
=
FALSE
;
LEAVE
loop2
;
END
IF
;
SELECT
TRUE
INTO
dir_exists
FROM
files
WHERE
path
=
LEFT
(
dir_path
,
CHAR_LENGTH
(
dir_path
)
-
1
);
IF
dir_exists
IS
TRUE
THEN
SET
dir_exists
=
FALSE
;
ITERATE
loop2
;
END
IF
;
INSERT
INTO
entities
(
description
,
role
,
acl
)
VALUES
(
NULL
,
NULL
,
"DIRECTORY"
,
0
);
SET
dir_id
=
LAST_INSERT_ID
();
INSERT
INTO
files
(
file_id
,
path
,
size
,
hash
,
checked_timestamp
,
mimetype
,
fileStorage
,
storageId
)
VALUES
(
dir_id
,
LEFT
(
dir_path
,
CHAR_LENGTH
(
dir_path
)
-
1
),
0
,
NULL
,
0
,
"inode/directory"
,
"DEFAULT"
,
LEFT
(
dir_path
,
CHAR_LENGTH
(
dir_path
)
-
1
));
END
LOOP
;
END
LOOP
;
CLOSE
cur
;
END
//
DELIMITER
;
CALL
_create_dirs
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment