khanshakeeb / wad18_ae_bidding_site

WAD AE/AW bidding site for leanring purpose
GNU General Public License v3.0
1 stars 0 forks source link

Create sql scrpit by using phpmyadmin/mysql workbench or any tool #5

Closed khanshakeeb closed 5 years ago

khanshakeeb commented 5 years ago

Which will implement by using ERD Diagram

saad1022 commented 5 years ago

-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/

-- Host: localhost -- Generation Time: Nov 01, 2018 at 10:02 PM -- Server version: 10.1.26-MariaDB -- PHP Version: 7.1.9

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00";

/!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT /; /!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS /; /!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION /; /!40101 SET NAMES utf8mb4 /;

-- -- Database: proj


-- -- Table structure for table files

CREATE TABLE files ( id int(11) NOT NULL, status varchar(11) NOT NULL, published_at date NOT NULL, updated_at date NOT NULL, more_tags varchar(255) NOT NULL, title varchar(11) NOT NULL, description varchar(255) NOT NULL, maximan_limit int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table pay_type

CREATE TABLE pay_type ( user_id int(11) NOT NULL, ongoing int(11) NOT NULL, name varchar(255) NOT NULL, one_time int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table projects

CREATE TABLE projects ( id int(11) NOT NULL, user_id int(11) NOT NULL, updated_at date NOT NULL, title varchar(11) NOT NULL, start_date date NOT NULL, description varchar(255) NOT NULL, end_date date NOT NULL, cost_budget int(11) NOT NULL, created_at date NOT NULL, deleted_at date NOT NULL, status varchar(11) NOT NULL, published_at date NOT NULL, awarded_date date NOT NULL, awarded_to varchar(255) NOT NULL, pay_freelancer_id int(11) NOT NULL, project_types varchar(30) NOT NULL, bid_status varchar(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table project_files

CREATE TABLE project_files ( project_id int(11) NOT NULL, file_id int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table project_type

CREATE TABLE project_type ( project_id int(11) NOT NULL, name varchar(255) NOT NULL, fixed varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table roles

CREATE TABLE roles ( id int(11) NOT NULL, name varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table users

CREATE TABLE users ( id int(11) NOT NULL, name varchar(255) NOT NULL, password varchar(255) NOT NULL, email varchar(255) NOT NULL, contact varchar(255) NOT NULL, updated_at varchar(255) NOT NULL, status varchar(255) NOT NULL, verify_code varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table user_credits

CREATE TABLE user_credits ( user_id int(11) NOT NULL, updated_at date NOT NULL, balance int(11) NOT NULL, expire_date date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table user_credit_history

CREATE TABLE user_credit_history ( user_id int(11) NOT NULL, credits int(255) NOT NULL, purchased_date date NOT NULL, expiry_date date NOT NULL, amount int(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- -- Table structure for table user_roles

CREATE TABLE user_roles ( roles_id int(11) NOT NULL, user_id int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- -- Indexes for dumped tables

-- -- Indexes for table files

ALTER TABLE files ADD PRIMARY KEY (id), ADD KEY id (id);

-- -- Indexes for table pay_type

ALTER TABLE pay_type ADD KEY user_id (user_id);

-- -- Indexes for table projects

ALTER TABLE projects ADD PRIMARY KEY (id), ADD KEY users_id (user_id);

-- -- Indexes for table project_files

ALTER TABLE project_files ADD KEY project_id (project_id), ADD KEY file_id (file_id);

-- -- Indexes for table project_type

ALTER TABLE project_type ADD KEY project_id (project_id);

-- -- Indexes for table roles

ALTER TABLE roles ADD PRIMARY KEY (id);

-- -- Indexes for table users

ALTER TABLE users ADD PRIMARY KEY (id);

-- -- Indexes for table user_credits

ALTER TABLE user_credits ADD KEY user_id (user_id);

-- -- Indexes for table user_credit_history

ALTER TABLE user_credit_history ADD KEY user_id (user_id);

-- -- Indexes for table user_roles

ALTER TABLE user_roles ADD KEY roles_id (roles_id), ADD KEY users_id (user_id);

-- -- AUTO_INCREMENT for dumped tables

-- -- AUTO_INCREMENT for table projects

ALTER TABLE projects MODIFY id int(11) NOT NULL AUTO_INCREMENT;

-- -- AUTO_INCREMENT for table project_type

ALTER TABLE project_type MODIFY project_id int(11) NOT NULL AUTO_INCREMENT;

-- -- AUTO_INCREMENT for table roles

ALTER TABLE roles MODIFY id int(11) NOT NULL AUTO_INCREMENT;

-- -- AUTO_INCREMENT for table users

ALTER TABLE users MODIFY id int(11) NOT NULL AUTO_INCREMENT;

-- -- Constraints for dumped tables

-- -- Constraints for table pay_type

ALTER TABLE pay_type ADD CONSTRAINT pay_type_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id);

-- -- Constraints for table projects

ALTER TABLE projects ADD CONSTRAINT projects_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id);

-- -- Constraints for table project_files

ALTER TABLE project_files ADD CONSTRAINT project_files_ibfk_1 FOREIGN KEY (project_id) REFERENCES projects (id), ADD CONSTRAINT project_files_ibfk_2 FOREIGN KEY (file_id) REFERENCES files (id);

-- -- Constraints for table project_type

ALTER TABLE project_type ADD CONSTRAINT project_type_ibfk_1 FOREIGN KEY (project_id) REFERENCES projects (id);

-- -- Constraints for table user_credits

ALTER TABLE user_credits ADD CONSTRAINT user_credits_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id);

-- -- Constraints for table user_credit_history

ALTER TABLE user_credit_history ADD CONSTRAINT user_credit_history_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (id);

-- -- Constraints for table user_roles

ALTER TABLE user_roles ADD CONSTRAINT user_roles_ibfk_1 FOREIGN KEY (roles_id) REFERENCES roles (id), ADD CONSTRAINT user_roles_ibfk_2 FOREIGN KEY (user_id) REFERENCES users (id); COMMIT;

/!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /; /!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /; /!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION /;

khanshakeeb commented 5 years ago

Mashallah you guys are doing very good job. I really enjoying while teaching you guys IA you will learn a lot of things during this course because you guys at least trying to learn things. Very Very Proud of you GUYS