diff --git a/appinfo/database.xml b/appinfo/database.xml deleted file mode 100644 index c4c18fb5..00000000 --- a/appinfo/database.xml +++ /dev/null @@ -1,593 +0,0 @@ - - - *dbname* - true - false - utf8 - - *dbprefix*passman_vaults - - - id - integer - 8 - true - true - true - true - - - guid - text - 64 - true - 0 - - - user_id - text - 64 - true - 0 - - - name - text - 100 - true - - - vault_settings - clob - false - - - created - integer - 8 - true - false - 0 - - - last_access - integer - 8 - true - false - 0 - - - public_sharing_key - clob - false - - - private_sharing_key - clob - false - - - sharing_keys_generated - integer - 8 - - - passman_vault_last_access_index - - last_access - - - - - passman_vault_guid_index - - guid - - - - - npassman_vault_id_index - - id - - - - - passman_vault_uid_id_index - - user_id - - - -
- - *dbprefix*passman_credentials - - - id - integer - 8 - true - true - true - true - - - guid - text - 64 - false - - - - user_id - text - 64 - false - - - vault_id - integer - 8 - true - - - - label - clob - true - - - - description - clob - false - - - created - integer - 8 - true - false - 0 - - - changed - integer - 8 - true - false - 0 - - - tags - clob - false - - - email - clob - false - - - username - clob - false - - - password - clob - false - - - url - clob - false - - - renew_interval - bigint - true - false - 0 - - - expire_time - bigint - true - false - 0 - - - delete_time - bigint - 8 - true - false - 0 - - - files - clob - false - - - - custom_fields - clob - false - - - otp - clob - false - - - hidden - boolean - false - - - compromised - clob - - - shared_key - clob - - - icon - clob - - - passman_credential_id_index - - id - - - - passman_credential_vault_id_index - - vault_id - - - - passman_credential_user_id_index - - user_id - - - -
- - *dbprefix*passman_files - - - id - integer - 8 - true - true - true - true - - - guid - text - 64 - false - - - - user_id - text - 64 - false - - - mimetype - text - 255 - true - - - filename - clob - true - - - size - bigint - true - - - created - bigint - true - - - - file_data - clob - false - - - passman_file_id_index - - id - - - - passman_file_user_id_index - - user_id - - - -
- - *dbprefix*passman_revisions - - - id - integer - 8 - true - true - true - true - - - guid - text - 64 - true - - - credential_id - integer - 8 - true - - - user_id - text - 64 - true - - - created - integer - 8 - true - false - 0 - - - credential_data - clob - true - - - edited_by - text - 64 - true - - - passman_revision_id_index - - id - - - - passman_revision_user_id_index - - user_id - - - - passman_revision_credential_id_index - - credential_id - - - -
- - *dbprefix*passman_sharing_acl - - - id - integer - 8 - true - true - true - true - - - item_id - integer - 8 - true - - - item_guid - text - 64 - true - - - vault_id - integer - 8 - true - false - - - vault_guid - text - 64 - false - - - user_id - text - 64 - false - - - created - integer - 64 - true - false - 0 - - - expire - integer - 64 - true - false - 0 - - - expire_views - integer - 64 - true - false - 0 - - - permissions - integer - 3 - true - true - 0 - - - shared_key - clob - false - - -
- - *dbprefix*passman_share_request - - - id - integer - 8 - true - true - true - true - - - item_id - integer - 8 - true - - - item_guid - text - 64 - true - - - target_user_id - text - 64 - false - - - from_user_id - text - 64 - false - - - target_vault_id - integer - 8 - true - true - - - target_vault_guid - text - 64 - true - - - shared_key - clob - true - - - permissions - integer - 3 - true - true - 0 - - - created - integer - 64 - true - false - 0 - - -
- - *dbprefix*passman_delete_vault_request - - - id - integer - 8 - true - true - true - true - - - vault_guid - text - 64 - true - - - reason - text - 64 - true - - - requested_by - text - 64 - false - - - created - integer - 64 - true - false - 0 - - -
-
diff --git a/lib/Migration/Version020308Date20210711121919.php b/lib/Migration/Version020308Date20210711121919.php new file mode 100644 index 00000000..af73c978 --- /dev/null +++ b/lib/Migration/Version020308Date20210711121919.php @@ -0,0 +1,407 @@ +hasTable('passman_vaults')) { + $table = $schema->createTable('passman_vaults'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('guid', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('user_id', 'string', [ + 'notnull' => true, + 'length' => 64, + 'default' => '', + ]); + $table->addColumn('name', 'string', [ + 'notnull' => true, + 'length' => 100, + ]); + $table->addColumn('vault_settings', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('created', 'bigint', [ + 'notnull' => false, + 'length' => 8, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('last_access', 'bigint', [ + 'notnull' => false, + 'length' => 8, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('public_sharing_key', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('private_sharing_key', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('sharing_keys_generated', 'bigint', [ + 'notnull' => false, + 'length' => 8, + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['last_access'], 'passman_vault_last_access_index'); + $table->addIndex(['guid'], 'passman_vault_guid_index'); + $table->addIndex(['id'], 'npassman_vault_id_index'); + $table->addIndex(['user_id'], 'passman_vault_uid_id_index'); + } + + if (!$schema->hasTable('passman_credentials')) { + $table = $schema->createTable('passman_credentials'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('guid', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('user_id', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('vault_id', 'bigint', [ + 'notnull' => true, + 'length' => 8, + ]); + $table->addColumn('label', 'text', [ + 'notnull' => true, + ]); + $table->addColumn('description', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('created', 'bigint', [ + 'notnull' => false, + 'length' => 8, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('changed', 'bigint', [ + 'notnull' => false, + 'length' => 8, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('tags', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('email', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('username', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('password', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('url', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('renew_interval', 'bigint', [ + 'notnull' => false, + 'unsigned' => true, + ]); + $table->addColumn('expire_time', 'bigint', [ + 'notnull' => false, + 'unsigned' => true, + ]); + $table->addColumn('delete_time', 'bigint', [ + 'notnull' => false, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('files', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('custom_fields', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('otp', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('hidden', 'boolean', [ + 'notnull' => false, + 'default' => false, + ]); + $table->addColumn('compromised', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('shared_key', 'text', [ + 'notnull' => false, + ]); + $table->addColumn('icon', 'text', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['id'], 'passman_credential_id_index'); + $table->addIndex(['vault_id'], 'passman_credential_vault_id_index'); + $table->addIndex(['user_id'], 'passman_credential_user_id_index'); + } + + if (!$schema->hasTable('passman_files')) { + $table = $schema->createTable('passman_files'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('guid', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('user_id', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('mimetype', 'string', [ + 'notnull' => true, + 'length' => 255, + ]); + $table->addColumn('filename', 'text', [ + 'notnull' => true, + ]); + $table->addColumn('size', 'bigint', [ + 'notnull' => true, + ]); + $table->addColumn('created', 'bigint', [ + 'notnull' => true, + ]); + $table->addColumn('file_data', 'text', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['id'], 'passman_file_id_index'); + $table->addIndex(['user_id'], 'passman_file_user_id_index'); + } + + if (!$schema->hasTable('passman_revisions')) { + $table = $schema->createTable('passman_revisions'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('guid', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('credential_id', 'bigint', [ + 'notnull' => true, + 'length' => 8, + ]); + $table->addColumn('user_id', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('created', 'bigint', [ + 'notnull' => false, + 'length' => 8, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('credential_data', 'text', [ + 'notnull' => true, + ]); + $table->addColumn('edited_by', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->setPrimaryKey(['id']); + $table->addIndex(['id'], 'passman_revision_id_index'); + $table->addIndex(['user_id'], 'passman_revision_user_id_index'); + $table->addIndex(['credential_id'], 'passman_revision_credential_id_index'); + } + + if (!$schema->hasTable('passman_sharing_acl')) { + $table = $schema->createTable('passman_sharing_acl'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('item_id', 'bigint', [ + 'notnull' => true, + 'length' => 8, + ]); + $table->addColumn('item_guid', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('vault_id', 'bigint', [ + 'notnull' => false, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('vault_guid', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('user_id', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('created', 'bigint', [ + 'notnull' => false, + 'length' => 64, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('expire', 'bigint', [ + 'notnull' => false, + 'length' => 64, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('expire_views', 'bigint', [ + 'notnull' => false, + 'length' => 64, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('permissions', 'smallint', [ + 'notnull' => true, + 'length' => 3, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('shared_key', 'text', [ + 'notnull' => false, + ]); + $table->setPrimaryKey(['id']); + } + + if (!$schema->hasTable('passman_share_request')) { + $table = $schema->createTable('passman_share_request'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('item_id', 'bigint', [ + 'notnull' => true, + 'length' => 8, + ]); + $table->addColumn('item_guid', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('target_user_id', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('from_user_id', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('target_vault_id', 'bigint', [ + 'notnull' => true, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('target_vault_guid', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('shared_key', 'text', [ + 'notnull' => true, + ]); + $table->addColumn('permissions', 'smallint', [ + 'notnull' => true, + 'length' => 3, + 'default' => 0, + 'unsigned' => true, + ]); + $table->addColumn('created', 'bigint', [ + 'notnull' => false, + 'length' => 64, + 'default' => 0, + 'unsigned' => true, + ]); + $table->setPrimaryKey(['id']); + } + + if (!$schema->hasTable('passman_delete_vault_request')) { + $table = $schema->createTable('passman_delete_vault_request'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 8, + 'unsigned' => true, + ]); + $table->addColumn('vault_guid', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('reason', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('requested_by', 'string', [ + 'notnull' => false, + 'length' => 64, + ]); + $table->addColumn('created', 'bigint', [ + 'notnull' => false, + 'length' => 64, + 'default' => 0, + 'unsigned' => true, + ]); + $table->setPrimaryKey(['id']); + } + return $schema; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + } +}