init
This commit is contained in:
15
migrations/20250302015710_top_view.sql
Normal file
15
migrations/20250302015710_top_view.sql
Normal file
@ -0,0 +1,15 @@
|
||||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
SELECT 'up SQL query';
|
||||
CREATE VIEW IF NOT EXISTS total_karma AS SELECT u.id, u.name, sum(change) as total from karma
|
||||
INNER JOIN users u ON u.id=karma.to_user
|
||||
WHERE 1
|
||||
GROUP BY u.id
|
||||
ORDER BY total DESC;
|
||||
-- +goose StatementEnd
|
||||
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
SELECT 'down SQL query';
|
||||
DROP VIEW total_karma
|
||||
-- +goose StatementEnd
|
||||
Reference in New Issue
Block a user