Completed
Pull Request — master (#32545)
by Tom
09:55
created

Version20180901190932   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 62
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
B changeSchema() 0 58 1
1
<?php
2
namespace OCA\files\Migrations;
3
4
use Doctrine\DBAL\Schema\Schema;
5
use Doctrine\DBAL\Types\Type;
6
use OCA\Files\Service\TransferOwnership\TransferRequestMapper;
7
use OCP\Migration\ISchemaMigration;
8
9
/**
10
 * Auto-generated migration step: Please modify to your needs!
11
 */
12
class Version20180901190932 implements ISchemaMigration {
13
14
	public function changeSchema(Schema $schema, array $options) {
15
		// Add a new table to track user file transfer request
16
		$table = $options['tablePrefix'] . TransferRequestMapper::TABLENAME;
17
		$table = $schema->createTable($table);
18
		$table->addColumn(
19
			'id',
20
			Type::INTEGER,
21
			[
22
				'comment' => 'Unique identifier for the transfer request',
23
				'autoincrement' => true
24
			]);
25
		$table->addColumn(
26
			'source_user_id',
27
			Type::STRING,
28
			[
29
				'comment' => 'The user who initiated the request'
30
			]);
31
		$table->addColumn(
32
			'destination_user_id',
33
			Type::STRING,
34
			[
35
				'comment' => 'The user who should receive the files'
36
			]);
37
		$table->addColumn(
38
			'file_id',
39
			Type::BIGINT,
40
			[
41
				'comment' => 'The file id for the folder to be transferred'
42
			]);
43
		$table->addColumn(
44
			'requested_time',
45
			Type::INTEGER,
46
			[
47
				'comment' => 'Time when the request was created by the source user'
48
			]);
49
		$table->addColumn(
50
			'accepted_time',
51
			Type::INTEGER,
52
			[
53
				'comment' => 'Time when the request was accepted by the destination user',
54
				'notnull' => false
55
			]);
56
		$table->addColumn(
57
			'rejected_time',
58
			Type::INTEGER,
59
			[
60
				'comment' => 'Time when the request was rejected by the destination user',
61
				'notnull' => false
62
			]);
63
		$table->addColumn(
64
			'actioned_time',
65
			Type::INTEGER,
66
			[
67
				'comment' => 'Time when the transfer actually completed on storage',
68
				'notnull' => false
69
			]);
70
		$table->setPrimaryKey(['id']);
71
	}
72
73
}
74