| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- use Migrations\AbstractMigration;
- class MigrationToolsTokens extends AbstractMigration {
- /**
- * Change Method.
- *
- * More information on this method is available here:
- * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
- *
- * @return void
- */
- public function change() {
- $this->table('tokens')
- ->addColumn('user_id', 'integer', [
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('type', 'string', [
- 'comment' => 'e.g.:activate,reactivate',
- 'default' => null,
- 'limit' => 20,
- 'null' => false,
- ])
- ->addColumn('token', 'string', [
- 'default' => null,
- 'limit' => 60,
- 'null' => false,
- ])
- ->addColumn('content', 'string', [
- 'comment' => 'can transport some information',
- 'default' => null,
- 'limit' => 255,
- 'null' => true,
- ])
- ->addColumn('used', 'integer', [
- 'default' => 0,
- 'limit' => null,
- 'null' => false,
- ])
- ->addColumn('created', 'datetime', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addColumn('modified', 'datetime', [
- 'default' => null,
- 'limit' => null,
- 'null' => true,
- ])
- ->addIndex(
- [
- 'user_id',
- ]
- )
- ->addIndex(['token'], ['unique' => true])
- ->create();
- }
- }
|