Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor 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
perxis
perxis-go
Commits
2530aea7
Commit
2530aea7
authored
2 years ago
by
ko_oler
Browse files
Options
Downloads
Patches
Plain Diff
правки по ПР
parent
868c35fe
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/content/content.go
+1
-1
1 addition, 1 deletion
pkg/content/content.go
pkg/setup/collection.go
+8
-18
8 additions, 18 deletions
pkg/setup/collection.go
with
9 additions
and
19 deletions
pkg/content/content.go
+
1
−
1
View file @
2530aea7
...
@@ -39,7 +39,7 @@ type Content struct {
...
@@ -39,7 +39,7 @@ type Content struct {
}
}
const
(
const
(
DBVersion
uint32
=
3
DBVersion
uint32
=
2
)
)
func
(
c
*
Content
)
RegisterStart
(
svc
interface
{})
{
func
(
c
*
Content
)
RegisterStart
(
svc
interface
{})
{
...
...
This diff is collapsed.
Click to expand it.
pkg/setup/collection.go
+
8
−
18
View file @
2530aea7
...
@@ -138,22 +138,22 @@ func (s *Setup) InstallCollection(ctx context.Context, c CollectionConfig) (setS
...
@@ -138,22 +138,22 @@ func (s *Setup) InstallCollection(ctx context.Context, c CollectionConfig) (setS
return
false
,
err
return
false
,
err
}
}
if
c
.
metadata
!=
nil
{
collection
.
Schema
.
WithMetadata
(
c
.
metadata
...
)
}
if
exist
==
nil
{
if
exist
==
nil
{
setSchema
=
!
collection
.
IsView
()
setSchema
=
!
collection
.
IsView
()
exist
,
err
=
s
.
content
.
Collections
.
Create
(
ctx
,
collection
)
_
,
err
=
s
.
content
.
Collections
.
Create
(
ctx
,
collection
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
}
else
{
}
else
{
var
upd
bool
if
collection
.
Schema
.
Metadata
!=
nil
&&
exist
.
Schema
.
Metadata
[
"extension"
]
!=
collection
.
Schema
.
Metadata
[
"extension"
]
&&
!
s
.
IsForce
()
{
if
c
.
metadata
!=
nil
{
return
false
,
errors
.
Wrap
(
errors
.
Errorf
(
"collection %s has the same id(%s) as extension's collection %s"
,
exist
.
Name
,
exist
.
ID
,
collection
.
Name
),
"fail to update collection"
)
collection
.
Schema
.
WithMetadata
(
c
.
metadata
...
)
err
=
s
.
checkSchemaMetadata
(
collection
,
exist
)
if
err
!=
nil
{
return
false
,
err
}
}
}
var
upd
bool
collection
,
upd
,
setSchema
=
c
.
UpdateFn
(
s
,
exist
,
c
.
collection
)
collection
,
upd
,
setSchema
=
c
.
UpdateFn
(
s
,
exist
,
c
.
collection
)
if
upd
{
if
upd
{
if
err
=
s
.
content
.
Collections
.
Update
(
ctx
,
collection
);
err
!=
nil
{
if
err
=
s
.
content
.
Collections
.
Update
(
ctx
,
collection
);
err
!=
nil
{
...
@@ -172,16 +172,6 @@ func (s *Setup) InstallCollection(ctx context.Context, c CollectionConfig) (setS
...
@@ -172,16 +172,6 @@ func (s *Setup) InstallCollection(ctx context.Context, c CollectionConfig) (setS
return
setSchema
,
nil
return
setSchema
,
nil
}
}
// checkSchemaMetadata проверяет изменилось ли значение Metadata в схеме коллекции
func
(
s
*
Setup
)
checkSchemaMetadata
(
collection
*
collections
.
Collection
,
exist
*
collections
.
Collection
)
error
{
if
collection
.
Schema
.
Metadata
!=
nil
{
if
exist
.
Schema
.
Metadata
[
"extension"
]
!=
collection
.
Schema
.
Metadata
[
"extension"
]
&&
!
s
.
IsForce
()
{
return
errors
.
WithHint
(
errors
.
New
(
"fail to update collection"
),
"collection has the same id as extension's collection, change yours collection id"
)
}
}
return
nil
}
func
(
s
*
Setup
)
CheckCollections
(
ctx
context
.
Context
)
error
{
func
(
s
*
Setup
)
CheckCollections
(
ctx
context
.
Context
)
error
{
if
len
(
s
.
Collections
)
==
0
{
if
len
(
s
.
Collections
)
==
0
{
return
nil
return
nil
...
...
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