public function up() { $this->createTable(SocialAccount::tableName(), ['id' => Schema::TYPE_PK, 'uid' => Schema::TYPE_INTEGER . ' NOT NULL UNIQUE', 'provider' => Schema::TYPE_STRING . ' NOT NULL', 'client_id' => Schema::TYPE_STRING . ' NOT NULL']); $this->createIndex('account_unique', SocialAccount::tableName(), ['provider', 'client_id'], TRUE); $this->addForeignKey('fk_user_account', SocialAccount::tableName(), 'uid', User::tableName(), 'id', 'CASCADE', 'RESTRICT'); }
public function down() { $this->dropTable(Profile::tableName()); $this->dropTable(User::tableName()); }