data-integrity

Opening Hours Database Design

梦想的初衷 提交于 2019-12-03 03:52:58
We are currently developing an application in which multiple entities have associated opening hours. Opening hours may span multiple days, or may be contained within a single day. Ex. Opens Monday at 6:00 and closes at Friday at 18:00. Or Opens Monday at 06:00 and closes Monday at 15:00. Also, an entity may have multiple sets of opening hours per day. So far, the best design I have found, is to define an opening hour to consist of the following: StartDay, StartTime, EndDay and EndTime. This design allows for all the needed flexibility. However, data integrity becomes an issue. I cannot seem to

Prevent two users from editing the same data

邮差的信 提交于 2019-12-01 07:37:39
I have seen a feature in different web applications including Wordpress (not sure?) that warns a user if he/she opens an article/post/page/whatever from the database, while someone else is editing the same data simultaneously. I would like to implement the same feature in my own application and I have given this a bit of thought. Is the following example a good practice on how to do this? It goes a little something like this: 1) User A enters a the editing page for the mysterious article X. The database table Events is queried to make sure that no one else is editing the same page for the

Which git commands perform integrity checks?

我是研究僧i 提交于 2019-11-30 14:37:17
问题 Trying to determine how quickly a user would be warned of corruption in the object database with git-1.7.4.1, I pulled a one-bit switcheroo: $ git init repo Initialized empty Git repository in /tmp/repo/.git/ $ cd repo $ echo 'very important info' >critical $ git add critical $ git commit -m critical [master (root-commit) c4d6d90] critical 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 critical $ git ls-tree HEAD 100644 blob 82d423c32c4bb2c52938088e0234db041bf4eaaf

Which git commands perform integrity checks?

大城市里の小女人 提交于 2019-11-30 11:24:21
Trying to determine how quickly a user would be warned of corruption in the object database with git-1.7.4.1, I pulled a one-bit switcheroo: $ git init repo Initialized empty Git repository in /tmp/repo/.git/ $ cd repo $ echo 'very important info' >critical $ git add critical $ git commit -m critical [master (root-commit) c4d6d90] critical 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 critical $ git ls-tree HEAD 100644 blob 82d423c32c4bb2c52938088e0234db041bf4eaaf critical $ git show 82d423c32c4bb2c52938088e0234db041bf4eaaf very important info $ echo 'Very important info'

How to overcome Netezza's lack of unique constraint/referential integrity enforcement?

本小妞迷上赌 提交于 2019-11-29 12:01:20
It appears that the lack of support for enforcing 2 basic constraints (unique and foreign key), is a reason for loss of many man-hours debugging and troubleshooting difficult problems. What starts as a trivial, easy-to-fix problem (dup rows /inconsistent primary-detail tables) goes un-noticed, grows and raises complex edge-scenarios in our application, or even in our hardware (e.g. self-join with dups can cause inflation and storage exhaustion). Netezza serves multiple purposes in our environment: production, research, qa and staging. Naturally our ETL processes can’t be mature and can’t

Can Foreign Key be null? [duplicate]

Deadly 提交于 2019-11-28 19:43:37
This question already has an answer here: Can a foreign key be NULL and/or duplicate? 11 answers In our database project we have a table Sale that has an primary key and two exclusive foreign keys: Vehicle_ID and Piece_ID . For example if we sell a vehicle we need Vehicle_ID as a foreign key but not Piece_ID . Can we put NULL to Piece_ID , could a foreign key be null? Or is there a way to do this job? Thanks. The column (or columns) of a primary key must be NOT NULL. A record cannot be uniquely identified by a NULL. So the ID columns on the referenced end of the foreign key must be defined as

File containing its own checksum

橙三吉。 提交于 2019-11-28 16:59:53
问题 Is it possible to create a file that will contain its own checksum (MD5, SHA1, whatever)? And to upset jokers I mean checksum in plain, not function calculating it. 回答1: I created a piece of code in C, then ran bruteforce for less than 2 minutes and got this wonder: The CRC32 of this string is 4A1C449B Note the must be no characters (end of line, etc) after the sentence. You can check it here: http://www.crc-online.com.ar/index.php?d=The+CRC32+of+this+string+is+4A1C449B&en=Calcular+CRC32 This

What's wrong with foreign keys?

瘦欲@ 提交于 2019-11-26 01:38:49
问题 I remember hearing Joel Spolsky mention in podcast 014 that he\'d barely ever used a foreign key (if I remember correctly). However, to me they seem pretty vital to avoid duplication and subsequent data integrity problems throughout your database. Do people have some solid reasons as to why (to avoid a discussion in lines with Stack Overflow principles)? Edit: \"I\'ve yet to have a reason to create a foreign key, so this might be my first reason to actually set up one.\" 回答1: Reasons to use