Skip to content

Commit

Permalink
v8.0.0-rc.1
Browse files Browse the repository at this point in the history
* Issue Fix directus#1180 (directus#1183)

* Issue fix directus#1191 (directus#1192)

* Issue fix directus#1196 (directus#1197)

* Add 2fa authentication (directus#1031)

* Parent + Nested validation changes (directus#1138)

* Add migration schema for 2FA Secret user field

* Add 2fa_secret field to FieldsSeeder

* Create Missing 2FA Password Exception

* Add googleauthenticator dependency

* Add getter for User's 2FA secret

* Check for otp param in login request, and login with it

* Add enforce_2fa parameter to directus_settings

* Create Utils endpoint and service method to generate 2fa secret

* Add enforce_2fa field to roles

* Add enforce_2fa field to FieldsSeeder

* Change Missing2FAPasswordException error code to 111

* Change 2FA Library

* Change 2fa_secret interface in FieldsSeeder

* Created exception for invalid otp

* Changed findUserWithCredentials to through an InvalidOTPException on otp check

* Created new exception if 2fa is enforced but not enabled by user

* Added function to check if 2fa is enforced for a user

* Check in AuthenticationMiddleware whether 2fa is enforced and enabled for user

* Add optional needs2FA field to auth token and on token refresh

* Catch error if enforce_2fa column doesn't exist
Fixes crash when has2FAEnforced is called on a DB that hasn't been migrated

* Use relative positions for target path array to check user edit

* Fix unset on payload_arr instead of payload

* Change 2FA activation on login to use activate2FA endpoint

* Update ItemsService.php

* Issue Fix directus#1194 (directus#1195)

* Issue Fix directus#1194

* Update comment

* Valildation issue of O2M/M2O at insertion (directus#1198)

* Fox directus#1201 (directus#1202)

* Fix directus#1203 (directus#1204)

* Update collections() method in types.php (directus#1184)

There are cases when $type is not a string but an object that inherits from ObjectType.
In that situation array_key_exists failing because it should get only integers or strings 
as a first parameter. So in order to avoid that the 'name' property of the object is used 
as a key.

* Improve YouTube Embed Provider (directus#1210)

Adds in detection and parsing for youtu.be shorthand URLs.

* Add check for environment on bootstrap (directus#1215)

* Fix directus#1186 [Create new error code for invalid login entity] (directus#1218)

* Fix directus#1217 (Changing password over the CLI doesn't work) (directus#1220)

* Feature/audio video upload (directus#1214)

* added file meta data for audio/video

* updates as per PR feedback

* Fix directus#1207 [Permission denied issue  when using translation interface] (directus#1221)

* Fix for smtp send mail issue directus#1205 (directus#1223)

* Fix for smtp send mail issue directus#1205

Missing additional config settings
directus#1205

* Update Schema.php

* Fix 1232[Auth token is not refreshed] (directus#1233)

* Change Authencation Error code to 114 from 109 (directus#1231)

* Fix issue while update item. (directus#1224)

* directus#1227 : Ignore all the alias fields except file interface (directus#1240)

* Fix directus#1224 [Deletion of m2o/o2m field error for enabled cache] (directus#1241)

* Fix 845 (directus#1244)

* Change namespace for PHPUnit.

* Removing old tests.

* Fix directus#1238 [PDF support for Embedded URL] (directus#1245)

* Fix directus#1238[PDF support for Embedded URL]

* Add array support

* Update comment

* Update Files.php

* Fix directus#1243[Dynamic charset for DB] (directus#1246)

* Fix directus#1249[saveData: height is set to width] (directus#1251)

* Fix directus#2017[Renaming `Public` role gives `unauthorized` error on API calls] (directus#1253)

* Revert "Fix directus#2017[Renaming `Public` role gives `unauthorized` error on API calls] (directus#1253)" (directus#1254)

This reverts commit 7fe9056.

* FIX/core/Directus/Files.php: return $height instead of $width (directus#1250)

* Fix directus#1255 [Add support of batch Create/Update/Delete for user] (directus#1257)

* Fix directus#1255 [Support batch create/update/delete for user]

* Add exception

* Fix directus/app#2017 (directus#1256)

* Fix directus#2017[Renaming `Public` role gives `unauthorized` error on API calls]

* src

* Remove unwanted file from use

* Fix directus#729 [Can't properly query nested fields on Files field] (directus#1260)

* directus#1216 : Solved issue in O2M relationship of table itself (directus#1259)

* Fix directus#1209 [M2M relation with directus_collections cant be saved] (directus#1261)

* Fix directus#1209[M2M relation with directus_collections cant be saved]

* Implement condition on update

* Define variable

* Fix directus#1209[M2M relation with directus_collections cant be saved]

* 🙆🏻‍♂️

* Fix directus#1266 (directus#1267)

* Fix Warning:  Cannot use a scalar value as an array in /src/core/Directus/Config/StatusMapping.php on line 103 (directus#1268)

* Fix Notice: Undefined variable: filterFields in src/core/Directus/Database/TableGateway/RelationalTableGateway.php on line 2125 (directus#1270)

* Fix  directus#1237 (directus#1265)

* Project name fix (directus#1272)

* Adds support for environment variables in CLI (directus#1276)

* Cleans up some unused/deprecated files in the repository (directus#1277)

* Fix directus#1248 [API cannot go into deeper on user data] (directus#1282)

* Add proper exit codes for CLI (directus#1281)

* Fix cache.enabled not respected in cache service (directus#1273)

This fixes an issue where cache.enabled is false but caching is still working.

* Add CLI cache:clear (directus#1274)

* Fix directus#1284[Broken user related fields] (directus#1287)

* Fix directus#1279 [wysiwyg-full - add image - Call to a member function isOneToMany() on null] (directus#1288)

* fixed bug with incorrect height (directus#1293)

* Execute migrations automatically (directus#1296)

* Remove middleware for register webhook and add it before registeration of hooks

* Need to add middleware for directory dependency

* Fix directus#1302 - Internal server error when selecting/checking a Checkbox Relational field after deleting some of the related items (directus#1307)

* Fix directus#1308 - Checkbox-relational field issue when unchecking value (directus#1309)

* Fix directus#1308 - Checkbox-relational field issue when unchecking value

* Update RelationalTableGateway.php

* Add Aliyun OSS settings to config schema (directus#1299)

* Extend config schema to support PDO options. (directus#1295)

* Extend config schema to support PDO options.

* Make driver_options database config setting optional.

* Replcae  with getQueryParams method of slim (directus#1313)

* Fix Undefined Variable - /src/core/Directus/Console/Common/Setting.php on line 24 (directus#1314)

* Replace  with getQueryParams method of slim (directus#1317)

* Fix response data contains json object instead of array (directus#1318)

* Fix directus#1310[Resolve issue with updatingNestd m2o/o2m/m2m] (directus#1320)

* Fix directus#1321 [Resolve bug with system date and system user validation] (directus#1322)

* Resolve Authentication token issue after upgrade to 2.6.0 (directus#1326)

* Fix directus#1329 [Add new fields to / endpoint] (directus#1332)

* Fix directus#1329

* Fix directus#1329 [Add new fields to / endpoint]

* fix issue directus#1330 (directus#1331)

* Rename color with project_color key (directus#1334)

* Fix directus#1333 [Return Unauthorised when public role not have the respected permission] (directus#1336)

* Fix directus#1333 [Return Unauthorized when public role not have the respected permission

* Add comment

* Session-based auth flow along with kill functionality (directus#1280)

* Fix directus#1263[Rethink Auth Flow]

* Kill User Session

* Add Expiry time

* Expire and cookie

* Auth Flow - Modify code base

* Resolve browser cache remove issue

* Remove PHPSESSIONID reset code

* Cookie name based on projject name, Merge authentication endpoint

* Support of mode in sso

* Add seeder into migrations

* Remove warning of container

* Add required flag for user in fields table from migrations

* Add endpoint to fetch the user's session

* Update user's session to loggedin user session endpoint

* Allow cross origin cookie

* Set credentials response header dynamically

* Fix empty FK - do not continue if FK is empty, otherwise, it will not display the entry as if it was not saved. (directus#1342)

* Fix directus#1343 [Update directus_files field type] (directus#1346)

* fix parsing env variables (directus#1347)

* Fix CORS issue for system endpoint (directus#1352)

* Fix directus#1348 (directus#1353)

* Fix wrong chache naming. (directus#1354)

* Fix issue when deleting a file and saving the item (directus#1360)

* Fix directus#1359 [Pagination not working] (directus#1362)

* fix readme ( branch to submit PRs "master" -> "develop") (directus#1365)

* Ignore ddev config folder

* Fix unaccessible public endpoints (directus#1367)

* Fix CORS origin * for public preflight endpoints (directus#1369)

* add gitpod.io support (directus#1356)

* Add requires2FA flag at / endpoint (directus#1370)

* Set default value if the value is not set (directus#1373)

* CORS issue for public endpoint (directus#1374)

* Fix Warning:  Illegal string offset 'field' in src/endpoints/Settings.php on line 89 when query param contains single=1 (directus#1375)

* Fix Warning:  Illegal string offset 'field' in src/endpoints/Settings.php on line 89 when query param contains single=1

* Update Settings.php

* Resolve undefined class ArrayUtils error

* Fetch single sign on providers

* style updates (directus#1382)

* Update withHeaders + add note

* Fix directus#1384 [Remove entries from directus_relations on delete the collection] (directus#1386)

* Fix directus#1381 [Throwing 500 response code on mail sending fail] (directus#1387)

* Fix directus#1329 [Update the name of variable from settings table] (directus#1389)

* Fix directus#1329 [Update the name of variable from settings table]

* Update comment

* Fix the general settings schema upgrade - consider the new installation as well with already existing fields (directus#1391)

* New project flow (directus#1399)

* Replace migrations file from config folder to migrations folder

* Return the project list

* Remove unwanted code

* Projects endpoint

* Remove unwanted code

* Remove unwanted code

* Remove unwanted code

* Remove default _ for secretkey and newtimzone function of datetimeutil

* Check requirement endpoint (directus#1398)

* Check requirement endpoint

* Add  endpoint

* Update ProjectService.php

* Don't verify super admin with hashing

* Remove warning of non static method 'createJsonFileContent' for project create

* Remove _ as private flas (directus#1403)

* Remove password_verfiy and add equals operator

* Fix integrity constraint (directus#1400)

* Update 2FA flow to work with cookies

Squashed commit of the following:

commit a543c44
Author: rijkvanzanten <[email protected]>
Date:   Fri Nov 8 16:20:45 2019 -0500

    Use correct response format for 2fa util

commit ab06c55
Author: rijkvanzanten <[email protected]>
Date:   Fri Nov 8 15:42:35 2019 -0500

    Rename activate2FA to activate_2fa and allow `me` for user updates

commit 7b429ab
Author: Binal Gajjar <[email protected]>
Date:   Fri Nov 8 22:46:30 2019 +0530

    Set NULL if data array is empty

commit c5c7bf6
Author: Binal Gajjar <[email protected]>
Date:   Fri Nov 8 22:37:17 2019 +0530

    Remove needs2FA param from authtoken

commit 5b4b21a
Author: Binal Gajjar <[email protected]>
Date:   Fri Nov 8 22:35:41 2019 +0530

    Throw error if 2FA is not enabled

* clearer existing install response

* update error message

* Fix directus#1380 [Set default requires2FA flag] (directus#1388)

* Redirect the users to /admin in sso (directus#1407)

* Redirect the users to /admin in sso

*  2FA flow for SSO

* Remove unwanted file from use statement

* Default to UTC timezone on new project installs (when there's no config)

* update sso icon colors

* Update the size of token field

* Update the size of token field

* Update the size of static token

* Resolve redirection to /admin? 

Resolve redirection to `/admin?` instead of `/admin`

* Add missing 2fa secret column in seeds

* Throw exception for SSO (directus#1411)

* Redirect the users to /admin in sso

*  2FA flow for SSO

* Remove unwanted file from use statement

* Throw the exception when 2FA enforced or enabled

* Fix 2fa column

* Fix 2fa column

* Ignore the files which start with _

* Restrict private and _ project from listing (directus#1415)

* Restrict private files from listing

* Return the filename instead of projectname from scan funciton

* Add a validation of boolean to private flag.

* Fix directus#1395[/server/ping should ignore project] (directus#1416)

* Update error code for unknown project exception

* Update FieldsConfig.php (directus#1413)

Without this fix the GrapQL query brings values only in case when the M2M field has exactly the same name as the related collection. It can be ok, but for cases when it's required to have mutliple M2M fields pointing to the same collection, (e.g. there 2 collections  - games and tags, and so we need to specify Primary and Secondary tags for each game). So with current implementation we cannot create primaryTags and secondaryTag fields, we should use 'tags' field instead, but its only one, and we need 2. So this fix obtaining fieldName from parameters and using it for relation and not a collection name.

* Remove unwanted files (directus#1421)

* V8.0.0 (directus#1414)

* Redirect to correct endpoint for app

* Redirect to admin based on relative url (works in sub-folder)

* Update request / reset password to be all app based

* Add trailing slash to admin redirect

* Add project key to reset password

* Restrict private and _ project from listing (directus#1415)

* Restrict private files from listing

* Return the filename instead of projectname from scan funciton

* Add a validation of boolean to private flag.

* Add redirect_url param

* update settings seeder to contain all default options

* public role description

* relations alpha order

* Fix false positive in sso 2fa block

* add enforce_2fa to roles

* activity seeder updates

icons and widths

* seeder for directus files

need to check “description” options array format

* directus settings seeder updates

* Add support for webhooks

Squashed commit of the following:

commit ce6ffac
Merge: 667d960 e0630e8
Author: rijkvanzanten <[email protected]>
Date:   Tue Nov 12 11:51:19 2019 -0500

    Merge branch 'develop' into webhooks

commit 667d960
Merge: be83925 557a83b
Author: rijkvanzanten <[email protected]>
Date:   Tue Nov 12 11:17:11 2019 -0500

    Merge branch 'v8.0.0' into webhooks

commit be83925
Merge: f51c51a 41fd0b6
Author: rijkvanzanten <[email protected]>
Date:   Tue Nov 12 11:17:07 2019 -0500

    Merge branch 'develop' into webhooks

commit 557a83b
Author: rijkvanzanten <[email protected]>
Date:   Tue Nov 12 10:54:13 2019 -0500

    Fix false positive in sso 2fa block

commit 0989b31
Author: Ben Haynes <[email protected]>
Date:   Tue Nov 12 10:49:54 2019 -0500

    relations alpha order

commit 8f15ad6
Author: Ben Haynes <[email protected]>
Date:   Tue Nov 12 10:49:42 2019 -0500

    public role description

commit 555ba2f
Author: Ben Haynes <[email protected]>
Date:   Tue Nov 12 10:46:22 2019 -0500

    update settings seeder to contain all default options

commit 9816a4a
Author: Binal Gajjar <[email protected]>
Date:   Tue Nov 12 20:41:54 2019 +0530

    Add redirect_url param

commit 3ba3708
Merge: 379457d 0629167
Author: Binal Gajjar <[email protected]>
Date:   Tue Nov 12 20:30:11 2019 +0530

    Merge branch 'v8.0.0' of https://github.com/directus/api into v8.0.0

commit 0629167
Author: rijkvanzanten <[email protected]>
Date:   Mon Nov 11 18:33:17 2019 -0500

    Add project key to reset password

commit 2bcd474
Author: rijkvanzanten <[email protected]>
Date:   Mon Nov 11 18:33:05 2019 -0500

    Add trailing slash to admin redirect

commit 4a0ccf6
Author: rijkvanzanten <[email protected]>
Date:   Mon Nov 11 16:13:34 2019 -0500

    Update request / reset password to be all app based

commit e42fbf9
Author: rijkvanzanten <[email protected]>
Date:   Mon Nov 11 16:13:05 2019 -0500

    Redirect to admin based on relative url (works in sub-folder)

commit 9f24d50
Author: rijkvanzanten <[email protected]>
Date:   Mon Nov 11 15:17:59 2019 -0500

    Redirect to correct endpoint for app

commit f51c51a
Author: Binal Gajjar <[email protected]>
Date:   Fri Nov 8 22:44:15 2019 +0530

    Webhook Implementation (directus#1304)

    * Webhook implementation

    * Webhook development

    * Fix 29

    * Register the webhook

    * Webhook seed transfer into migrations

    * Update default seeder

    * Update comment

    * Update comment

    * Add Status Field

* directus users seeds

* remove unused seeder data

* missing comma

* Added missing comma

* settings defaults

* setup telemetry and default locale

* Remove directus activity seen table (directus#1422)

* Remove directus activity seen

* Revert back the activity seen field from upgrades

* webhooks seeds

* webhooks update

* Rename webhook draft->inactive published->active + delete deleted

* update webhooks schema migrations

* webhooks url placeholder

* Use collections interface for collection chooser on webhooks

* webhooks info

* Don't enforce user.locale to be set

* Bump version

* hide dividers on browse

* nice defaults for webhooks layout

* better webhooks layout

* Revert "Fix issue when deleting a file and saving the item (directus#1360)" (directus#1423)

This reverts commit 37ef295.

* Revert "Fix the general settings schema upgrade - consider the new installation as well with already existing fields (directus#1391)" (directus#1424)

This reverts commit 483e065.

* Update the current migrations for remove unwanted code and update the icons (directus#1425)
  • Loading branch information
rijkvanzanten authored Nov 13, 2019
1 parent fcc9e7a commit a5ab1a8
Show file tree
Hide file tree
Showing 85 changed files with 3,684 additions and 497 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Icon
*.log
.cache
.vscode
.ddev

# Ignore dev files
/.idea
Expand All @@ -23,8 +24,6 @@ deploy.*

# Ignore configuration files
/config/*
!/config/migrations.php
!/config/migrations.upgrades.php
!/config/api_sample.php

# PHPUnit
Expand Down Expand Up @@ -69,4 +68,4 @@ deploy.*
public/cliserver.php

# Cache generated while filesystem adapter
/cache/*
/cache/*
36 changes: 36 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
image: gitpod/workspace-mysql

tasks:
- init: >
composer install &&
cp config/api_sample.php config/api.php &&
echo "downloading demo database..." &&
curl https://directus.github.io/demo-sql/demo.sql > demo.sql &&
echo "please wait while demo database (demo.sql) is being imported..." &&
mysql -u root < gitpod-helper.sql &&
mysql -u root -p'root' directus < demo.sql &&
rm demo.sql
command: >
apachectl start &&
echo "######################################################################################################" &&
echo "# " &&
echo "# Your Directus Backend is now running! You can access it with a Directus App by the following url:" &&
echo "# " &&
echo "# $GITPOD_WORKSPACE_URL/_/" | sed -e 's/https:\/\//https:\/\/8001-/g' &&
echo "# " &&
echo "# Username: [email protected] Password: password" &&
echo "# " &&
echo "# " &&
echo "# Quick access to Directus frontend app (choose 'other' in the api dropdown):" &&
echo "# " &&
echo "# Either use: https://directus.app/ " &&
echo "# or" &&
echo "# start a Directus App workspace: https://gitpod.io#https://github.com/directus/app" &&
echo "# " &&
echo "######################################################################################################"
ports:
- port: 8001

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,16 @@ Directus is a GPLv3-licensed open source project with development made possible

### Contributing

We love pull-requests! To work on Directus you'll need to install it locally from source by following the instructions below. Submit all pull-requests to the `master` branch of our `api` and `app` repositories.
We love pull-requests! To work on Directus you'll need to install it locally from source by following the instructions below. Submit all pull-requests to the `develop` branch of our `api` and `app` repositories.

* [Setup API Development Environment](https://docs.directus.io/advanced/source.html#api-source)
* [Setup App Development Environment](https://docs.directus.io/advanced/source.html#application-source)

If you want to dive right into the code and skip the manual setup of your development environment you can also spin up fully functional browser based development environments with a single click:

* [Start API Gitpod Workspace](https://gitpod.io/#https://github.com/directus/api)
* [Start APP Gitpod Workspace](https://gitpod.io/#https://github.com/directus/app)

### Sponsors

[RANGER Studio](http://rangerstudio.com), Bas Jansen
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"require": {
"php": "^7.1",
"slim/slim": "^3.0.0",
"slim/slim": "^3.12.2",
"monolog/monolog": "^1.23.0",
"zendframework/zend-db": "dev-directus",
"league/flysystem": "^1.0",
Expand Down Expand Up @@ -41,7 +41,8 @@
"ext-gd": "*",
"webonyx/graphql-php": "^0.13.0",
"char0n/ffmpeg-php": "^3.0.0",
"pragmarx/google2fa": "^5.0"
"pragmarx/google2fa": "^5.0",
"guzzlehttp/guzzle": "~6.0"
},
"suggest": {
"paragonie/random_compat": "Generates cryptographically more secure pseudo-random bytes",
Expand Down
5 changes: 5 additions & 0 deletions config/api_sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
// When using unix socket to connect to the database the host attribute should be removed
// 'socket' => '/var/lib/mysql/mysql.sock',
'socket' => '',
// Connect over TLS by using the appropriate PDO_MySQL constants:
// https://www.php.net/manual/en/ref.pdo-mysql.php#pdo-mysql.constants
//'driver_options' => [
// PDO::MYSQL_ATTR_SSL_CAPATH => '/etc/ssl/certs',
//]
],

'cache' => [
Expand Down
3 changes: 3 additions & 0 deletions gitpod-helper.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE DATABASE IF NOT EXISTS directus;
USE directus;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');
4 changes: 4 additions & 0 deletions migrations/db/schemas/20180220023217_create_roles_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public function change()
'null' => true,
'default' => null
]);
$table->addColumn('enforce_2fa', 'boolean', [
'null' => true,
'default' => false
]);

$table->addIndex('name', [
'unique' => true,
Expand Down
9 changes: 8 additions & 1 deletion migrations/db/schemas/20180220023248_create_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function change()
$table->addColumn('locale', 'string', [
'limit' => 8,
'null' => true,
'default' => 'en-US'
'default' => null
]);
$table->addColumn('locale_options', 'text', [
'null' => true,
Expand Down Expand Up @@ -107,6 +107,13 @@ public function change()
'default' => null
]);

$table->addColumn('2fa_secret', 'string', [
'limit' => 100,
'encoding' => 'utf8',
'null' => true,
'default' => null
]);

$table->addIndex('email', [
'unique' => true,
'name' => 'idx_users_email'
Expand Down
76 changes: 76 additions & 0 deletions migrations/db/schemas/20190912072543_create_user_sessions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php


use Phinx\Migration\AbstractMigration;

class CreateUserSessions extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('directus_user_sessions', ['signed' => false]);

$table->addColumn('user', 'integer', [
'signed' => false,
'null' => true,
'default' => null
]);

$table->addColumn('token_type', 'string', [
'null' => true,
'default' => null
]);

$table->addColumn('token', 'string', [
'limit' => 520,
'encoding' => 'utf8',
'null' => true,
'default' => null
]);

$table->addColumn('ip_address', 'string', [
'limit' => 255,
'encoding' => 'utf8',
'null' => true,
'default' => null
]);

$table->addColumn('user_agent', 'text', [
'default' => null,
'null' => true,
'default' => null
]);

$table->addColumn('created_on', 'datetime', [
'null' => true,
'default' => null
]);

$table->addColumn('token_expired_at', 'datetime', [
'null' => true,
'default' => null
]);

$table->create();
}
}
68 changes: 68 additions & 0 deletions migrations/db/schemas/20190917090849_create_web_hooks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php


use Phinx\Migration\AbstractMigration;

class CreateWebHooks extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('directus_webhooks', ['signed' => false]);

$table->addColumn('status', 'string', [
'limit' => 16,
'default' => \Directus\Api\Routes\Webhook::STATUS_INACTIVE
]);


$table->addColumn('http_action', 'string', [
'limit' => 255,
'encoding' => 'utf8',
'null' => true,
'default' => null
]);

$table->addColumn('url', 'string', [
'limit' => 510,
'encoding' => 'utf8',
'null' => true,
'default' => null
]);

$table->addColumn('collection', 'string', [
'limit' => 255,
'null' => true,
'default' => null
]);

$table->addColumn('directus_action', 'string', [
'limit' => 255,
'encoding' => 'utf8',
'null' => true,
'default' => null
]);

$table->create();
}
}
21 changes: 20 additions & 1 deletion migrations/db/seeds/CollectionPresetsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public function run()
$data = [
[
'collection' => 'directus_activity',
'view_type' => 'tabular',
'view_type' => 'timeline',
'view_query' => json_encode([
'timeline' => [
Expand Down Expand Up @@ -57,6 +56,26 @@ public function run()
'icon' => 'person'
]
])
],
[
'collection' => 'directus_webhooks',
'view_type' => 'tabular',
'view_query' => json_encode([
'tabular' => [
'fields' => 'status,http_action,url,collection,directus_action'
]
]),
'view_options' => json_encode([
'tabular' => [
'widths' => [
'status' => 32,
'http_action' => 72,
'url' => 200,
'collection' => 200,
'directus_action' => 200
]
]
])
]
];

Expand Down
Loading

0 comments on commit a5ab1a8

Please sign in to comment.