diff options
author | Joas Schilling <coding@schilljs.com> | 2017-07-18 14:20:29 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-07-25 12:47:37 +0200 |
commit | 5e04254d40b427f43ac0cf05f684812c4008aaf5 (patch) | |
tree | 008523e99ab742e7837e26e40bbabd057d5b288f | |
parent | f6c48b1548763e0eda66af7c2720d363e1671090 (diff) | |
download | nextcloud-server-5e04254d40b427f43ac0cf05f684812c4008aaf5.tar.gz nextcloud-server-5e04254d40b427f43ac0cf05f684812c4008aaf5.zip |
Install from migrations
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | core/Migrations/Version13000Date20170718121200.php | 897 | ||||
-rw-r--r-- | db_structure.xml | 2223 | ||||
-rw-r--r-- | lib/private/Setup.php | 3 | ||||
-rw-r--r-- | lib/private/Setup/AbstractDatabase.php | 5 | ||||
-rw-r--r-- | lib/private/Setup/MySQL.php | 6 | ||||
-rw-r--r-- | lib/private/Setup/OCI.php | 9 | ||||
-rw-r--r-- | lib/private/Setup/PostgreSQL.php | 5 | ||||
-rw-r--r-- | lib/private/Setup/Sqlite.php | 1 |
8 files changed, 901 insertions, 2248 deletions
diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php new file mode 100644 index 00000000000..81743bd203f --- /dev/null +++ b/core/Migrations/Version13000Date20170718121200.php @@ -0,0 +1,897 @@ +<?php +namespace OC\Core\Migrations; + +use Doctrine\DBAL\Schema\Schema; +use OCP\Migration\SimpleMigrationStep; +use OCP\Migration\IOutput; + +/** + * Auto-generated migration step: Please modify to your needs! + */ +class Version13000Date20170718121200 extends SimpleMigrationStep { + + /** + * @param IOutput $output + * @param \Closure $schemaClosure The `\Closure` returns a `Schema` + * @param array $options + * @since 13.0.0 + */ + public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { + } + + /** + * @param IOutput $output + * @param \Closure $schemaClosure The `\Closure` returns a `Schema` + * @param array $options + * @return null|Schema + * @since 13.0.0 + */ + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { + /** @var Schema $schema */ + $schema = $schemaClosure(); + + if (!$schema->hasTable('appconfig')) { + $table = $schema->createTable('appconfig'); + $table->addColumn('appid', 'string', [ + 'notnull' => true, + 'length' => 32, + 'default' => '', + ]); + $table->addColumn('configkey', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('configvalue', 'text', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['appid', 'configkey']); + $table->addIndex(['configkey'], 'appconfig_config_key_index'); + $table->addIndex(['appid'], 'appconfig_appid_key'); + } + + if (!$schema->hasTable('storages')) { + $table = $schema->createTable('storages'); + $table->addColumn('id', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('numeric_id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('available', 'integer', [ + 'notnull' => true, + 'default' => 1, + ]); + $table->addColumn('last_checked', 'integer', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['numeric_id']); + $table->addUniqueIndex(['id'], 'storages_id_index'); + } + + if (!$schema->hasTable('mounts')) { + $table = $schema->createTable('mounts'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('storage_id', 'integer', [ + 'notnull' => true, + ]); + $table->addColumn('root_id', 'integer', [ + 'notnull' => true, + ]); + $table->addColumn('user_id', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('mount_point', 'string', [ + 'notnull' => true, + 'length' => 4000, + ]); + $table->addColumn('mount_id', 'integer', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['user_id'], 'mounts_user_index'); + $table->addIndex(['storage_id'], 'mounts_storage_index'); + $table->addIndex(['root_id'], 'mounts_root_index'); + $table->addIndex(['mount_id'], 'mounts_mount_id_index'); + $table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index'); + } + + if (!$schema->hasTable('mimetypes')) { + $table = $schema->createTable('mimetypes'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('mimetype', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['mimetype'], 'mimetype_id_index'); + } + + if (!$schema->hasTable('filecache')) { + $table = $schema->createTable('filecache'); + $table->addColumn('fileid', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('storage', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('path', 'string', [ + 'notnull' => false, + 'length' => 4000, + ]); + $table->addColumn('path_hash', 'string', [ + 'notnull' => true, + 'length' => 32, + 'default' => '', + ]); + $table->addColumn('parent', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('name', 'string', [ + 'notnull' => false, + 'length' => 250, + ]); + $table->addColumn('mimetype', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('mimepart', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('size', 'bigint', [ + 'notnull' => true, + 'length' => 8, + 'default' => 0, + ]); + $table->addColumn('mtime', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('storage_mtime', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('encrypted', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('unencrypted_size', 'bigint', [ + 'notnull' => true, + 'length' => 8, + 'default' => 0, + ]); + $table->addColumn('etag', 'string', [ + 'notnull' => false, + 'length' => 40, + ]); + $table->addColumn('permissions', 'integer', [ + 'notnull' => false, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('checksum', 'string', [ + 'notnull' => false, + 'length' => 255, + ]); + $table->setPrimaryKey(['fileid']); + $table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash'); + $table->addIndex(['parent', 'name'], 'fs_parent_name_hash'); + $table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype'); + $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart'); + $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size'); + } + + if (!$schema->hasTable('group_user')) { + $table = $schema->createTable('group_user'); + $table->addColumn('gid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('uid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->setPrimaryKey(['gid', 'uid']); + $table->addIndex(['uid'], 'gu_uid_index'); + } + + if (!$schema->hasTable('group_admin')) { + $table = $schema->createTable('group_admin'); + $table->addColumn('gid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('uid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->setPrimaryKey(['gid', 'uid']); + $table->addIndex(['uid'], 'group_admin_uid'); + } + + if (!$schema->hasTable('groups')) { + $table = $schema->createTable('groups'); + $table->addColumn('gid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->setPrimaryKey(['gid']); + } + + if (!$schema->hasTable('preferences')) { + $table = $schema->createTable('preferences'); + $table->addColumn('userid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('appid', 'string', [ + 'notnull' => true, + 'length' => 32, + 'default' => '', + ]); + $table->addColumn('configkey', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('configvalue', 'text', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['userid', 'appid', 'configkey']); + } + + if (!$schema->hasTable('properties')) { + $table = $schema->createTable('properties'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('userid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('propertypath', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('propertyname', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('propertyvalue', 'text', [ + 'notnull' => true, + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['userid'], 'property_index'); + } + + if (!$schema->hasTable('share')) { + $table = $schema->createTable('share'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('share_type', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->addColumn('share_with', 'string', [ + 'notnull' => false, + 'length' => 255, + ]); + $table->addColumn('password', 'string', [ + 'notnull' => false, + 'length' => 255, + ]); + $table->addColumn('uid_owner', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('uid_initiator', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('parent', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + $table->addColumn('item_type', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('item_source', 'string', [ + 'notnull' => false, + 'length' => 255, + ]); + $table->addColumn('item_target', 'string', [ + 'notnull' => false, + 'length' => 255, + ]); + $table->addColumn('file_source', 'integer', [ + 'notnull' => false, + 'length' => 4, + ]); + $table->addColumn('file_target', 'string', [ + 'notnull' => false, + 'length' => 512, + ]); + $table->addColumn('permissions', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->addColumn('stime', 'bigint', [ + 'notnull' => true, + 'length' => 8, + 'default' => 0, + ]); + $table->addColumn('accepted', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->addColumn('expiration', 'datetime', [ + 'notnull' => false, + ]); + $table->addColumn('token', 'string', [ + 'notnull' => false, + 'length' => 32, + ]); + $table->addColumn('mail_send', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->addColumn('share_name', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['item_type', 'share_type'], 'item_share_type_index'); + $table->addIndex(['file_source'], 'file_source_index'); + $table->addIndex(['token'], 'token_index'); + } + + if (!$schema->hasTable('jobs')) { + $table = $schema->createTable('jobs'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('class', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('argument', 'string', [ + 'notnull' => true, + 'length' => 4000, + 'default' => '', + ]); + $table->addColumn('last_run', 'integer', [ + 'notnull' => false, + 'default' => 0, + ]); + $table->addColumn('last_checked', 'integer', [ + 'notnull' => false, + 'default' => 0, + ]); + $table->addColumn('reserved_at', 'integer', [ + 'notnull' => false, + 'default' => 0, + ]); + $table->addColumn('execution_duration', 'integer', [ + 'notnull' => true, + 'default' => 0, + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['class'], 'job_class_index'); + } + + if (!$schema->hasTable('users')) { + $table = $schema->createTable('users'); + $table->addColumn('uid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('displayname', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('password', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->setPrimaryKey(['uid']); + } + + if (!$schema->hasTable('authtoken')) { + $table = $schema->createTable('authtoken'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('uid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('login_name', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('password', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('name', 'text', [ + 'notnull' => true, + 'default' => '', + ]); + $table->addColumn('token', 'string', [ + 'notnull' => true, + 'length' => 200, + 'default' => '', + ]); + $table->addColumn('type', 'smallint', [ + 'notnull' => true, + 'length' => 2, + 'default' => 0, + ]); + $table->addColumn('remember', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->addColumn('last_activity', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('last_check', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('scope', 'text', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['token'], 'authtoken_token_index'); + $table->addIndex(['last_activity'], 'authtoken_last_activity_index'); + } + + if (!$schema->hasTable('bruteforce_attempts')) { + $table = $schema->createTable('bruteforce_attempts'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('action', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('occurred', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('ip', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('subnet', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('metadata', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['ip'], 'bruteforce_attempts_ip'); + $table->addIndex(['subnet'], 'bruteforce_attempts_subnet'); + } + + if (!$schema->hasTable('vcategory')) { + $table = $schema->createTable('vcategory'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('uid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('type', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('category', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['uid'], 'uid_index'); + $table->addIndex(['type'], 'type_index'); + $table->addIndex(['category'], 'category_index'); + } + + if (!$schema->hasTable('vcategory_to_object')) { + $table = $schema->createTable('vcategory_to_object'); + $table->addColumn('objid', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('categoryid', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('type', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->setPrimaryKey(['categoryid', 'objid', 'type']); + $table->addIndex(['objid', 'type'], 'vcategory_objectd_index'); + } + + if (!$schema->hasTable('systemtag')) { + $table = $schema->createTable('systemtag'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('name', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('visibility', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 1, + ]); + $table->addColumn('editable', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 1, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident'); + } + + if (!$schema->hasTable('systemtag_object_mapping')) { + $table = $schema->createTable('systemtag_object_mapping'); + $table->addColumn('objectid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('objecttype', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('systemtagid', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping'); + } + + if (!$schema->hasTable('systemtag_group')) { + $table = $schema->createTable('systemtag_group'); + $table->addColumn('systemtagid', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('gid', 'string', [ + 'notnull' => true, + ]); + $table->setPrimaryKey(['gid', 'systemtagid']); + } + + if (!$schema->hasTable('file_locks')) { + $table = $schema->createTable('file_locks'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('lock', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('key', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('ttl', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => -1, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['key'], 'lock_key_index'); + $table->addIndex(['ttl'], 'lock_ttl_index'); + } + + if (!$schema->hasTable('comments')) { + $table = $schema->createTable('comments'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('parent_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('topmost_parent_id', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('children_count', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 0, + ]); + $table->addColumn('actor_type', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('actor_id', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('message', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('verb', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('creation_timestamp', 'datetime', [ + 'notnull' => false, + ]); + $table->addColumn('latest_child_timestamp', 'datetime', [ + 'notnull' => false, + ]); + $table->addColumn('object_type', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('object_id', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['parent_id'], 'comments_parent_id_index'); + $table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx'); + $table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index'); + $table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index'); + } + + if (!$schema->hasTable('comments_read_markers')) { + $table = $schema->createTable('comments_read_markers'); + $table->addColumn('user_id', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('marker_datetime', 'datetime', [ + 'notnull' => false, + ]); + $table->addColumn('object_type', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('object_id', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index'); + $table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index'); + } + + if (!$schema->hasTable('credentials')) { + $table = $schema->createTable('credentials'); + $table->addColumn('user', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('identifier', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('credentials', 'text', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['user', 'identifier']); + $table->addIndex(['user'], 'credentials_user'); + } + + if (!$schema->hasTable('admin_sections')) { + $table = $schema->createTable('admin_sections'); + $table->addColumn('id', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('class', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('priority', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['class'], 'admin_sections_class'); + } + + if (!$schema->hasTable('admin_settings')) { + $table = $schema->createTable('admin_settings'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('class', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('section', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('priority', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['class'], 'admin_settings_class'); + $table->addIndex(['section'], 'admin_settings_section'); + } + + if (!$schema->hasTable('personal_sections')) { + $table = $schema->createTable('personal_sections'); + $table->addColumn('id', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('class', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('priority', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['class'], 'personal_sections_class'); + } + + if (!$schema->hasTable('personal_settings')) { + $table = $schema->createTable('personal_settings'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('class', 'string', [ + 'notnull' => true, + 'length' => 255, + 'default' => '', + ]); + $table->addColumn('section', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('priority', 'smallint', [ + 'notnull' => true, + 'length' => 1, + 'default' => 0, + ]); + $table->setPrimaryKey(['id']); + $table->addUniqueIndex(['class'], 'personal_settings_class'); + $table->addIndex(['section'], 'personal_settings_section'); + } + + if (!$schema->hasTable('accounts')) { + $table = $schema->createTable('accounts'); + $table->addColumn('uid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('data', 'text', [ + 'notnull' => true, + 'default' => '', + ]); + $table->setPrimaryKey(['uid']); + } + return $schema; + } + + /** + * @param IOutput $output + * @param \Closure $schemaClosure The `\Closure` returns a `Schema` + * @param array $options + * @since 13.0.0 + */ + public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { + } +} diff --git a/db_structure.xml b/db_structure.xml deleted file mode 100644 index 65bdb69d95d..00000000000 --- a/db_structure.xml +++ /dev/null @@ -1,2223 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<database> - - <name>*dbname*</name> - <create>true</create> - <overwrite>false</overwrite> - - <charset>utf8</charset> - - <table> - - <!-- - Namespaced Key-Value Store for Application Configuration. - - Keys are namespaced per appid. - - E.g. (core, global_cache_gc_lastrun) -> 1385463286 - --> - <name>*dbprefix*appconfig</name> - - <declaration> - - <field> - <name>appid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>32</length> - </field> - - <field> - <name>configkey</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>configvalue</name> - <type>clob</type> - <notnull>false</notnull> - </field> - - <index> - <name>appconfig_appid_key_index</name> - <primary>true</primary> - <unique>true</unique> - <field> - <name>appid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>configkey</name> - <sorting>ascending</sorting> - </field> - </index> - <index> - <name>appconfig_config_key_index</name> - <field> - <name>configkey</name> - <sorting>ascending</sorting> - </field> - </index> - <index> - <name>appconfig_appid_key</name> - <field> - <name>appid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - Bidirectional Map for Storage Names and Storage Ids. - - Assigns each storage name a unique storage id integer. - - Long storage names are hashed. - - E.g. local::/tmp/ <-> 2 - - E.g. b5db994aa8c6625100e418406c798269 <-> 27 - --> - <name>*dbprefix*storages</name> - - <declaration> - - <field> - <name>id</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>numeric_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>available</name> - <type>integer</type> - <default>1</default> - <notnull>true</notnull> - </field> - - <field> - <name>last_checked</name> - <type>integer</type> - </field> - - <index> - <name>storages_id_index</name> - <unique>true</unique> - <field> - <name>id</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <!-- a list of all mounted storage per user, populated on filesystem setup --> - <table> - - <name>*dbprefix*mounts</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>storage_id</name> - <type>integer</type> - <notnull>true</notnull> - </field> - - <!-- fileid of the root of the mount, foreign key: oc_filecache.fileid --> - <field> - <name>root_id</name> - <type>integer</type> - <notnull>true</notnull> - </field> - - <field> - <name>user_id</name> - <type>text</type> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>mount_point</name> - <type>text</type> - <notnull>true</notnull> - <length>4000</length> - </field> - - <field> - <name>mount_id</name> - <type>integer</type> - </field> - - <index> - <name>mounts_user_index</name> - <unique>false</unique> - <field> - <name>user_id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>mounts_storage_index</name> - <unique>false</unique> - <field> - <name>storage_id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>mounts_root_index</name> - <unique>false</unique> - <field> - <name>root_id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>mounts_mount_id_index</name> - <unique>false</unique> - <field> - <name>mount_id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>mounts_user_root_index</name> - <unique>true</unique> - <field> - <name>user_id</name> - <sorting>ascending</sorting> - </field> - <field> - <name>root_id</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - Bidirectional Map for Mimetypes and Mimetype Id - - Assigns each mimetype (and supertype) a unique mimetype id integer. - - E.g. application <-> 5 - - E.g. application/pdf <-> 6 - --> - <name>*dbprefix*mimetypes</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>mimetype</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <index> - <name>mimetype_id_index</name> - <unique>true</unique> - <field> - <name>mimetype</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - Main file table containing one row for each directory and file. - - Assigns a unique integer fileid to each file (and directory) - - Assigns an etag to each file (and directory) - - Caches various file/dir properties such as: - - path (filename, e.g. files/combinatoricslib-2.0_doc.zip) - - path_hash = md5(path) - - name (basename, e.g. combinatoricslib-2.0_doc.zip) - - size (for directories this is the sum of all contained file sizes) - --> - <name>*dbprefix*filecache</name> - - <declaration> - - <field> - <name>fileid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <!-- Foreign Key storages::numeric_id --> - <field> - <name>storage</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>path</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>4000</length> - </field> - - <field> - <name>path_hash</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>32</length> - </field> - - <!-- Foreign Key filecache::fileid --> - <field> - <name>parent</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>name</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>250</length> - </field> - - <!-- Foreign Key mimetypes::id --> - <field> - <name>mimetype</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <!-- Foreign Key mimetypes::id --> - <field> - <name>mimepart</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>size</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>8</length> - </field> - - <field> - <name>mtime</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>storage_mtime</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>encrypted</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>unencrypted_size</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>8</length> - </field> - - <field> - <name>etag</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>40</length> - </field> - - <field> - <name>permissions</name> - <type>integer</type> - <default>0</default> - <notnull>false</notnull> - <length>4</length> - </field> - - <field> - <name>checksum</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - - - <index> - <name>fs_storage_path_hash</name> - <unique>true</unique> - <field> - <name>storage</name> - <sorting>ascending</sorting> - </field> - <field> - <name>path_hash</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>fs_parent_name_hash</name> - <field> - <name>parent</name> - <sorting>ascending</sorting> - </field> - <field> - <name>name</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>fs_storage_mimetype</name> - <field> - <name>storage</name> - <sorting>ascending</sorting> - </field> - <field> - <name>mimetype</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>fs_storage_mimepart</name> - <field> - <name>storage</name> - <sorting>ascending</sorting> - </field> - <field> - <name>mimepart</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>fs_storage_size</name> - <field> - <name>storage</name> - <sorting>ascending</sorting> - </field> - <field> - <name>size</name> - <sorting>ascending</sorting> - </field> - <field> - <name>fileid</name> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - Stores which groups have which users as members in an n:m relationship. - - Maps group id (gid) to a set of users (uid) - - Maps user id (uid) to a set of groups (gid) (but without index) - --> - <name>*dbprefix*group_user</name> - - <declaration> - - <!-- Foreign Key groups::gid --> - <field> - <name>gid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <index> - <name>gu_gid_uid_index</name> - <primary>true</primary> - <unique>true</unique> - <field> - <name>gid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>uid</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>gu_uid_index</name> - <field> - <name>uid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - Stores which groups have which users as admins in an n:m relationship. - - Maps group id (gid) to a set of users (uid) - - Maps user id (uid) to a set of groups (gid) - - NOTE: This could (very likely) be reduced to a single bit in group_user - instead of repeating varchars gid and uid here - --> - <name>*dbprefix*group_admin</name> - - <declaration> - - <!-- Foreign Key groups::gid --> - <field> - <name>gid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - <index> - <name>group_admin_uid</name> - <field> - <name>uid</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>ga_gid_uid_index</name> - <primary>true</primary> - <unique>true</unique> - <field> - <name>gid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>uid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - A simple list of groups. - --> - <name>*dbprefix*groups</name> - - <declaration> - - <field> - <name>gid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <index> - <name>groups_pKey</name> - <primary>true</primary> - <field> - <name>gid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - Namespaced Key-Value Store for User Preferences - - Keys are namespaced per userid and appid. - - E.g. (admin, files, cache_version) -> 5 - --> - <name>*dbprefix*preferences</name> - - <declaration> - - <!-- Foreign Key users::uid --> - <field> - <name>userid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>appid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>32</length> - </field> - - <field> - <name>configkey</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>configvalue</name> - <type>clob</type> - <notnull>false</notnull> - </field> - - <index> - <name>pref_userid_appid_key_index</name> - <primary>true</primary> - <unique>true</unique> - <field> - <name>userid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>appid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>configkey</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - WebDAV properties. - --> - <name>*dbprefix*properties</name> - - <declaration> - - <field> - <name>id</name> - <autoincrement>1</autoincrement> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>userid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>propertypath</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>propertyname</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>propertyvalue</name> - <type>clob</type> - <notnull>true</notnull> - </field> - - <index> - <name>property_index</name> - <field> - <name>userid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - Shares of all types (user-to-user, external-via-link, etc.) - --> - <name>*dbprefix*share</name> - - <declaration> - - <field> - <name>id</name> - <autoincrement>1</autoincrement> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <!-- Constant OCP\Share::SHARE_TYPE_* --> - <field> - <name>share_type</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <!-- Foreign Key users::uid or NULL --> - <field> - <name>share_with</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - <field> - <name>password</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - - <!-- Foreign Key users::uid --> - <!-- This is the owner of the share - which does not have to be the initiator of the share --> - <field> - <name>uid_owner</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key users::uid --> - <!-- This is the initiator of the share --> - <field> - <name>uid_initiator</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - - - <!-- Foreign Key share::id or NULL --> - <field> - <name>parent</name> - <type>integer</type> - <notnull>false</notnull> - <length>4</length> - </field> - - <!-- E.g. file or folder --> - <field> - <name>item_type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key filecache::fileid --> - <field> - <name>item_source</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - - <field> - <name>item_target</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>255</length> - </field> - - <!-- Foreign Key filecache::fileid --> - <field> - <name>file_source</name> - <type>integer</type> - <notnull>false</notnull> - <length>4</length> - </field> - - <field> - <name>file_target</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>512</length> - </field> - - <!-- Permission bitfield --> - <field> - <name>permissions</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <!-- Time of share creation --> - <field> - <name>stime</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>8</length> - </field> - - <!-- Whether the receiver accepted the share, if share_with is set. --> - <field> - <name>accepted</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <!-- Time of share expiration --> - <field> - <name>expiration</name> - <type>timestamp</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>token</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>32</length> - </field> - - <field> - <name>mail_send</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <field> - <name>share_name</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <index> - <name>item_share_type_index</name> - <field> - <name>item_type</name> - <sorting>ascending</sorting> - </field> - <field> - <name>share_type</name> - <sorting>ascending</sorting> - </field> - </index> - <index> - <name>file_source_index</name> - <field> - <name>file_source</name> - <sorting>ascending</sorting> - </field> - </index> - <index> - <name>token_index</name> - <field> - <name>token</name> - <sorting>ascending</sorting> - </field> - </index> - </declaration> - - </table> - - <table> - - <!-- - Scheduled background jobs. - See OC\BackgroundJob\JobList. - --> - <name>*dbprefix*jobs</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>class</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>argument</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>4000</length> - </field> - - <field> - <!-- timestamp when the job was executed the last time --> - <name>last_run</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <!-- timestamp when the job was checked if it needs execution the last time --> - <name>last_checked</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <!-- timestamp when the job was reserved the last time, 1 day timeout --> - <name>reserved_at</name> - <type>integer</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <!-- time for execution of the job --> - <name>execution_duration</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - </field> - - <index> - <name>job_class_index</name> - <field> - <name>class</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - List of usernames, their display name and login password. - --> - <name>*dbprefix*users</name> - - <declaration> - - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>displayname</name> - <type>text</type> - <default></default> - <length>64</length> - </field> - - <field> - <name>password</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <index> - <name>users_pKey</name> - <primary>true</primary> - <field> - <name>uid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - <name>*dbprefix*authtoken</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>login_name</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>password</name> - <type>clob</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>name</name> - <type>clob</type> - <default></default> - <notnull>true</notnull> - </field> - - <field> - <name>token</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>200</length> - </field> - - <field> - <name>type</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>2</length> - </field> - - <field> - <name>remember</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>1</length> - </field> - - <field> - <name>last_activity</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>last_check</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>scope</name> - <type>clob</type> - <default></default> - <notnull>false</notnull> - </field> - - <index> - <name>authtoken_token_index</name> - <unique>true</unique> - <field> - <name>token</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>authtoken_last_activity_index</name> - <field> - <name>last_activity</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - </table> - - <table> - - <!-- - List of usernames, their display name and login password. - --> - <name>*dbprefix*bruteforce_attempts</name> - - <declaration> - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>action</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>occurred</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>ip</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>subnet</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>metadata</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <index> - <name>bruteforce_attempts_ip</name> - <field> - <name>ip</name> - <sorting>ascending</sorting> - </field> - </index> - <index> - <name>bruteforce_attempts_subnet</name> - <field> - <name>subnet</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - List of tags (category) + a unique tag id (id) per user (uid) and type. - --> - <name>*dbprefix*vcategory</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <!-- Foreign Key users::uid --> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>category</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <index> - <name>uid_index</name> - <field> - <name>uid</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>type_index</name> - <field> - <name>type</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>category_index</name> - <field> - <name>category</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - </table> - - <table> - - <!-- - Object-Tag associations per tag type. - --> - <name>*dbprefix*vcategory_to_object</name> - - <declaration> - - <field> - <name>objid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <!-- Foreign Key vcategory::id --> - <field> - <name>categoryid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <index> - <primary>true</primary> - <unique>true</unique> - <name>category_object_index</name> - <field> - <name>categoryid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>objid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>type</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>vcategory_objectd_index</name> - <field> - <name>objid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>type</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - <!-- - List of system-wide tags - --> - <name>*dbprefix*systemtag</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <!-- Tag name --> - <field> - <name>name</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Visibility: 0 user-not-visible, 1 user-visible --> - <field> - <name>visibility</name> - <type>integer</type> - <default>1</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <!-- Editable: 0 user-not-editable, 1 user-editable --> - <field> - <name>editable</name> - <type>integer</type> - <default>1</default> - <notnull>true</notnull> - <length>1</length> - </field> - - <index> - <name>tag_ident</name> - <unique>true</unique> - <field> - <name>name</name> - <sorting>ascending</sorting> - </field> - <field> - <name>visibility</name> - <sorting>ascending</sorting> - </field> - <field> - <name>editable</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - </table> - - <table> - - <!-- - System tag to object associations per object type. - --> - <name>*dbprefix*systemtag_object_mapping</name> - - <declaration> - - <!-- object id (ex: file id for files)--> - <field> - <name>objectid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- object type (ex: "files")--> - <field> - <name>objecttype</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <!-- Foreign Key systemtag::id --> - <field> - <name>systemtagid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <index> - <unique>true</unique> - <name>mapping</name> - <field> - <name>objecttype</name> - <sorting>ascending</sorting> - </field> - <field> - <name>objectid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>systemtagid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - System tag to group mapping - --> - <name>*dbprefix*systemtag_group</name> - - <declaration> - - <!-- Foreign Key systemtag::id --> - <field> - <name>systemtagid</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>gid</name> - <type>string</type> - <notnull>true</notnull> - </field> - - <index> - <name>systemtag_group</name> - <primary>true</primary> - <unique>true</unique> - <field> - <name>gid</name> - <sorting>ascending</sorting> - </field> - <field> - <name>systemtagid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - - <!-- - Table for storing transactional file locking - --> - <name>*dbprefix*file_locks</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - <autoincrement>1</autoincrement> - </field> - - <field> - <name>lock</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>key</name> - <type>text</type> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>ttl</name> - <type>integer</type> - <default>-1</default> - <notnull>true</notnull> - <length>4</length> - </field> - - <index> - <primary>true</primary> - <unique>true</unique> - <name>lock_id_index</name> - <field> - <name>id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <unique>true</unique> - <name>lock_key_index</name> - <field> - <name>key</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>lock_ttl_index</name> - <field> - <name>ttl</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - <!-- - default place to store comment data - --> - <name>*dbprefix*comments</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - <autoincrement>1</autoincrement> - </field> - - <field> - <name>parent_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>topmost_parent_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>children_count</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <unsigned>true</unsigned> - <length>4</length> - </field> - - <field> - <name>actor_type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>actor_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>message</name> - <type>clob</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>verb</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>creation_timestamp</name> - <type>timestamp</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>latest_child_timestamp</name> - <type>timestamp</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>object_type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>object_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <index> - <name>comments_parent_id_index</name> - <unique>false</unique> - <field> - <name>parent_id</name> - <sorting>descending</sorting> - </field> - </index> - - <index> - <name>comments_topmost_parent_id_idx</name> - <unique>false</unique> - <field> - <name>topmost_parent_id</name> - <sorting>descending</sorting> - </field> - </index> - - <index> - <name>comments_object_index</name> - <unique>false</unique> - <field> - <name>object_type</name> - <sorting>ascending</sorting> - </field> - <field> - <name>object_id</name> - <sorting>ascending</sorting> - </field> - <field> - <name>creation_timestamp</name> - <sorting>descending</sorting> - </field> - </index> - - <index> - <name>comments_actor_index</name> - <unique>false</unique> - <field> - <name>actor_type</name> - <sorting>ascending</sorting> - </field> - <field> - <name>actor_id</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - <!-- - default place to store per user and object read markers - --> - <name>*dbprefix*comments_read_markers</name> - - <declaration> - - <field> - <name>user_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>marker_datetime</name> - <type>timestamp</type> - <default></default> - <notnull>false</notnull> - </field> - - <field> - <name>object_type</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>object_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <index> - <name>comments_marker_object_index</name> - <unique>false</unique> - <field> - <name>object_type</name> - <sorting>ascending</sorting> - </field> - <field> - <name>object_id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>comments_marker_index</name> - <unique>true</unique> - <field> - <name>user_id</name> - <sorting>descending</sorting> - </field> - <field> - <name>object_type</name> - <sorting>ascending</sorting> - </field> - <field> - <name>object_id</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - <!-- - Encrypted credentials storage - --> - <name>*dbprefix*credentials</name> - - <declaration> - - <field> - <name>user</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>identifier</name> - <type>text</type> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>credentials</name> - <type>clob</type> - <notnull>false</notnull> - </field> - - <index> - <name>credentials_user_id</name> - <primary>true</primary> - <unique>true</unique> - <field> - <name>user</name> - <sorting>ascending</sorting> - </field> - <field> - <name>identifier</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>credentials_user</name> - <unique>false</unique> - <field> - <name>user</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - - </table> - - <table> - <!-- Extra admin settings sections --> - <name>*dbprefix*admin_sections</name> - - <declaration> - - <field> - <name>id</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>class</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>priority</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>1</length> - </field> - - <index> - <name>admin_sections_id_index</name> - <primary>true</primary> - <field> - <name>id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>admin_sections_class</name> - <unique>true</unique> - <field> - <name>class</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - </table> - - <table> - <!-- Extra admin settings --> - <name>*dbprefix*admin_settings</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>class</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <!-- id of the section, foreign key: admin_sections.id --> - <field> - <name>section</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>priority</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>1</length> - </field> - - <index> - <name>admin_settings_id_index</name> - <primary>true</primary> - <field> - <name>id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>admin_settings_class</name> - <unique>true</unique> - <field> - <name>class</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>admin_settings_section</name> - <unique>false</unique> - <field> - <name>section</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - </table> - - <table> - <!-- Extra personal settings sections --> - <name>*dbprefix*personal_sections</name> - - <declaration> - - <field> - <name>id</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>class</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <field> - <name>priority</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>1</length> - </field> - - <index> - <name>personal_sections_id_index</name> - <primary>true</primary> - <field> - <name>id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>personal_sections_class</name> - <unique>true</unique> - <field> - <name>class</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - </table> - - <table> - <!-- Extra personal settings --> - <name>*dbprefix*personal_settings</name> - - <declaration> - - <field> - <name>id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>class</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>255</length> - </field> - - <!-- id of the section, foreign key: admin_sections.id --> - <field> - <name>section</name> - <type>text</type> - <default></default> - <notnull>false</notnull> - <length>64</length> - </field> - - <field> - <name>priority</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>1</length> - </field> - - <index> - <name>personal_settings_id_index</name> - <primary>true</primary> - <field> - <name>id</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>personal_settings_class</name> - <unique>true</unique> - <field> - <name>class</name> - <sorting>ascending</sorting> - </field> - </index> - - <index> - <name>personal_settings_section</name> - <unique>false</unique> - <field> - <name>section</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - </table> - - <table> - - <name>*dbprefix*accounts</name> - - <declaration> - <field> - <name>uid</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - <field> - <name>data</name> - <type>clob</type> - <default></default> - <notnull>true</notnull> - </field> - - <index> - <name>uid_index</name> - <primary>true</primary> - <unique>true</unique> - <field> - <name>uid</name> - <sorting>ascending</sorting> - </field> - </index> - - </declaration> - </table> - -</database> diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 5cd3c84ce92..f5bfca604a9 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -282,8 +282,7 @@ class Setup { $class = self::$dbSetupClasses[$dbType]; /** @var \OC\Setup\AbstractDatabase $dbSetup */ - $dbSetup = new $class($l, 'db_structure.xml', $this->config, - $this->logger, $this->random); + $dbSetup = new $class($l, $this->config, $this->logger, $this->random); $error = array_merge($error, $dbSetup->validate($options)); // validate the data directory diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php index 2fbec326a5d..0e0981e0771 100644 --- a/lib/private/Setup/AbstractDatabase.php +++ b/lib/private/Setup/AbstractDatabase.php @@ -38,8 +38,6 @@ abstract class AbstractDatabase { /** @var IL10N */ protected $trans; /** @var string */ - protected $dbDefinitionFile; - /** @var string */ protected $dbUser; /** @var string */ protected $dbPassword; @@ -58,9 +56,8 @@ abstract class AbstractDatabase { /** @var ISecureRandom */ protected $random; - public function __construct(IL10N $trans, $dbDefinitionFile, SystemConfig $config, ILogger $logger, ISecureRandom $random) { + public function __construct(IL10N $trans, SystemConfig $config, ILogger $logger, ISecureRandom $random) { $this->trans = $trans; - $this->dbDefinitionFile = $dbDefinitionFile; $this->config = $config; $this->logger = $logger; $this->random = $random; diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index b4ca02d2e84..d03e4858b61 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -51,11 +51,7 @@ class MySQL extends AbstractDatabase { //fill the database if needed $query='select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; - $result = $connection->executeQuery($query, [$this->dbName, $this->tablePrefix.'users']); - $row = $result->fetch(); - if (!$row or $row['count(*)'] === '0') { - \OC_DB::createDbFromStructure($this->dbDefinitionFile); - } + $connection->executeQuery($query, [$this->dbName, $this->tablePrefix.'users']); } /** diff --git a/lib/private/Setup/OCI.php b/lib/private/Setup/OCI.php index 1bc6b08117f..3051987917c 100644 --- a/lib/private/Setup/OCI.php +++ b/lib/private/Setup/OCI.php @@ -165,14 +165,7 @@ class OCI extends AbstractDatabase { $entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />'; $this->logger->warning( $entry, ['app' => 'setup.oci']); } - $result = oci_execute($stmt); - - if($result) { - $row = oci_fetch_row($stmt); - } - if(!$result or $row[0]==0) { - \OC_DB::createDbFromStructure($this->dbDefinitionFile); - } + oci_execute($stmt); } /** diff --git a/lib/private/Setup/PostgreSQL.php b/lib/private/Setup/PostgreSQL.php index 8267b065142..dbcb94d6d7f 100644 --- a/lib/private/Setup/PostgreSQL.php +++ b/lib/private/Setup/PostgreSQL.php @@ -105,11 +105,6 @@ class PostgreSQL extends AbstractDatabase { throw new \OC\DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'), $this->trans->t('You need to enter details of an existing account.')); } - - - if (!$tablesSetup) { - \OC_DB::createDbFromStructure($this->dbDefinitionFile); - } } private function createDatabase(IDBConnection $connection) { diff --git a/lib/private/Setup/Sqlite.php b/lib/private/Setup/Sqlite.php index 87c0b82682f..d95e70c8b0c 100644 --- a/lib/private/Setup/Sqlite.php +++ b/lib/private/Setup/Sqlite.php @@ -41,6 +41,5 @@ class Sqlite extends AbstractDatabase { } //in case of sqlite, we can always fill the database error_log("creating sqlite db"); - \OC_DB::createDbFromStructure($this->dbDefinitionFile); } } |