-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28590 from owncloud/bigint-update-case
Bigint update case
- Loading branch information
Showing
17 changed files
with
348 additions
and
272 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
apps/federatedfilesharing/appinfo/Migrations/Version20170804201125.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace OCA\FederatedFileSharing\Migrations; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** Creates initial schema */ | ||
class Version20170804201125 implements ISchemaMigration { | ||
public function changeSchema(Schema $schema, array $options) { | ||
$prefix = $options['tablePrefix']; | ||
if (!$schema->hasTable("{$prefix}federated_reshares")) { | ||
$table = $schema->createTable("{$prefix}federated_reshares"); | ||
$table->addColumn('share_id', 'bigint', [ | ||
'unsigned' => false, | ||
'notnull' => true, | ||
'length' => 11, | ||
]); | ||
|
||
$table->addColumn('remote_id', 'bigint', [ | ||
'unsigned' => false, | ||
'notnull' => true, | ||
'length' => 11, | ||
'comment' => 'share ID at the remote server' | ||
]); | ||
|
||
$table->addUniqueIndex( | ||
['share_id'], | ||
'share_id_index' | ||
); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/federatedfilesharing/appinfo/Migrations/Version20170804201253.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace OCA\FederatedFileSharing\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\DBAL\Types\Type; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** Updates some fields to bigint if required */ | ||
class Version20170804201253 implements ISchemaMigration { | ||
public function changeSchema(Schema $schema, array $options) { | ||
$prefix = $options['tablePrefix']; | ||
|
||
if ($schema->hasTable("${prefix}federated_reshares")) { | ||
$table = $schema->getTable("{$prefix}federated_reshares"); | ||
|
||
$shareIdColumn = $table->getColumn('share_id'); | ||
if ($shareIdColumn && $shareIdColumn->getType()->getName() !== Type::BIGINT) { | ||
$shareIdColumn->setType(Type::getType(Type::BIGINT)); | ||
$shareIdColumn->setOptions(['length' => 20]); | ||
} | ||
|
||
$remoteIdColumn = $table->getColumn('remote_id'); | ||
if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Type::BIGINT) { | ||
$remoteIdColumn->setType(Type::getType(Type::BIGINT)); | ||
$remoteIdColumn->setOptions(['length' => 20]); | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
94 changes: 94 additions & 0 deletions
94
apps/files_sharing/appinfo/Migrations/Version20170804201125.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
|
||
namespace OCA\Files_Sharing\Migrations; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** Creates initial schema */ | ||
class Version20170804201125 implements ISchemaMigration { | ||
public function changeSchema(Schema $schema, array $options) { | ||
$prefix = $options['tablePrefix']; | ||
if (!$schema->hasTable("{$prefix}share_external")) { | ||
$table = $schema->createTable("{$prefix}share_external"); | ||
$table->addColumn('id', 'bigint', [ | ||
'autoincrement' => true, | ||
'unsigned' => false, | ||
'notnull' => true, | ||
'length' => 11, | ||
]); | ||
|
||
$table->addColumn('remote', 'string', [ | ||
'notnull' => true, | ||
'length' => 512, | ||
'default' => null, | ||
'comment' => 'Url of the remote owncloud instance' | ||
]); | ||
|
||
$table->addColumn('remote_id', 'bigint', [ | ||
'unsigned' => false, | ||
'notnull' => true, | ||
'default' => -1, | ||
'length' => 11, | ||
]); | ||
|
||
$table->addColumn('share_token', 'string', [ | ||
'length' => 64, | ||
'notnull' => true, | ||
'comment' => 'Public share token' | ||
]); | ||
|
||
$table->addColumn('password', 'string', [ | ||
'length' => 64, | ||
'notnull' => false, | ||
'default' => null, | ||
'comment' => 'Optional password for the public share' | ||
]); | ||
|
||
$table->addColumn('name', 'string', [ | ||
'length' => 64, | ||
'notnull' => true, | ||
'comment' => 'Original name on the remote server' | ||
]); | ||
|
||
$table->addColumn('owner', 'string', [ | ||
'length' => 64, | ||
'notnull' => true, | ||
'comment' => 'User that owns the public share on the remote server' | ||
]); | ||
|
||
$table->addColumn('user', 'string', [ | ||
'length' => 64, | ||
'notnull' => true, | ||
'comment' => 'Local user which added the external share' | ||
]); | ||
|
||
$table->addColumn('mountpoint', 'string', [ | ||
'length' => 4000, | ||
'notnull' => true, | ||
'comment' => 'Full path where the share is mounted' | ||
]); | ||
|
||
$table->addColumn('mountpoint_hash', 'string', [ | ||
'length' => 32, | ||
'notnull' => true, | ||
'comment' => 'md5 hash of the mountpoint' | ||
]); | ||
|
||
$table->addColumn('accepted', 'integer', [ | ||
'notnull' => true, | ||
'default' => 0, | ||
]); | ||
|
||
$table->setPrimaryKey(['id']); | ||
|
||
$table->addIndex( | ||
['user'], | ||
'sh_external_user' | ||
); | ||
$table->addUniqueIndex( | ||
['user', 'mountpoint_hash'], | ||
'sh_external_mp' | ||
); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/files_sharing/appinfo/Migrations/Version20170804201253.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace OCA\Files_Sharing\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\DBAL\Types\Type; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** Updates some fields to bigint if required */ | ||
class Version20170804201253 implements ISchemaMigration { | ||
public function changeSchema(Schema $schema, array $options) { | ||
$prefix = $options['tablePrefix']; | ||
|
||
if ($schema->hasTable("${prefix}share_external")) { | ||
$table = $schema->getTable("{$prefix}share_external"); | ||
|
||
$idColumn = $table->getColumn('id'); | ||
if ($idColumn && $idColumn->getType()->getName() !== Type::BIGINT) { | ||
$idColumn->setType(Type::getType(Type::BIGINT)); | ||
$idColumn->setOptions(['length' => 20]); | ||
} | ||
|
||
$remoteIdColumn = $table->getColumn('remote_id'); | ||
if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Type::BIGINT) { | ||
$remoteIdColumn->setType(Type::getType(Type::BIGINT)); | ||
$remoteIdColumn->setOptions(['length' => 20]); | ||
} | ||
} | ||
} | ||
} |
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.