зеркало из https://github.com/nextcloud/passman.git
migrate database.xml to a php database migration #698
This commit is contained in:
Родитель
344529b9ac
Коммит
b39a8edd6a
|
@ -1,593 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<database xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/database.xsd">
|
||||
<name>*dbname*</name>
|
||||
<create>true</create>
|
||||
<overwrite>false</overwrite>
|
||||
<charset>utf8</charset>
|
||||
<table>
|
||||
<name>*dbprefix*passman_vaults</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<primary>true</primary>
|
||||
</field>
|
||||
<field>
|
||||
<name>guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>name</name>
|
||||
<type>text</type>
|
||||
<length>100</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>vault_settings</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>created</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>last_access</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>public_sharing_key</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>private_sharing_key</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>sharing_keys_generated</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
</field>
|
||||
<index>
|
||||
<name>passman_vault_last_access_index</name>
|
||||
<field>
|
||||
<name>last_access</name>
|
||||
</field>
|
||||
</index>
|
||||
|
||||
<index>
|
||||
<name>passman_vault_guid_index</name>
|
||||
<field>
|
||||
<name>guid</name>
|
||||
</field>
|
||||
</index>
|
||||
|
||||
<index>
|
||||
<name>npassman_vault_id_index</name>
|
||||
<field>
|
||||
<name>id</name>
|
||||
</field>
|
||||
</index>
|
||||
|
||||
<index>
|
||||
<name>passman_vault_uid_id_index</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*passman_credentials</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<primary>true</primary>
|
||||
</field>
|
||||
<field>
|
||||
<name>guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>vault_id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<name>label</name>
|
||||
<type>clob</type>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<name>description</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>created</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>changed</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>tags</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>email</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>username</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>password</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>url</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>renew_interval</name>
|
||||
<type>bigint</type>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>expire_time</name>
|
||||
<type>bigint</type>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>delete_time</name>
|
||||
<type>bigint</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>files</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<name>custom_fields</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>otp</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>hidden</name>
|
||||
<type>boolean</type>
|
||||
<default>false</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>compromised</name>
|
||||
<type>clob</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>shared_key</name>
|
||||
<type>clob</type>
|
||||
</field>
|
||||
<field>
|
||||
<name>icon</name>
|
||||
<type>clob</type>
|
||||
</field>
|
||||
<index>
|
||||
<name>passman_credential_id_index</name>
|
||||
<field>
|
||||
<name>id</name>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>passman_credential_vault_id_index</name>
|
||||
<field>
|
||||
<name>vault_id</name>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>passman_credential_user_id_index</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*passman_files</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<primary>true</primary>
|
||||
</field>
|
||||
<field>
|
||||
<name>guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>mimetype</name>
|
||||
<type>text</type>
|
||||
<length>255</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>filename</name>
|
||||
<type>clob</type>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>size</name>
|
||||
<type>bigint</type>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>created</name>
|
||||
<type>bigint</type>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<name>file_data</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<index>
|
||||
<name>passman_file_id_index</name>
|
||||
<field>
|
||||
<name>id</name>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>passman_file_user_id_index</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*passman_revisions</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<primary>true</primary>
|
||||
</field>
|
||||
<field>
|
||||
<name>guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>credential_id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>created</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>credential_data</name>
|
||||
<type>clob</type>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>edited_by</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<index>
|
||||
<name>passman_revision_id_index</name>
|
||||
<field>
|
||||
<name>id</name>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>passman_revision_user_id_index</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>passman_revision_credential_id_index</name>
|
||||
<field>
|
||||
<name>credential_id</name>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*passman_sharing_acl</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<primary>true</primary>
|
||||
</field>
|
||||
<field>
|
||||
<name>item_id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>item_guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>vault_id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>vault_guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>created</name>
|
||||
<type>integer</type>
|
||||
<length>64</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>expire</name>
|
||||
<type>integer</type>
|
||||
<length>64</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>expire_views</name>
|
||||
<type>integer</type>
|
||||
<length>64</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>permissions</name>
|
||||
<type>integer</type>
|
||||
<length>3</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>shared_key</name>
|
||||
<type>clob</type>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*passman_share_request</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<primary>true</primary>
|
||||
</field>
|
||||
<field>
|
||||
<name>item_id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>item_guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>target_user_id</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>from_user_id</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>target_vault_id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>target_vault_guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>shared_key</name>
|
||||
<type>clob</type>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>permissions</name>
|
||||
<type>integer</type>
|
||||
<length>3</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
<field>
|
||||
<name>created</name>
|
||||
<type>integer</type>
|
||||
<length>64</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*passman_delete_vault_request</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<length>8</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>true</notnull>
|
||||
<autoincrement>true</autoincrement>
|
||||
<primary>true</primary>
|
||||
</field>
|
||||
<field>
|
||||
<name>vault_guid</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>reason</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>true</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>requested_by</name>
|
||||
<type>text</type>
|
||||
<length>64</length>
|
||||
<notnull>false</notnull>
|
||||
</field>
|
||||
<field>
|
||||
<name>created</name>
|
||||
<type>integer</type>
|
||||
<length>64</length>
|
||||
<unsigned>true</unsigned>
|
||||
<notnull>false</notnull>
|
||||
<default>0</default>
|
||||
</field>
|
||||
</declaration>
|
||||
</table>
|
||||
</database>
|
|
@ -0,0 +1,407 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\Passman\Migration;
|
||||
|
||||
use Closure;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
|
||||
/**
|
||||
* Auto-generated migration step: Please modify to your needs!
|
||||
*/
|
||||
class Version020308Date20210711121919 extends SimpleMigrationStep {
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
*/
|
||||
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if (!$schema->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 {
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче