Works fine when adding content types but I can’t seem to add a new content-type to a plugin. Inspecting the DB with DB Browser for SQLite suggests that the table is not being created so I think this is the issue.
The plugin is enabled and I have been running ‘yarn build’ and ‘yarn develop’ from the plugin folder and root of the project.
Any ideas why this isn’t working
This topic has been created from a Discord post (1280481163999318027) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord
You need to register the content type in your strapi-server.ts of the plugin
can you give an example or link to the docs re this?
If you’re talking about exporting the schema and importing that in content-type/index.js and server/index.js, I think I’ve done that
Do you have the code on github?
<@344388867446669315> not on github but as follows
{
"kind": "collectionType",
"collectionName": "bleghs",
"info": {
"singularName": "blegh",
"pluralName": "bleghs",
"displayName": "blegh"
},
"options": {
"draftAndPublish": false,
"comment": ""
},
"attributes": {
"name": {
"type": "string"
}
}
}```
```// plugins/blah/server/content-types/blegh/index.js
'use strict';
const schema = require('./schema');
module.exports = {
schema,
};```
```// plugins/blah/server/content-types/index.js
'use strict';
module.exports = {
// In the line below, replace my-plugin-content-type
// with the actual name and folder path of your content type
"blegh": require('./blegh'),
};```
```// plugins/blah/server/index.js
'use strict';
const register = require('./register');
const bootstrap = require('./bootstrap');
const destroy = require('./destroy');
const config = require('./config');
const contentTypes = require('./content-types');
const controllers = require('./controllers');
const routes = require('./routes');
const middlewares = require('./middlewares');
const policies = require('./policies');
const services = require('./services');
module.exports = {
register,
bootstrap,
destroy,
config,
controllers,
routes,
services,
contentTypes,
policies,
middlewares,
};
<@344388867446669315> Hm so I am now able to get content-type to appear, by running through the creation process on a new plugin. The only difference I can see is that the notification plugin name was the same as a previously existing content type in the root of the project. Even though I’d deleted this it must have been causing some sort of conflict