All checks were successful
Build and Push Docker Image / build (push) Successful in 7m19s
18 lines
526 B
SQL
18 lines
526 B
SQL
-- +goose Up
|
|
CREATE SCHEMA IF NOT EXISTS lss;
|
|
|
|
CREATE TABLE lss.urls (
|
|
url_id SERIAL PRIMARY KEY,
|
|
long_url TEXT NOT NULL,
|
|
short_code VARCHAR(10) UNIQUE NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
expires_at TIMESTAMP WITH TIME ZONE,
|
|
is_active BOOLEAN DEFAULT TRUE NOT NULL
|
|
);
|
|
|
|
-- Crucial index for lightning-fast lookups when redirecting
|
|
CREATE INDEX idx_urls_short_code ON lss.urls(short_code);
|
|
|
|
-- +goose Down
|
|
DROP INDEX idx_urls_short_code;
|
|
DROP TABLE lss.urls; |