2018-12-14 17:06:05 +01:00
# Migration guide from alpha.11 to alpha.12
2018-04-20 11:26:28 +02:00
2018-05-14 17:19:43 +02:00
This migration guide is a mix of migrations from 3.0.0-alpha.11.1 to 3.0.0-alpha.11.2, 3.0.0-alpha.11.2 to 3.0.0-alpha.11.3 and from 3.0.0-alpha.11.3 to 3.0.0-alpha.12.1.3.
2018-04-20 11:26:28 +02:00
2018-12-14 17:06:05 +01:00
< br >
::: note
Feel free to [join us on Slack ](http://slack.strapi.io ) and ask questions about the migration process.
:::
2018-04-20 11:26:28 +02:00
2018-12-14 17:06:05 +01:00
< br >
2018-04-20 11:26:28 +02:00
## Getting started
2018-05-14 17:19:43 +02:00
Install Strapi `alpha.12.1.3` globally on your computer. To do so run `npm install strapi@3.0.0-alpha.12.1.3 -g` .
2018-04-20 11:26:28 +02:00
When it's done, generate a new empty project `strapi new myNewProject` (don't pay attention to the database configuration).
2018-12-14 17:06:05 +01:00
< br >
2018-04-20 11:26:28 +02:00
## Configurations
You will have to update just 1 file: `package.json`
2018-05-14 17:19:43 +02:00
- Edit the Strapi's dependencies version: (move Strapi's dependencies to `3.0.0-alpha.12.1.3` version) in `package.json` file
2018-04-20 11:26:28 +02:00
```json
{
"dependencies": {
"lodash": "4.x.x",
2018-05-14 17:19:43 +02:00
"strapi": "3.0.0-alpha.12.1.3",
2018-04-20 11:26:28 +02:00
"strapi-mongoose": "3.0.0-alpha.12"
}
}
```
2018-12-14 17:06:05 +01:00
< br >
2018-04-20 11:26:28 +02:00
## Update the Admin
Delete your old admin folder and replace it by the new one.
2018-12-14 17:06:05 +01:00
< br >
2018-04-20 11:26:28 +02:00
## Update the Plugins
2019-01-06 14:00:04 +01:00
Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` and `/plugins/users-permissions/config/jwt.json` file in the new one.
2018-04-20 11:26:28 +02:00
Then, delete your old `plugins` folder and replace it by the new one.
2018-12-14 17:06:05 +01:00
< br >
2018-04-20 11:26:28 +02:00
## Update roles
2018-12-14 17:06:05 +01:00
::: note
This update is if you come from version before alpha-11.2
:::
2018-04-20 11:26:28 +02:00
Update `type` of `Guest` role to `public` in your database. You can also update name and description:
```json
{
"name": "Public",
"description": "Default role given to unauthenticated user.",
"type": "public"
}
```
Create Authenticated role:
```json
{
"name": "Authenticated",
"description": "Default role given to authenticated user.",
"type": "authenticated"
}
```
In `Users & Permissions > Advanced` in admin panel update default role to `Authenticated`
You also will have to reset your roles permissions.
2018-12-14 17:06:05 +01:00
< br >
2018-04-20 11:26:28 +02:00
### Update bookshelf filters
2018-12-14 17:06:05 +01:00
::: note
2018-10-01 12:19:34 +02:00
This update is if you come from version before alpha-11.3
:::
2018-04-20 11:26:28 +02:00
You will have to replace your `fetchAll` services queries of your generated API:
```js
_.forEach(convertedParams.where, (where, key) => {
if (_.isArray(where.value)) {
for (const value in where.value) {
qb[value ? 'where' : 'orWhere' ](key, where.symbol, where.value[value] )
}
} else {
qb.where(key, where.symbol, where.value);
}
});
if (convertedParams.sort) {
qb.orderBy(convertedParams.sort.key, convertedParams.sort.order);
}
qb.offset(convertedParams.start);
qb.limit(convertedParams.limit);
```
2018-05-14 17:19:43 +02:00
That's all, you have now upgraded to Strapi `alpha.12.1.3` .