database-design

ER diagram - Project, Task and Employee

喜夏-厌秋 提交于 2020-01-14 06:02:04
问题 UPDATE: Company can have multiple Projects and Company also have Employees. An employee can only have one Company and a Project can also have only one company. A project has several tasks. Out of these tasks, an Employee will only be assigned to some of the tasks. The employee can only be assigned tasks for project that he/she is assigned to. Please review the following and help on how I should create the database design and the final entity model UPDATED DIAGRAM based on the two comments: If

Database design guidelines

ぐ巨炮叔叔 提交于 2020-01-14 05:59:11
问题 I have managed to get my database somewhat designed. So far, it looks like the following This is the scenario. The focal point is my projects table. A project belongs to a single client. So I might create a project for say SO. This project can have many users (image shows wrong relationship) that work on the project. Each of these users belongs to a department. So me and Bob may be working on a project for SO, I belong to Marketing and Bob belongs to Finance. Here is where I am getting

ERD Modelling tool with Doctrine Support

三世轮回 提交于 2020-01-14 05:58:22
问题 I'm looking for a free or paid software application that I can use for ER modelling. Since I mostly develop applications using Symfony2/Doctrine, does anyone know about software that has Doctrine support? 回答1: I think the following comparison is what you're searching: http://www.orm-designer.com/article/orm-designer-and-mysql-workbench-comparison Conclusion: both ORM Designer and MySQL workbench are able to work with Doctrine. Since MySQL workbench is free and under the wings of MySQL itself

rails has_one relationship causing problems - also white screen

孤街浪徒 提交于 2020-01-14 05:45:07
问题 I have two models: Schedule and Project. Schedule belongs_To Project and Project has_one schedule. There are several problems, but i think they all have the same cause. Here is the code for the schedules#create controller: def create @schedule = Schedule.new(schedule_params) @schedule.project = Project.find(params[:project_id]) if @schedule.project.student_id == current_user.id if @schedule.save && @schedule.freelancer_accepts flash[:notice] = "Successfully created schedule." redirect_to

Multiple independent mariadb usages: multiple containers or one? Isolation vs efficiency?

喜欢而已 提交于 2020-01-13 13:12:42
问题 I have an architectural question. Suppose we have a system that has multiple sub-systems: A , B , and so on. Each of these sub-system needs to persist their data and they all use MariaDB . Sub-system A may need a database (as in create database ... ) called a_db ; and Sub-system B may need a database called b_db . Furthermore, there are no data sharing across A and B In a monolithic world before microservice and docker, it is common to set up one central MariaDB instance and ask each sub

Comparing two db designs for internal messaging

烂漫一生 提交于 2020-01-13 11:27:38
问题 Which of the following db design would be preferable for an internal messaging system. Three tables: MessageThread(models.Model): - subject - timestamp - creator Message(models.Model): - thread (pk) - content - timestamp - sender MessageRecipient - message_id (pk) - recipient (pk) - status (read, unread, deleted) Two tables: Message - thread_id - subject - content - timestamp - sender (fk) MessageRecipient - message_id (fk) - recipient (fk) - status (read, unread, deleted) What would be the

One to many relationship on the same table

不问归期 提交于 2020-01-13 11:23:11
问题 Here is the situation:- I have a table called Users. This contains user data for students and tutors as most of the data required is the same. Having completed the system I am now told that the client would like to be able to assign students to tutors. Is there a legitimate/ clean way I can create a one to many relationship within a single table, perhaps via a link table? I've tried to think this through but whatever solution I come up with seems messy. I would be grateful for any input.

Make Postgres choose the next minimal available id

这一生的挚爱 提交于 2020-01-13 10:25:31
问题 I would like to make Postgres choose the first next available id so that no error occurs in the following case: CREATE TABLE test( id serial PRIMARY KEY, name varchar ); Then: INSERT INTO test VALUES (2,'dd'); INSERT INTO test (name) VALUES ('aa'); INSERT INTO test (name) VALUES ('bb'); This will give a constraint error since id is primary. How can I tell Postgres to insert the record with the next free id? 回答1: Generally it's best to never overrule the default in a serial column. If you

MySQL: Writing to slave node

拟墨画扇 提交于 2020-01-13 09:06:11
问题 Lets say I have a datbase of Cars. I have Makes and Models (FK to Makes). I plan on having users track their cars. each Car has a FK to Model. Now, I have a lot of users, and I want to split up my database to distribute load. The Makes and Models tables don't change so much, but they need to be shared across shards. My thought is to use MySQL replication from a master DB of makes and models to each slave database. My question is: Can I safely write to the slave databases assuming I don't

Designing a database for a user/points system? (in Django)

烈酒焚心 提交于 2020-01-13 07:17:30
问题 First of all, sorry if this isn't an appropriate question for StackOverflow. I've tried to make it as generalisable as possible. I want to create a database (MySQL, site running Django) that has users, who can be allocated a certain number of points for various types of action - it's a collaborative game. My requirements are to obtain: the number of points a user has the user's ranking compared to all other users and the overall leaderboard (i.e. all users ranked in order of points) This is