payment_methods table

The payment_methods table in the Reddit Clone Database Schema schema has 10 columns, keyed by id, with 1 foreign key to users. 1 column in orders references it.

Display fragments only. The card itself lives with the processor and this row holds a token, which is the difference between a schema you can run and one that drags PCI scope across the whole database.

Columns (10)

Columns of the payment_methods table
ColumnTypeConstraintsDescription
iduuidprimary key
user_iduuidnot null, references users.id
processorvarchar(40)not null
processor_tokenvarchar(255)not null
brandvarchar(40)
last4char(4)
exp_monthsmallint
exp_yearsmallint
is_defaultbooleannot null
created_attimestamptznot null

Indexes (1)

  • (user_id, is_default)

Relationships