Database Design – Mysql Workbench generates an additional FK that I do not think is needed

I try one Part this is a child of Sublotwho in turn is a child of Lot, Mysql Workbench automatically creates the foreign keys when I graphically insert the many-to-one relationships.

However, I do not understand why it creates a second foreign key (SubLot_Lot_idLot) in the lowest child.

I could try to find out if this is necessary by deleting this FK and then testing if updates / deletes work the way I want them.

But I would like to get feedback if this is the way to implement foreign keys in such a situation.

First example with autoincrement keys
2nd (minimal) example

In the less minimal example below, I've used individual autoincrement keys, as suggested by Mysql Workbench. I understand that this is not necessarily the best way to create keys, but both examples are equally relevant to my question.

-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';

-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------

-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
USE `mydb` ;

-- -----------------------------------------------------
-- Table `mydb`.`Lot`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Lot` (
  `LotName` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`LotName`),
  UNIQUE INDEX `LotName_UNIQUE` (`LotName` ASC))
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`SubLot`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`SubLot` (
  `SubLotName` VARCHAR(45) NOT NULL,
  `Lot_LotName` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`SubLotName`, `Lot_LotName`),
  UNIQUE INDEX `SubLotName_UNIQUE` (`SubLotName` ASC),
  INDEX `fk_SubLot_Lot_idx` (`Lot_LotName` ASC),
  CONSTRAINT `fk_SubLot_Lot`
    FOREIGN KEY (`Lot_LotName`)
    REFERENCES `mydb`.`Lot` (`LotName`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `mydb`.`Part`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Part` (
  `PartName` VARCHAR(45) NOT NULL,
  `SubLot_SubLotName` VARCHAR(45) NOT NULL,
  `SubLot_Lot_LotName` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`PartName`, `SubLot_SubLotName`, `SubLot_Lot_LotName`),
  UNIQUE INDEX `PartName_UNIQUE` (`PartName` ASC),
  INDEX `fk_Part_SubLot1_idx` (`SubLot_SubLotName` ASC, `SubLot_Lot_LotName` ASC),
  CONSTRAINT `fk_Part_SubLot1`
    FOREIGN KEY (`SubLot_SubLotName` , `SubLot_Lot_LotName`)
    REFERENCES `mydb`.`SubLot` (`SubLotName` , `Lot_LotName`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Need help designing a database?

I am a beginner who develops an app as a task.

The goal of the app is to rent various sports fields such as paddle courts, basketball courts …

The application has a login and registration feature that stores the user's name, phone number, and e-mail address in the database under a unique user identification token.

I have no idea how to proceed from now on. The idea is to store the reservation you make among each user so that they can review it later and at the same time store the reservation on another day outside the user called "Reserves", where all the reserves are stored Check if there is already a reserve so that the previous one is not overwritten.

The fields in the reserves are the day, the hour, the sport and the place they reserve, as in some sports more than one place is available.

I develop the app with App Inventor 2 and save the database in FireBase in a real-time database.

If more information is needed, please let me know and I will add it as soon as possible.

magento2 – Magento 2 – I have removed duplicate tables from the database and a part of the homepage is not displayed

Magento 2.2.7

In DB I noticed that I have a duplicate database. My database tables have a prefix dev_ while there were identical tables without a prefix that were probably left over after a "test" installation.

So with backup and everthing, I manually deleted all tables that did not have them dev_ Prefix.

Then the shop works perfectly up to the front page.
The cover page uses Themevast's Techno theme and a "file" is not loaded / displayed by:
app/design/frontend/tv_themevast_package/techno1/Magento_Cms/templates/top-home.phtml

In this file are defined blocks like:

getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('techno1_producttabs')->toHtml();?>

As soon as I change the store to a secure database, everything works.

My question is:

If so, where is this "configuration" because it might look in the wrong table (without a prefix)?


OR


If so, which table would contain this information?

Maybe it's all the same question …


Yes, I tried to execute commands like:

bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy hr_HR en_US
bin/magento  cache:flush

I also tried to "re-save" the Frontpage settings by the administrator …

Database design – Cassandra data modeling for IOT devices

We're building a micro-services-based IOT platform with a dashboard and views of various sensors, and so on. I have seen some data modeling videos, but I am unable to get a good data model in Cassandra. I need help with respect to the same.

The purpose is thus as follows:

We render personalized dashboards per user and organization. For example, suppose the iot platform is being created for a warehouse monitoring solution. A warehouse can contain a range of equipment, and each equipment is monitored by a number of devices. My hierarchy looks like this:

Organization >> has many warehouses >> has many equipments >> has many devices. An organization has multiple users / employees at different levels, such as Warehouse Manager, CEO, Zone Manager, etc

The dashboard thus contains a number of statistics that must be displayed based on the user who logs on. These statistics are

1) Total number of camps the user can see (eg 500000 for a CEO and 50 for a zone manager)

