From bf6fb107a45e201d2ee0f1c2ef701b64fc20f674 Mon Sep 17 00:00:00 2001 From: Evan Sharp Date: Sat, 12 Apr 2025 10:42:14 -0700 Subject: [PATCH 1/2] Add to migrations and update docs. Addresses #186. --- docs/install.md | 2 ++ .../Migrations/2022-10-20-182737_ShieldOAuth.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/install.md b/docs/install.md index 791d23a..8b1c365 100644 --- a/docs/install.md +++ b/docs/install.md @@ -53,6 +53,8 @@ Therefore, you can add `first_name`, `last_name`, and `avatar` columns to table php spark migrate -n Datamweb\ShieldOAuth ``` +The default size of the `username` field created by Shield is **30** characters. Since Oauth uses the `username` field for the user's email address, this often is not large enough. Consider increasing the size of this field to `VARCHAR(100)`. _The migrations make this change for you_. + > **Note** > By default, `Shield OAuth` uses columns named `first_name`, `last_name`, and `avatar`. > For any reason, if you want to consider another name for them columns, you can do it through the config file(`config/ShieldOAuthConfig.php`) and set the desired values in: diff --git a/src/Database/Migrations/2022-10-20-182737_ShieldOAuth.php b/src/Database/Migrations/2022-10-20-182737_ShieldOAuth.php index 2c5e621..700bbf0 100644 --- a/src/Database/Migrations/2022-10-20-182737_ShieldOAuth.php +++ b/src/Database/Migrations/2022-10-20-182737_ShieldOAuth.php @@ -54,6 +54,16 @@ public function up(): void ]; $this->forge->addColumn('users', $fields); + + $fields2 = [ + 'username' => [ + 'type' => 'VARCHAR(256)', + 'null' => true, + ] + ]; + + // use 'modify' since the prerequisite Shield plugin will certainly have created this column + $this->forge->modifyColumn('users', $fields2); } public function down(): void From 7945ea16f6c31785430f7c690d78e0a7a345204b Mon Sep 17 00:00:00 2001 From: Evan Sharp Date: Tue, 15 Apr 2025 07:40:38 -0700 Subject: [PATCH 2/2] update install doc with correct field size. --- docs/install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install.md b/docs/install.md index 8b1c365..c4e5059 100644 --- a/docs/install.md +++ b/docs/install.md @@ -53,7 +53,7 @@ Therefore, you can add `first_name`, `last_name`, and `avatar` columns to table php spark migrate -n Datamweb\ShieldOAuth ``` -The default size of the `username` field created by Shield is **30** characters. Since Oauth uses the `username` field for the user's email address, this often is not large enough. Consider increasing the size of this field to `VARCHAR(100)`. _The migrations make this change for you_. +The default size of the `username` field created by Shield is **30** characters. Since Oauth uses the `username` field for the user's email address, this often is not large enough. Consider increasing the size of this field to `VARCHAR(256)`. _The migrations make this change for you_. > **Note** > By default, `Shield OAuth` uses columns named `first_name`, `last_name`, and `avatar`.