add: added receivers

This commit is contained in:
Lukian 2025-04-28 09:09:26 +02:00
parent 94e4d5750f
commit f0881f2025
6 changed files with 275 additions and 25 deletions

View file

@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Host: mysql
-- Generation Time: Apr 27, 2025 at 01:27 PM
-- Generation Time: Apr 28, 2025 at 06:36 AM
-- Server version: 10.11.3-MariaDB-1:10.11.3+maria~ubu2204
-- PHP Version: 8.1.19
@ -48,8 +48,8 @@ CREATE TABLE IF NOT EXISTS `accounts` (
CREATE TABLE IF NOT EXISTS `cards` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL,
`number` int(11) NOT NULL,
`expiration` timestamp NOT NULL,
`number` int(11) UNSIGNED NOT NULL,
`expiration` varchar(10) NOT NULL,
`cvc` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `account_id` (`account_id`)
@ -57,6 +57,22 @@ CREATE TABLE IF NOT EXISTS `cards` (
-- --------------------------------------------------------
--
-- Table structure for table `receivers`
--
CREATE TABLE IF NOT EXISTS `receivers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`account_id` int(11) NOT NULL,
`name` varchar(30) NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `account_id2` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `transfers`
--
@ -105,6 +121,13 @@ ALTER TABLE `accounts`
ALTER TABLE `cards`
ADD CONSTRAINT `account_id` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `receivers`
--
ALTER TABLE `receivers`
ADD CONSTRAINT `account_id2` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `transfers`
--