2) Total number of equipment available in these warehouses (eg 10000000 for a CEO and 300 for a zone manager)

3) The number of device statuses for the 10000000 devices (eg POWERED_ON (50000), POWERED_OFF (50000), MAINTAINENECE (50000), DISMANTLED (50000), etc. for a CEO and POWERED_ON (100), POWERED_OFF (100) , MAINTAINENECE (50), DISMANTLED (50))

4) The total number of alerts generated for the equipment and devices. (Suppose 15,000 devices are in the CRITICAL state and need to be repaired immediately for the CEO, and 15 devices are in the CRITICAL state for a zone manager.)

For the warehouse-specific data, I have created the following model:

//Org >> to user >> to warehouse >> to equipment mapping
      @PartitionKey(0)
      private String organization;
      @PartitionKey(1)
      private String userId;
      @ClusteringColumn(0)
      private UUID warehouseUuid;
      @ClusteringColumn(1)
      private UUID equipmentUuid;
      @ClusteringColumn(2)
      private LocalDateTime timeOfEquipmentStatusUpdate;
      private EquipmentState currentEquipmentState;


//Equipment state Audit information
      @PartitionKey(0)
      private UUID warehouseUuid;
      @PartitionKey(1)
      private UUID equipmentUuid;
      @ClusteringColumn(0)
      private LocalDateTime timeOfEquipmentStatusUpdate;
      private EquipmentState currentEquipmentState;

Device health is constantly updated when technicians repair it. This performs an update query on the first table in a background job to update the device health information.

Since the dashboard only deals with counts I thought a single query would retrieve a single line for a user and then calculate the number of bearings and equipment in my application.

However, I struggle more with warnings than when alerts are triggered, all users who can view the site / equipment should see the warning. I do not think I can set AlertType (CRITICAL / INFO / WARNING) as a partition key.

The SQL query might look something like this

select count(alertType) from  where userid = 'userId' and orgId ='orgId' and warehouse in ('1','2','3' ...n) group by alertType;

One of the models that I came up with for notifications is in the sense of

//Alert audit information
  @PartitionKey(0)
  private UUID warehouseUuid;
 @PartitionKey(1)
  private String equipmentUuid;
  @ClusteringColumn(0)
  private LocalDateTime eventOccurrenceTime;
  @ClusteringColumn(1)
  private String alertName;
  private AlertType alertType;

I am not sure how to associate users in an organization with this alert information. Can someone help me with the data modeling.

Thank you in advance.

Database Design – How to save a series of columns and where you do not know how many they will be, the columns will change and new columns will be introduced

So the data source is the Internet and random bots sending values ​​to my Apache server.

Periodically, new columns are displayed, but they are not always there.
The other problem is that you have a bunch of NULL values ​​that you do not want to save at all.

Later, I would statistically analyze the data, but we're just trying to save it here.

There are currently 99 columns with a minimum of 27 and a maximum of 59, but the maximum is likely to increase slowly.

I currently use a single master table, but the downside is that there are a lot of null values ​​stored for each record. Much wasted space. Currently, the most common value is 64 NULL values ​​per line.

So I had an idea and wondered if anyone could improve it.

You need a master table, and each submitted column has a lookup table with an index and a value.

master
index   num_columns table_index
 1        27        1

For the sake of simplicity there is a table with the names tables27 to table100

table27 would be
index , columns_names_csv, col1_index,col2_index,...col27_index

table28 would be much the same except
index,  columns_names_csv, col1_index,col2_index,...col28_index

All indexes are integers that are used to reference the correct values ​​in the corresponding lookup table.

Since they are all integers, you do not have to worry about data types.

So in addition to the main table and 99 (and growing) lookup tables, you still have tables 27-59, but that number could eventually increase.

Is there a better way to do this?

firebase – Firestore database

I need some help designing the Firestore database for my app.
1. Display documents in a recycler view;
2. The user to rearrange document items via drag and drop; and
3. Multiple users to access the documents and independent rearrange their items.

The first requirement is straightforward using a firestore query.

The second requirement I have a "position" field in the document so the query can be ordered by "the" position "field.

It's the third requirement where I have difficulties. My first thought is to have multiple "position" fields associated with each user and the query by the "user's position" field. However, since Firestore requires an index for each query this approach does not work.

Any suggestions on how to design my Firestore database would be appreciated.

Database Design – Modeling Event Frequency

In this short discussion, I assume that you are using a relational database. I'm not a NoSQL GURU!

Ask the customer what he wants to capture exactly and why. Abstract design and generic design generally lead to complexity.

The frequency list you provided is good, I think you would like to address possibilities like:

Of course, you need a business rule to specify what happens if that day is a holiday. This requires a different holiday table, so the program will not allow you to select such a day.

Dealing with such "tailored" specifications is not easy unless the deviations are specific in a sense.

There is also a difference between "managing the meeting schedule" and "running the meeting." I guess in your example you mix data for both (this can be fine depending on your needs).

When you schedule a meeting Monday 9:00 am every MondayThis is what I understand by "managing the meeting schedule" when the meeting is held (or canceled). The actual start and end time dates, etc., apply to the particular meeting instance and do not affect the other scheduling table.

Accordingly, you have at least two main tables in the meeting area. One for the meeting plan and another for the meeting (the many with a relationship of 0.1 or more).

A (meeting) must have an internal unique key. It has start date and time and end date, end time. The meeting can be held in one place or "virtual" by (type), for example over the phone. The meeting takes place between (participants). The meeting may have a (completion) status, e.g. Scheduled, held, canceled, rescheduled, etc. The meeting must have at least one (primary discussion topics) and is usually for a specific (organizational unit) group / section / project, and the analysis goes on and on …

In the above text, words between (…) are good for spreadsheets (of course, they need to have relationships with the main meeting table).

In the meeting table, the displayed columns do not have to be this way. You can use the timestamp data type with SQL date functions to get almost all the required information. Unless the table is accessed by the user (as in a table), you do not have to specify any columns that SQL Date functions could provide. I suggest you remove unnecessary attributes.

Personal Note: It is somehow interesting for me to realize that there is at least one company where we both worked!

Benchmarking – Request a Mathematica Benchmark Database

Recently, I have come across the lack of information about the performance of Mathematica in different machines, even though a benchmark process has already been implemented Wolfram Mark, The available data includes only 15 old machines and I could not find any more online.

Since many people consider the power of Mathematica to be very useful when purchasing a computer, it will be very useful to create a database containing benchmark results from various processors and operating systems.

It's very easy to ask people to run the benchmark on their computers. My suggestion is to ask them to restart the kernel (two clicks) and execute

Needs("Benchmarking`")
Benchmark()

and send the output with some key specifications such as the processor model, the number of cores, the frequency and the RAM.

When we create such a database, we can provide useful information about what to look for when buying a machine, and it can be hosted on a website or sent to Wolfram.

I think it's pretty easy to gather data because we can ask our friends and even send institutional / business emails. Finally, Are there any people who are interested in contributing to this project?

OBS: I think so Wolfram Mark seems reliable enough to compare machines. After 100 benchmark results, my 3rd Gen-i3 score was 1.166 (9) and the 5th Gen-i7 of a colleague 1.38 (4).

Proxy Sites Proxy Tunnels Proxy List Working Proxy Sites Hotproxysite Proxy Sites Proxy Sites Anonymous Proxy Anonymous Proxies Top-Proxies.co.uk http://www.proxysitesnow.com Proxy Servers Free Proxies Free Proxy List Proxy List Zoxy Proxy List PR liste all proxy sites More Proxies netgofree netgofree Hide-MyIp - The Best Proxy List American Proxy List www.proxylisty.com/proxylist Web Proxy Submit Proxies Updated Proxy List Updated Proxy List aproxy.org Bypass Proxy Sites Free Proxies List Evolving Critic Business Web Directory Free Proxy List iShortIt MyProxyList Online Proxies Go Proxies Need Proxies PrivateProxies Proxies4MySchool Proxies4Work Free Proxy List Free Proxy Sites ProxyInside Wiksa Proxy ProxyLister.org Free Proxy List ProxyNoid Proxy List Free Proxy List Proxy Sites Proxy TopList ProxyVille UK Proxy WebProxy List RatedProxy.com - Listing the best Web Proxies Free Proxy List SchoolProxiesList Stay Anonymous Proxy List The Power Of Ninja Proxy List UNubstruct Free proxy sites Free proxy sites