-
Notifications
You must be signed in to change notification settings - Fork 0
Pirasanth #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Pirasanth #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a complete database schema for a banking system. The schema defines core banking entities and their relationships, along with automated procedures for transaction management and interest calculations.
Key Changes:
- Database schema with 11 tables covering branches, employees, customers, accounts, and transactions
- Three stored procedures for transaction processing, fixed deposit validation, and automated interest crediting
- Automated reference number generation for transactions via trigger function
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| prefix := 'TXN'; | ||
| END IF; | ||
|
|
||
| NEW.ref_no := prefix || '-' || TO_CHAR(NEW.timestamp, 'YYYYMMDD') || '-' || LPAD(NEXTVAL('txn_ref_no')::TEXT, 5, '0'); |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trigger function references 'ref_no' but the transactions table defines the column as 'ref_number' (line 95). This will cause a runtime error when the trigger executes.
| NEW.ref_no := prefix || '-' || TO_CHAR(NEW.timestamp, 'YYYYMMDD') || '-' || LPAD(NEXTVAL('txn_ref_no')::TEXT, 5, '0'); | |
| NEW.ref_number := prefix || '-' || TO_CHAR(NEW.timestamp, 'YYYYMMDD') || '-' || LPAD(NEXTVAL('txn_ref_no')::TEXT, 5, '0'); |
| 'Interest', | ||
| rec.principal_amount + (interest_amount * CAST(SPLIT_PART(rec.months, ' ', 1) AS INTEGER)), | ||
| 'FD Maturity Payout', | ||
| new_balance |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable 'new_balance' is used as an OUT parameter but is not declared in the procedure. This will cause a compilation error.
| 'Interest', | ||
| interest_amount * duration_months, | ||
| 'FD Interest Payout', | ||
| new_balance |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable 'new_balance' is used as an OUT parameter but is not declared in the procedure. This will cause a compilation error.
| INSERT INTO transactions(holder_id, amount, type, description) | ||
| VALUES (current_holder_id, p_amount, p_type, p_description); |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The INSERT statement omits the 'timestamp' column, which should be included or have a DEFAULT value defined. Without it, the trigger function 'assign_ref_no()' will fail when trying to access NEW.timestamp at line 184.
| INSERT INTO transactions(holder_id, amount, type, description) | |
| VALUES (current_holder_id, p_amount, p_type, p_description); | |
| INSERT INTO transactions(holder_id, amount, type, description, timestamp) | |
| VALUES (current_holder_id, p_amount, p_type, p_description, CURRENT_TIMESTAMP); |
| IF p_type = 'Deposit' THEN | ||
| new_balance := current_balance + p_amount; | ||
| ELSIF p_type = 'Withdrawal' THEN | ||
| IF current_balance > p_amount THEN |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The withdrawal validation allows withdrawal when balance equals amount, but doesn't account for minimum balance requirements defined in savingsaccount_plans. This could allow accounts to fall below their required min_balance.
No description provided.