Last active
February 16, 2017 22:49
-
-
Save jumper423/087d0abce5659aec22f1037ad08a6651 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Phalcon\Db\Column; | |
use Phalcon\Db\Index; | |
use Phalcon\Db\Reference; | |
use Phalcon\Mvc\Model\Migration; | |
/** | |
* Class OauthAccessTokenScopesMigration_200 | |
*/ | |
class OauthAccessTokenScopesMigration_200 extends Migration | |
{ | |
/** | |
* Define the table structure | |
* | |
* @return void | |
*/ | |
public function morph() | |
{ | |
$this->morphTable('oauth_access_token_scopes', array( | |
'columns' => array( | |
new Column( | |
'id', | |
array( | |
'type' => Column::TYPE_INTEGER, | |
'unsigned' => true, | |
'notNull' => true, | |
'autoIncrement' => true, | |
'size' => 10, | |
'first' => true | |
) | |
), | |
new Column( | |
'access_token_id', | |
array( | |
'type' => Column::TYPE_VARCHAR, | |
'notNull' => true, | |
'size' => 40, | |
'after' => 'id' | |
) | |
), | |
new Column( | |
'scope_id', | |
array( | |
'type' => Column::TYPE_VARCHAR, | |
'notNull' => true, | |
'size' => 40, | |
'after' => 'access_token_id' | |
) | |
), | |
new Column( | |
'created_at', | |
array( | |
'type' => Column::TYPE_INTEGER, | |
'unsigned' => true, | |
'size' => 11, | |
'after' => 'scope_id' | |
) | |
), | |
new Column( | |
'updated_at', | |
array( | |
'type' => Column::TYPE_INTEGER, | |
'unsigned' => true, | |
'size' => 11, | |
'after' => 'created_at' | |
) | |
) | |
), | |
'indexes' => array( | |
new Index('PRIMARY', array('id'), null), | |
new Index('oauth_access_token_scopes_access_token_id_index', array('access_token_id'), null), | |
new Index('oauth_access_token_scopes_scope_id_index', array('scope_id'), null) | |
), | |
'references' => array( | |
new Reference( | |
'oauth_access_token_scopes_access_token_id_foreign', | |
array( | |
'referencedSchema' => 'oauth2', | |
'referencedTable' => 'oauth_access_tokens', | |
'columns' => array('access_token_id'), | |
'referencedColumns' => array('id') | |
) | |
), | |
new Reference( | |
'oauth_access_token_scopes_scope_id_foreign', | |
array( | |
'referencedSchema' => 'oauth2', | |
'referencedTable' => 'oauth_scopes', | |
'columns' => array('scope_id'), | |
'referencedColumns' => array('id') | |
) | |
) | |
), | |
'options' => array( | |
'TABLE_TYPE' => 'BASE TABLE', | |
'AUTO_INCREMENT' => '1', | |
'ENGINE' => 'InnoDB', | |
'TABLE_COLLATION' => 'utf8_unicode_ci' | |
), | |
) | |
); | |
} | |
/** | |
* Run the migrations | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
} | |
/** | |
* Reverse the migrations | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Phalcon\Db\Column; | |
use Phalcon\Db\Index; | |
use Phalcon\Db\Reference; | |
use Phalcon\Mvc\Model\Migration; | |
/** | |
* Class OauthAccessTokensMigration_200 | |
*/ | |
class OauthAccessTokensMigration_200 extends Migration | |
{ | |
/** | |
* Define the table structure | |
* | |
* @return void | |
*/ | |
public function morph() | |
{ | |
$this->morphTable('oauth_access_tokens', array( | |
'columns' => array( | |
new Column( | |
'id', | |
array( | |
'type' => Column::TYPE_VARCHAR, | |
'notNull' => true, | |
'size' => 40, | |
'first' => true | |
) | |
), | |
new Column( | |
'session_id', | |
array( | |
'type' => Column::TYPE_INTEGER, | |
'unsigned' => true, | |
'notNull' => true, | |
'size' => 10, | |
'after' => 'id' | |
) | |
), | |
new Column( | |
'expire_time', | |
array( | |
'type' => Column::TYPE_INTEGER, | |
'notNull' => true, | |
'size' => 11, | |
'after' => 'session_id' | |
) | |
), | |
new Column( | |
'created_at', | |
array( | |
'type' => Column::TYPE_INTEGER, | |
'unsigned' => true, | |
'size' => 11, | |
'after' => 'expire_time' | |
) | |
), | |
new Column( | |
'updated_at', | |
array( | |
'type' => Column::TYPE_INTEGER, | |
'unsigned' => true, | |
'size' => 11, | |
'after' => 'created_at' | |
) | |
) | |
), | |
'indexes' => array( | |
new Index('PRIMARY', array('id'), null), | |
new Index('oauth_access_tokens_id_session_id_unique', array('id', 'session_id'), null), | |
new Index('oauth_access_tokens_session_id_index', array('session_id'), null) | |
), | |
'references' => array( | |
new Reference( | |
'oauth_access_tokens_session_id_foreign', | |
array( | |
'referencedSchema' => 'oauth2', | |
'referencedTable' => 'oauth_sessions', | |
'columns' => array('session_id'), | |
'referencedColumns' => array('id') | |
) | |
) | |
), | |
'options' => array( | |
'TABLE_TYPE' => 'BASE TABLE', | |
'AUTO_INCREMENT' => '', | |
'ENGINE' => 'InnoDB', | |
'TABLE_COLLATION' => 'utf8_unicode_ci' | |
), | |
) | |
); | |
} | |
/** | |
* Run the migrations | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
} | |
/** | |
* Reverse the migrations | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment