moved to single project
This commit is contained in:
29
schema/create.sql.tmpl
Normal file
29
schema/create.sql.tmpl
Normal file
@ -0,0 +1,29 @@
|
||||
#for $table in $tables
|
||||
CREATE TABLE ${table.name}_t (
|
||||
id serial not null primary key
|
||||
#for $column in $table.columns
|
||||
,$column.name $column.sqltype #slurp
|
||||
#if (('notnull' in $column) and $column.notnull)
|
||||
not null #slurp
|
||||
#end if
|
||||
#if (('primarykey' in $column) and $column.primarykey)
|
||||
primary key #slurp
|
||||
#end if
|
||||
#if (('foreignkey' in $column) and $column.foreignkey)
|
||||
references ${column.name}_t (id) #slurp
|
||||
#end if
|
||||
#if ('default' in $column)
|
||||
default $column.default #slurp
|
||||
#end if
|
||||
|
||||
#end for
|
||||
#if ('tableConstraints' in $table)
|
||||
#for $tableConstraint in $table.tableConstraints
|
||||
,$tableConstraint
|
||||
#end for
|
||||
#end if
|
||||
);
|
||||
|
||||
#end for
|
||||
|
||||
|
48
schema/testdata/testdata.sql
vendored
Normal file
48
schema/testdata/testdata.sql
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
insert into account_t (description) values ('account testtenant1');
|
||||
|
||||
insert into tenant_t (lastname, account) values (
|
||||
'testtenant1',
|
||||
(select id from account_t where description = 'account testtenant1')
|
||||
);
|
||||
|
||||
insert into premise_t (street, zip, city) values ('Hemsingskotten 38', '45259', 'Essen');
|
||||
|
||||
insert into parking_t (description, premise) values ('Garage 1', (select id from premise_t where street = 'Hemsingskotten 38'));
|
||||
|
||||
insert into flat_t (description, premise, area, flat_no) values('EG links', (select id from premise_t where street = 'Hemsingskotten 38'), 59.0, 1);
|
||||
|
||||
insert into fee_t (description, amount, fee_type, startdate) values ('Altenwohnung Hemsingskotten', 5.23, 'per_area', '2021-01-01');
|
||||
|
||||
insert into fee_t (description, amount, fee_type, startdate) values ('Garage intern', 30.0, 'total', '2021-01-01');
|
||||
|
||||
insert into tenancy_t (tenant, flat, description, startdate) values (
|
||||
(select id from tenant_t where lastname = 'testtenant1'),
|
||||
(select id from flat_t where flat_no = 1),
|
||||
'flat testtenant1',
|
||||
'2021-06-01'
|
||||
);
|
||||
|
||||
insert into tenancy_t (tenant, parking, description, startdate) values (
|
||||
(select id from tenant_t where lastname = 'testtenant1'),
|
||||
(select id from parking_t where description = 'Garage 1'),
|
||||
'parking testtenant1',
|
||||
'2021-06-01'
|
||||
);
|
||||
|
||||
insert into overhead_advance_t (description, amount, startdate) values ('BKV Altenwohnung Hemsingskotten', 0.34, '2021-01-01');
|
||||
|
||||
insert into overhead_advance_flat_mapping_t (overhead_advance, flat) values (
|
||||
(select id from overhead_advance_t where description = 'BKV Altenwohnung Hemsingskotten'),
|
||||
(select id from flat_t where flat_no = 1)
|
||||
);
|
||||
|
||||
insert into tenancy_fee_mapping_t (tenancy, fee) values (
|
||||
(select id from tenancy_t where description = 'flat testtenant1'),
|
||||
(select id from fee_t where description = 'Altenwohnung Hemsingskotten')
|
||||
);
|
||||
|
||||
insert into tenancy_fee_mapping_t (tenancy, fee) values (
|
||||
(select id from tenancy_t where description = 'parking testtenant1'),
|
||||
(select id from fee_t where description = 'Garage intern')
|
||||
);
|
||||
|
Reference in New Issue
Block a user