db_schema.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?xml version="1.0"?>
  2. <!--
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  9. xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
  10. <table name="vault_payment_token" resource="default" engine="innodb" comment="Vault tokens of payment">
  11. <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true"
  12. comment="Entity ID"/>
  13. <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="true" identity="false"
  14. comment="Customer Id"/>
  15. <column xsi:type="varchar" name="public_hash" nullable="false" length="128"
  16. comment="Hash code for using on frontend"/>
  17. <column xsi:type="varchar" name="payment_method_code" nullable="false" length="128"
  18. comment="Payment method code"/>
  19. <column xsi:type="varchar" name="type" nullable="false" length="128" comment="Type"/>
  20. <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
  21. comment="Created At"/>
  22. <column xsi:type="timestamp" name="expires_at" on_update="false" nullable="true" comment="Expires At"/>
  23. <column xsi:type="varchar" name="gateway_token" nullable="false" length="255" comment="Gateway Token"/>
  24. <column xsi:type="text" name="details" nullable="true" comment="Details"/>
  25. <column xsi:type="boolean" name="is_active" nullable="false" default="true"/>
  26. <column xsi:type="boolean" name="is_visible" nullable="false" default="true"/>
  27. <constraint xsi:type="primary" referenceId="PRIMARY">
  28. <column name="entity_id"/>
  29. </constraint>
  30. <constraint xsi:type="foreign" referenceId="VAULT_PAYMENT_TOKEN_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID"
  31. table="vault_payment_token" column="customer_id" referenceTable="customer_entity"
  32. referenceColumn="entity_id" onDelete="CASCADE"/>
  33. <constraint xsi:type="unique" referenceId="VAULT_PAYMENT_TOKEN_PAYMENT_METHOD_CODE_CSTR_ID_GATEWAY_TOKEN">
  34. <column name="payment_method_code"/>
  35. <column name="customer_id"/>
  36. <column name="gateway_token"/>
  37. </constraint>
  38. <constraint xsi:type="unique" referenceId="VAULT_PAYMENT_TOKEN_PUBLIC_HASH">
  39. <column name="public_hash"/>
  40. </constraint>
  41. </table>
  42. <table name="vault_payment_token_order_payment_link" resource="default" engine="innodb"
  43. comment="Order payments to vault token">
  44. <column xsi:type="int" name="order_payment_id" padding="10" unsigned="true" nullable="false" identity="false"
  45. comment="Order payment Id"/>
  46. <column xsi:type="int" name="payment_token_id" padding="10" unsigned="true" nullable="false" identity="false"
  47. comment="Payment token Id"/>
  48. <constraint xsi:type="primary" referenceId="PRIMARY">
  49. <column name="order_payment_id"/>
  50. <column name="payment_token_id"/>
  51. </constraint>
  52. <constraint xsi:type="foreign" referenceId="FK_CF37B9D854256534BE23C818F6291CA2"
  53. table="vault_payment_token_order_payment_link" column="order_payment_id"
  54. referenceTable="sales_order_payment" referenceColumn="entity_id" onDelete="CASCADE"/>
  55. <constraint xsi:type="foreign" referenceId="FK_4ED894655446D385894580BECA993862"
  56. table="vault_payment_token_order_payment_link" column="payment_token_id"
  57. referenceTable="vault_payment_token" referenceColumn="entity_id" onDelete="CASCADE"/>
  58. </table>
  59. </schema>