Skip to content

Commit

Permalink
refactor(database): Cast price as BIGINT and change column type to NU…
Browse files Browse the repository at this point in the history
…MERIC(15,2)
  • Loading branch information
csulit committed Oct 31, 2024
1 parent 5775bcb commit d73371c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/deno-kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export async function listenQueue(kv: Deno.Kv) {
(json_data->'dataLayer'->'attributes'->>'other_features')::jsonb AS property_features,
json_data->'dataLayer'->'attributes'->>'listing_address' AS address,
json_data->'dataLayer'->'attributes'->>'project_name' AS project_name,
json_data->'dataLayer'->'attributes'->>'price' AS price,
(json_data->'dataLayer'->'attributes'->>'price')::BIGINT AS price,
json_data->'dataLayer'->'attributes'->>'price_formatted' AS price_formatted,
json_data->'dataLayer'->'description'->>'text' AS description,
CONCAT('https://lamudi.com.ph/', json_data->'dataLayer'->'attributes'->>'urlkey_details') AS full_url,
Expand Down
2 changes: 1 addition & 1 deletion schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ CREATE TABLE Listing (
is_scraped BOOLEAN NOT NULL DEFAULT FALSE,
address VARCHAR(255),
price_formatted VARCHAR(255),
price DOUBLE PRECISION NOT NULL CHECK (price >= 0),
price NUMERIC(15,2) NOT NULL CHECK (price >= 0),
price_not_shown BOOLEAN default false,
offer_type_id INT NOT NULL REFERENCES Listing_Type(listing_type_id),
property_id INT NOT NULL REFERENCES Property(id) ON DELETE CASCADE,
Expand Down

0 comments on commit d73371c

Please sign in to comment.