summaryrefslogtreecommitdiff
path: root/sql/Pg-database.sql
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-18 20:35:31 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-11-18 20:35:31 +0000
commit18e15b44b4dda09f5d5a8a416e3f6524fb8b2a64 (patch)
tree2697ea82a026998684f2e95b9cd0a54a7e2fd895 /sql/Pg-database.sql
parent5398dde91bacbc86db0614214d0bdcaedf142e67 (diff)
More customer/vendor screen/stored proc fixes. Note that since locations are mapped many<->many with companies and persons, I have moved the location class foreign key into the mapping tables.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1879 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql/Pg-database.sql')
-rw-r--r--sql/Pg-database.sql3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index 67dc0a5a..9737b474 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -130,7 +130,6 @@ SELECT SETVAL('location_class_id_seq',4);
CREATE TABLE location (
id serial PRIMARY KEY,
- location_class integer not null references location_class(id),
line_one text check (line_one ~ '[[:alnum:]_]') NOT NULL,
line_two text,
line_three text,
@@ -156,6 +155,7 @@ COMMENT ON COLUMN company.tax_id IS $$ In the US this would be a EIN. $$;
CREATE TABLE company_to_location (
location_id integer references location(id) not null,
+ location_class integer not null references location_class(id),
company_id integer not null references company(id) ON DELETE CASCADE,
PRIMARY KEY(location_id,company_id));
@@ -201,6 +201,7 @@ create table entity_employee (
CREATE TABLE person_to_location (
location_id integer not null references location(id),
+ location_class integer not null references location_class(id),
person_id integer not null references person(id) ON DELETE CASCADE,
PRIMARY KEY (location_id,person_id));