add automatic dates to all the relevant attributes

This way we don't have to deal with the date format when creating a new entry.
This commit is contained in:
Andreas Zweili 2017-07-24 19:25:41 +02:00
parent 96d82feece
commit 8a0e85ad8b
3 changed files with 9 additions and 11 deletions

Binary file not shown.

View File

@ -12,7 +12,7 @@ use marketdb;
if not exists (select * from sysobjects where name='commercials')
CREATE TABLE commercials (
commercial_id int identity not null,
date_since_last_change date not null,
date_since_last_change date default getdate(),
member_id int not null,
constraint commercial_pk primary key (commercial_id)
);
@ -49,7 +49,7 @@ if not exists (select * from sysobjects where name='subscption_orders')
CREATE TABLE subscption_orders (
subscription_order_id int identity not null,
running_subscription bit,
subscription_order_date date not null,
subscription_order_date date default getdate(),
subscription_id int not null,
member_id int not null,
location_id int not null,
@ -63,7 +63,7 @@ if not exists (select * from sysobjects where name='members')
email_address varchar(50) not null,
password varchar(50) not null,
member_status_id int not null,
date_of_registration date not null,
date_of_registration date default getdate(),
person_id int,
signed_agb bit null,
passed_credit_check bit null,
@ -127,7 +127,7 @@ use marketdb;
if not exists (select * from sysobjects where name='rents')
CREATE TABLE rents (
rent_id int identity not null,
rent_date date not null,
rent_date date default getdate(),
payment_date date not null,
member_id int not null,
rent_price_id int not null

View File

@ -4658,18 +4658,16 @@ values (1,'Max','Muster','1989-07-31','Musterstrasse',3,4,1),
use marketdb;
insert into dbo.members (email_address,
password,
member_status_id,
date_of_registration)
values ('test_member@gmail.com',123456,1,'2017-07-08'),
('full_member@gmail.com',123456,2,'2017-07-08');
member_status_id)
values ('test_member@gmail.com',123456,1),
('full_member@gmail.com',123456,2);
-- insert member with person reference
use marketdb;
insert into dbo.members (email_address,
password,
member_status_id,
date_of_registration,
person_id)
values ('person@gmail.com',123456,2,'2017-07-08',1),
('hannah.muster@gmail.com0',123456,3,'2017-07-20',2);
values ('person@gmail.com',123456,2,1),
('hannah.muster@gmail.com0',123456,3,2);