Skip to content

Database schema

Ayush Chugh edited this page Oct 31, 2024 · 1 revision

Use dbdiagram to visualize this schema

Table users {
  id uuid [pk, default: `gen_random_uuid()`, not null]
  email varchar [not null, unique]
  password varchar [not null]
  name varchar [not null]
  created_at timestamp [default: `CURRENT_TIMESTAMP`, not null]
  updated_at timestamp [default: `CURRENT_TIMESTAMP`, not null]
}

Table config {
  id uuid [pk, default: `gen_random_uuid()`, not null]
  user_id uuid [ref: > users.id, not null]
  company_details varchar
  payment_details varchar
  default_currency_name varchar
  default_currency_symbol varchar
  logo varchar
  created_at timestamp [default: `CURRENT_TIMESTAMP`]
  updated_at timestamp [default: `CURRENT_TIMESTAMP`]
}

Table invoices {
  id uuid [pk, default: `gen_random_uuid()`, not null]
  user_id uuid [ref: > users.id, not null]
  invoice_number varchar [not null]
  tax_percentage int
  total_amount int [not null]
  note varchar
  billed_from varchar [not null]
  billed_to varchar [not null]
  payment_method varchar [not null]
  due_date timestamp
  date timestamp [not null]
  created_at timestamp [default: `CURRENT_TIMESTAMP`, not null]
}

Table entries {
  id uuid [pk, default: `gen_random_uuid()`, not null]
  invoice_id uuid [ref: > invoices.id, not null]  // Foreign key to invoices table
  description varchar [not null]
  amount varchar [not null]
  rate int [not null]
  created_at timestamp [default: `CURRENT_TIMESTAMP`]
}
Clone this wiki locally