12 lines
397 B
SQL
12 lines
397 B
SQL
CREATE TABLE location_page_visits (
|
|
id SERIAL PRIMARY KEY,
|
|
location_id INT NOT NULL REFERENCES locations(id),
|
|
week_key VARCHAR(10) NOT NULL,
|
|
visit_count BIGINT DEFAULT(0) NOT NULL,
|
|
is_deleted BOOLEAN,
|
|
updated_at TIMESTAMP DEFAULT NOW(),
|
|
|
|
UNIQUE(location_id, week_key)
|
|
);
|
|
|
|
CREATE INDEX idx_location_page_visits_week_key_visit_count ON location_page_visits(week_key, visit_count DESC); |