switch the attribute reference and the constrait name
To create a constrait you first define the name and then link to it's target.
This commit is contained in:
parent
370af5e89b
commit
8ab5cd6957
|
@ -12,7 +12,7 @@ if not exists (select * from sysobjects where name='commercials')
|
|||
commercial_id int not null,
|
||||
date_since_last_change date not null,
|
||||
member_id int not null,
|
||||
constraint commercial_id primary key (commercial_pk)
|
||||
constraint commercial_pk primary key (commercial_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -20,7 +20,7 @@ if not exists (select * from sysobjects where name='member_status')
|
|||
CREATE TABLE member_status (
|
||||
member_status_id int not null,
|
||||
status_name varchar(50) not null,
|
||||
constraint member_status_id primary key (member_status_pk)
|
||||
constraint member_status_pk primary key (member_status_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -28,7 +28,7 @@ if not exists (select * from sysobjects where name='salutation')
|
|||
CREATE TABLE salutation (
|
||||
salutation_id int not null,
|
||||
salutation_name varchar(50) not null,
|
||||
constraint salutation_id primary key (salutation_pk)
|
||||
constraint salutation_pk primary key (salutation_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -39,19 +39,19 @@ if not exists (select * from sysobjects where name='subscription')
|
|||
subscription_price money not null,
|
||||
subscription_name varchar(50) not null,
|
||||
duration_in_seconds INT,
|
||||
constraint subscription_id primary key (subscription_pk)
|
||||
constraint subscription_pk primary key (subscription_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
if not exists (select * from sysobjects where name='subscption_order')
|
||||
CREATE TABLE subscption_order (
|
||||
subscription_order_id int not null,
|
||||
running_subscription bool,
|
||||
running_subscription bit,
|
||||
subscription_order_date date not null,
|
||||
subscription_id int not null,
|
||||
member_id int not null,
|
||||
location_id int not null,
|
||||
constraint subscription_order_id primary key (subscription_order_pk)
|
||||
constraint subscription_order_pk primary key (subscription_order_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -62,7 +62,7 @@ if not exists (select * from sysobjects where name='members')
|
|||
member_status_id int not null,
|
||||
date_of_registration date not null,
|
||||
person_id int,
|
||||
constraint member_id primary key (member_pk)
|
||||
constraint member_pk primary key (member_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -78,7 +78,7 @@ if not exists (select * from sysobjects where name='persons')
|
|||
streetnumber int,
|
||||
city_id int not null,
|
||||
country_id int not null,
|
||||
constraint person_id primary key (person_pk)
|
||||
constraint person_pk primary key (person_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -86,18 +86,18 @@ if not exists (select * from sysobjects where name='trial_period')
|
|||
CREATE TABLE trial_period (
|
||||
trial_period_id int not null,
|
||||
duration_in_seconds int not null,
|
||||
constraint trial_period_id primary key (trial_period_pk)
|
||||
constraint trial_period_pk primary key (trial_period_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
if not exists (select * from sysobjects where name='quality_checks')
|
||||
CREATE TABLE quality_checks (
|
||||
quality_check_id int not null,
|
||||
check_passed bool,
|
||||
check_passed bit,
|
||||
due_date date not null,
|
||||
checking_member int not null,
|
||||
checked_member int not null,
|
||||
constraint quality_check_id primary key (quality_check_pk)
|
||||
constraint quality_check_pk primary key (quality_check_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -106,7 +106,7 @@ if not exists (select * from sysobjects where name='cities')
|
|||
city_id int not null,
|
||||
city_name varchar(50) not null,
|
||||
zip_code int not null,
|
||||
constraint city_id primary key (city_pk)
|
||||
constraint city_pk primary key (city_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -114,7 +114,7 @@ if not exists (select * from sysobjects where name='countries')
|
|||
CREATE TABLE countries (
|
||||
country_id int not null,
|
||||
country_name varchar(50) not null,
|
||||
constraint country_id primary key (country_pk)
|
||||
constraint country_pk primary key (country_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -125,7 +125,7 @@ if not exists (select * from sysobjects where name='rents')
|
|||
payment_date date not null,
|
||||
member_id int not null,
|
||||
rent_price_id int not null
|
||||
constraint rent_id primary key (rent_pk)
|
||||
constraint rent_pk primary key (rent_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -137,7 +137,7 @@ if not exists (select * from sysobjects where name='locations')
|
|||
location_name varchar(50) not null,
|
||||
city_id int not null,
|
||||
country_id int not null,
|
||||
constraint location_id primary key (location_pk)
|
||||
constraint location_pk primary key (location_id)
|
||||
);
|
||||
|
||||
use marketdb;
|
||||
|
@ -146,5 +146,5 @@ if not exists (select * from sysobjects where name='rent_prices')
|
|||
rent_price_id int not null,
|
||||
location_id int not null,
|
||||
rent_price money not null,
|
||||
constraint rent_price_id primary key (rent_price_pk)
|
||||
constraint rent_price_pk primary key (rent_price_id)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue