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') if not exists (select * from sysobjects where name='commercials')
CREATE TABLE commercials ( CREATE TABLE commercials (
commercial_id int identity not null, 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, member_id int not null,
constraint commercial_pk primary key (commercial_id) 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 ( CREATE TABLE subscption_orders (
subscription_order_id int identity not null, subscription_order_id int identity not null,
running_subscription bit, running_subscription bit,
subscription_order_date date not null, subscription_order_date date default getdate(),
subscription_id int not null, subscription_id int not null,
member_id int not null, member_id int not null,
location_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, email_address varchar(50) not null,
password varchar(50) not null, password varchar(50) not null,
member_status_id int not null, member_status_id int not null,
date_of_registration date not null, date_of_registration date default getdate(),
person_id int, person_id int,
signed_agb bit null, signed_agb bit null,
passed_credit_check bit null, passed_credit_check bit null,
@ -127,7 +127,7 @@ use marketdb;
if not exists (select * from sysobjects where name='rents') if not exists (select * from sysobjects where name='rents')
CREATE TABLE rents ( CREATE TABLE rents (
rent_id int identity not null, rent_id int identity not null,
rent_date date not null, rent_date date default getdate(),
payment_date date not null, payment_date date not null,
member_id int not null, member_id int not null,
rent_price_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; use marketdb;
insert into dbo.members (email_address, insert into dbo.members (email_address,
password, password,
member_status_id, member_status_id)
date_of_registration) values ('test_member@gmail.com',123456,1),
values ('test_member@gmail.com',123456,1,'2017-07-08'), ('full_member@gmail.com',123456,2);
('full_member@gmail.com',123456,2,'2017-07-08');
-- insert member with person reference -- insert member with person reference
use marketdb; use marketdb;
insert into dbo.members (email_address, insert into dbo.members (email_address,
password, password,
member_status_id, member_status_id,
date_of_registration,
person_id) person_id)
values ('person@gmail.com',123456,2,'2017-07-08',1), values ('person@gmail.com',123456,2,1),
('hannah.muster@gmail.com0',123456,3,'2017-07-20',2); ('hannah.muster@gmail.com0',123456,3,2);