1
0
Fork 0
mirror of synced 2024-10-03 19:53:33 +13:00

Add expire defaults

This commit is contained in:
Bradley Schofield 2024-02-06 19:22:54 +00:00
parent 559fa924c0
commit 70ea6734e7

View file

@ -2,12 +2,14 @@
namespace Appwrite\Migration\Version; namespace Appwrite\Migration\Version;
use Appwrite\Auth\Auth;
use Appwrite\Migration\Migration; use Appwrite\Migration\Migration;
use Exception; use Exception;
use PDOException; use PDOException;
use Throwable; use Throwable;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Database\Database; use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document; use Utopia\Database\Document;
use Utopia\Database\Exception\Authorization; use Utopia\Database\Exception\Authorization;
use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Duplicate;
@ -525,6 +527,11 @@ class V20 extends Migration
$this->projectDB->createDocument('targets', $target); $this->projectDB->createDocument('targets', $target);
} }
break; break;
case 'sessions':
$duration = $this->project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG;
$expire = DateTime::addSeconds(new \DateTime(), $duration);
$document->setAttribute('expire', $expire);
break;
} }
return $document; return $document;
} }