Skip to content

Commit 44b2c1d

Browse files
committed
include eos (end of stay) in queries
1 parent 20f0f88 commit 44b2c1d

File tree

4 files changed

+38
-34
lines changed

4 files changed

+38
-34
lines changed

db/migrations/000001_create_initial_tables.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ CREATE TABLE IF NOT EXISTS tenant(
4040
photo TEXT NOT NULL DEFAULT '',
4141
active BOOL NOT NULL ,
4242
sos DATE NOT NULL,
43-
eos DATE,
43+
eos DATE NOT NULL,
4444
version UUID NOT NULL DEFAULT uuid_generate_v4()
4545

4646
);

db/queries/tenants.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
-- name: CreateTenant :exec
22
INSERT INTO TENANT
3-
(first_name, last_name, house_id, phone, personal_id_type,personal_id, active, sos)
4-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ;
3+
(first_name, last_name, house_id, phone, personal_id_type,personal_id, active, sos, eos)
4+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) ;
55

66
-- name: GetTenantById :one
77
SELECT * FROM tenant
88
WHERE id = $1;
99

1010
-- name: GetTenantByIdWithHouse :one
1111
SELECT t.id, t.first_name, t.last_name, t.house_id,h.location, h.block, h.partition,
12-
t.phone, t.personal_id_type,t.personal_id, t.active, t.sos, t.version
12+
t.phone, t.personal_id_type,t.personal_id, t.active, t.sos, t.eos, t.version
1313
FROM tenant t
1414
JOIN house h ON t.house_id = h.id
1515
WHERE t.id = $1;
1616

1717
-- name: GetTenants :many
1818
SELECT id, first_name, last_name, house_id,
19-
phone, personal_id_type,personal_id, active, sos
19+
phone, personal_id_type,personal_id, active, sos, eos
2020
FROM tenant;
2121

2222
-- name: UpdateTenant :exec

db/sqlc/models.go

Lines changed: 12 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

db/sqlc/tenants.sql.go

Lines changed: 21 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)