temp

Tables (18)

Untitled

    Untitled2

      budgets

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • year_month — CHAR(7) — NOT NULL
      • salary_amount — NUMERIC(14, 2) — NOT NULL
      • savings_goal_amount — NUMERIC(14, 2) — NOT NULL
      • confirmed_fixed_expense_total — NUMERIC(14, 2) — NOT NULL
      • expected_fixed_expense_total — NUMERIC(14, 2) — NOT NULL
      • available_amount — NUMERIC(14, 2) — NOT NULL
      • daily_recommended_amount — NUMERIC(14, 2) — NOT NULL
      • calculated_at — TIMESTAMPTZ — NOT NULL

      card_transactions

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • card_id — BIGINT — Foreign key → cards.id — NOT NULL
      • merchant_id — BIGINT — Foreign key → merchants.id
      • approval_no — VARCHAR(50)
      • used_date — DATE — NOT NULL
      • used_at — TIMESTAMPTZ
      • merchant_name_raw — VARCHAR(255) — NOT NULL
      • amount — NUMERIC(14, 2) — NOT NULL
      • currency_code — CHAR(3) — NOT NULL
      • payment_method — VARCHAR(50)
      • expected_payment_date — DATE
      • industry_code — VARCHAR(50)
      • industry_name — VARCHAR(100)
      • address — VARCHAR(255)
      • installment_months — SMALLINT
      • status — transaction_status — NOT NULL
      • dedup_hash — VARCHAR(64) — NOT NULL
      • original_transaction_id — BIGINT — Foreign key → card_transactions.id
      • created_at — TIMESTAMPTZ — NOT NULL
      • updated_at — TIMESTAMPTZ — NOT NULL

      cards

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • card_name — VARCHAR(100) — NOT NULL
      • card_number_masked — VARCHAR(20) — NOT NULL
      • created_at — TIMESTAMPTZ — NOT NULL
      • updated_at — TIMESTAMPTZ — NOT NULL

      categories

      • id — BIGSERIAL — Primary key — NOT NULL
      • name — VARCHAR(100) — NOT NULL
      • type — category_type — NOT NULL
      • weight — NUMERIC(5, 2) — NOT NULL
      • created_at — TIMESTAMPTZ — NOT NULL

      fixed_expense_candidates

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • recurring_group_id — BIGINT — Foreign key → recurring_payment_groups.id — NOT NULL
      • score — NUMERIC(6, 2) — NOT NULL
      • recommended_category_id — BIGINT — Foreign key → categories.id
      • recommend_message — TEXT
      • status — candidate_status — NOT NULL
      • decided_at — TIMESTAMPTZ
      • created_at — TIMESTAMPTZ — NOT NULL
      • updated_at — TIMESTAMPTZ — NOT NULL

      fixed_expenses

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • candidate_id — BIGINT — Foreign key → fixed_expense_candidates.id
      • source — expense_source — NOT NULL
      • name — VARCHAR(100) — NOT NULL
      • category_id — BIGINT — Foreign key → categories.id — NOT NULL
      • expected_pay_day — SMALLINT
      • expected_amount — NUMERIC(14, 2) — NOT NULL
      • card_id — BIGINT — Foreign key → cards.id
      • merchant_id — BIGINT — Foreign key → merchants.id
      • notify_enabled — BOOLEAN — NOT NULL
      • status — expense_status — NOT NULL
      • created_at — TIMESTAMPTZ — NOT NULL
      • updated_at — TIMESTAMPTZ — NOT NULL
      • deleted_at — TIMESTAMPTZ

      habit_expenses

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • candidate_id — BIGINT — Foreign key → fixed_expense_candidates.id
      • merchant_id — BIGINT — Foreign key → merchants.id — NOT NULL
      • category_id — BIGINT — Foreign key → categories.id
      • periodicity — periodicity — NOT NULL
      • avg_amount — NUMERIC(14, 2)
      • created_at — TIMESTAMPTZ — NOT NULL

      merchant_alias_terms

      • id — BIGSERIAL — Primary key — NOT NULL
      • merchant_alias_id — BIGINT — Foreign key → merchant_aliases.id — NOT NULL
      • alias_text — VARCHAR(255) — NOT NULL
      • created_at — TIMESTAMPTZ — NOT NULL

      merchant_aliases

      • id — BIGSERIAL — Primary key — NOT NULL
      • canonical_service_name — VARCHAR(255) — NOT NULL
      • default_category_id — BIGINT — Foreign key → categories.id
      • created_at — TIMESTAMPTZ — NOT NULL
      • updated_at — TIMESTAMPTZ — NOT NULL

      merchants

      • id — BIGSERIAL — Primary key — NOT NULL
      • normalized_name — VARCHAR(255) — NOT NULL
      • display_name — VARCHAR(255)
      • merchant_alias_id — BIGINT — Foreign key → merchant_aliases.id
      • created_at — TIMESTAMPTZ — NOT NULL

      notifications

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • fixed_expense_id — BIGINT — Foreign key → fixed_expenses.id
      • type — notification_type — NOT NULL
      • message — TEXT — NOT NULL
      • status — notification_status — NOT NULL
      • scheduled_at — TIMESTAMPTZ — NOT NULL
      • sent_at — TIMESTAMPTZ
      • created_at — TIMESTAMPTZ — NOT NULL

      recurring_payment_group_transactions

      • recurring_group_id — BIGINT — Foreign key → recurring_payment_groups.id — NOT NULL
      • transaction_id — BIGINT — Foreign key → card_transactions.id — NOT NULL

      recurring_payment_groups

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • merchant_id — BIGINT — Foreign key → merchants.id — NOT NULL
      • periodicity — periodicity — NOT NULL
      • repeat_count — SMALLINT — NOT NULL
      • avg_amount — NUMERIC(14, 2) — NOT NULL
      • amount_variance_pct — NUMERIC(5, 2)
      • avg_pay_day — SMALLINT
      • pay_day_variance — SMALLINT
      • first_detected_at — DATE — NOT NULL
      • last_detected_at — DATE — NOT NULL
      • created_at — TIMESTAMPTZ — NOT NULL
      • updated_at — TIMESTAMPTZ — NOT NULL

      user_feedbacks

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • candidate_id — BIGINT — Foreign key → fixed_expense_candidates.id
      • merchant_id — BIGINT — Foreign key → merchants.id
      • action_type — feedback_action — NOT NULL
      • payload — JSONB
      • created_at — TIMESTAMPTZ — NOT NULL

      user_merchant_preferences

      • id — BIGSERIAL — Primary key — NOT NULL
      • user_id — BIGINT — Foreign key → users.id — NOT NULL
      • merchant_id — BIGINT — Foreign key → merchants.id — NOT NULL
      • preference_type — preference_type — NOT NULL
      • category_id — BIGINT — Foreign key → categories.id
      • created_at — TIMESTAMPTZ — NOT NULL

      users

      • id — BIGSERIAL — Primary key — NOT NULL
      • email — VARCHAR(255) — NOT NULL
      • salary_amount — NUMERIC(14, 2)
      • savings_goal — NUMERIC(14, 2)
      • created_at — TIMESTAMPTZ — NOT NULL
      • updated_at — TIMESTAMPTZ — NOT NULL
      • deleted_at — TIMESTAMPTZ