Skip to content

Conversation

@derrickmehaffy
Copy link
Member

Signed-off-by: Derrick Mehaffy derrickmehaffy@gmail.com

What does it do?

Mirrors functionality of Bookshelf for custom types:

// allow custom data type for a column
if (_.has(attribute, 'columnType')) {
return table.specificType(name, attribute.columnType);
}

Why is it needed?

Custom fields and assigning a field a specific type in the database, such as with this guide

Related issue(s)/PR(s)

N/A reported on slack

Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
@derrickmehaffy derrickmehaffy added issue: enhancement Issue suggesting an enhancement to an existing feature source: core:database Source is core/database package labels Nov 23, 2020
@codecov
Copy link

codecov bot commented Nov 23, 2020

Codecov Report

Merging #8723 (e397b5c) into master (7dadfcc) will decrease coverage by 8.31%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8723      +/-   ##
==========================================
- Coverage   33.65%   25.33%   -8.32%     
==========================================
  Files        1248     1129     -119     
  Lines       13765     9823    -3942     
  Branches     1365      563     -802     
==========================================
- Hits         4632     2489    -2143     
+ Misses       8243     6832    -1411     
+ Partials      890      502     -388     
Flag Coverage Δ
front 25.33% <ø> (ø)
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/strapi-admin/services/metrics.js
...ckages/strapi-generate/lib/helpers/folder/index.js
packages/strapi-generate/lib/generate.js
test/helpers/create-context.js
packages/strapi-plugin-upload/utils/file.js
.../strapi-admin/validation/common-functions/index.js
...ilder/services/schema-builder/component-builder.js
...ackages/strapi-utils/lib/template-configuration.js
packages/strapi-admin/services/user.js
packages/strapi/lib/core-api/controller.js
... and 109 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b6c1e2...979cd4a. Read the comment docs.

@alexandrebodin
Copy link
Member

alexandrebodin commented Nov 23, 2020

columnType is a string and mongoose don't know what to do with it most of the time it needs a constructor. Unless you use a model in pure js and not json it won't be usable. What is the usecase in mongoose ?

@derrickmehaffy
Copy link
Member Author

@alexandrebodin it was related to custom fields (the color picker from that guide I linked) I had someone test it out and it worked for them.

@derrickmehaffy
Copy link
Member Author

Per our convo Alex, they won't be able to pass in the Mongo constructor without breaking the CTB but it could be done via the model.js with the attributes.

Copy link
Member

@alexandrebodin alexandrebodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for the addition :D

@alexandrebodin alexandrebodin added this to the 3.3.4 milestone Nov 25, 2020
@alexandrebodin alexandrebodin merged commit bac867c into master Nov 25, 2020
@alexandrebodin alexandrebodin deleted the mongo/customType branch November 25, 2020 12:54
@derrickmehaffy
Copy link
Member Author

This pull request has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/add-button-as-custom-field/1410/4

andreamarchetti pushed a commit to andreamarchetti/strapi that referenced this pull request Dec 29, 2020
Signed-off-by: Derrick Mehaffy <derrickmehaffy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

issue: enhancement Issue suggesting an enhancement to an existing feature source: core:database Source is core/database package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants