moved the project to this repository
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
-- name: CreateUser :one
|
||||
INSERT INTO users (id, created_at, updated_at, name, api_key)
|
||||
VALUES ($1, $2, $3, $4, encode(sha256(random()::text::bytea), 'hex'))
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetUser :one
|
||||
SELECT * FROM users WHERE api_key = $1;
|
||||
@@ -0,0 +1,10 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE users (
|
||||
id UUID PRIMARY KEY,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
name VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE users;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE users ADD api_key VARCHAR(64) NOT NULL DEFAULT encode(sha256(random()::text::bytea), 'hex') UNIQUE;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE users DROP COLUMN api_key;
|
||||
@@ -0,0 +1,12 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE feeds (
|
||||
id UUID PRIMARY KEY,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
url VARCHAR(255) NOT NULL UNIQUE,
|
||||
user_id VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE feeds;
|
||||
Reference in New Issue
Block a user