all repos

onasty @ cd85e3b

a one-time notes service
10 files changed, 37 insertions(+), 37 deletions(-)
run pg_format on all sql files (#45)

Author: Smirnov Oleksandr ss2316544@gmail.com
Committed by: GitHub noreply@github.com
Committed at: 2024-11-20 18:54:31 +0200
Parent: 688ee30
M migrations/20240613092407_users.down.sql
···
        1
        
        -drop table if exists users;

      
        
        1
        +DROP TABLE IF EXISTS users;

      
M migrations/20240613092407_users.up.sql
···
        1
        
        -create table users (

      
        2
        
        -  id uuid primary key default uuid_generate_v4(),

      
        3
        
        -  username varchar(255) not null unique,

      
        4
        
        -  email varchar(255) not null unique,

      
        5
        
        -  password varchar(255) not null,

      
        6
        
        -  activated boolean not null default false,

      
        7
        
        -  created_at timestamptz not null default now(),

      
        8
        
        -  last_login_at timestamptz not null default now()

      
        
        1
        +CREATE TABLE users (

      
        
        2
        +    id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),

      
        
        3
        +    username varchar(255) NOT NULL UNIQUE,

      
        
        4
        +    email varchar(255) NOT NULL UNIQUE,

      
        
        5
        +    password varchar(255) NOT NULL,

      
        
        6
        +    activated boolean NOT NULL DEFAULT FALSE,

      
        
        7
        +    created_at timestamptz NOT NULL DEFAULT now(),

      
        
        8
        +    last_login_at timestamptz NOT NULL DEFAULT now()

      
        9
        9
         );

      
M migrations/20240613092532_sessions.down.sql
···
        1
        
        -drop table if exists sessions;

      
        
        1
        +DROP TABLE IF EXISTS sessions;

      
M migrations/20240613092532_sessions.up.sql
···
        1
        
        -create table sessions (

      
        2
        
        -  id uuid primary key default uuid_generate_v4(),

      
        3
        
        -  user_id uuid references users (id),

      
        4
        
        -  refresh_token varchar(255) not null unique,

      
        5
        
        -  expires_at timestamptz not null

      
        
        1
        +CREATE TABLE sessions (

      
        
        2
        +    id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),

      
        
        3
        +    user_id uuid REFERENCES users (id),

      
        
        4
        +    refresh_token varchar(255) NOT NULL UNIQUE,

      
        
        5
        +    expires_at timestamptz NOT NULL

      
        6
        6
         );

      
M migrations/20240716235210_notes.down.sql
···
        1
        
        -drop table if exists notes;

      
        
        1
        +DROP TABLE IF EXISTS notes;

      
M migrations/20240716235210_notes.up.sql
···
        1
        
        -create table notes (

      
        2
        
        -  id uuid primary key default uuid_generate_v4(),

      
        3
        
        -  content text not null,

      
        4
        
        -  slug varchar(255) not null unique,

      
        5
        
        -  burn_before_expiration boolean default false,

      
        6
        
        -  created_at timestamptz not null default now(),

      
        7
        
        -  expires_at timestamptz

      
        
        1
        +CREATE TABLE notes (

      
        
        2
        +    id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),

      
        
        3
        +    content text NOT NULL,

      
        
        4
        +    slug varchar(255) NOT NULL UNIQUE,

      
        
        5
        +    burn_before_expiration boolean DEFAULT FALSE,

      
        
        6
        +    created_at timestamptz NOT NULL DEFAULT now(),

      
        
        7
        +    expires_at timestamptz

      
        8
        8
         );

      
M migrations/20240724122920_notes_authors.down.sql
···
        1
        
        -drop table notes_authors;

      
        
        1
        +DROP TABLE notes_authors;

      
M migrations/20240724122920_notes_authors.up.sql
···
        1
        
        -create table notes_authors (

      
        2
        
        -  id uuid primary key default uuid_generate_v4(),

      
        3
        
        -  note_id uuid references notes (id) on delete cascade,

      
        4
        
        -  user_id uuid references users (id) on delete cascade,

      
        5
        
        -  created_at timestamptz not null default now()

      
        
        1
        +CREATE TABLE notes_authors (

      
        
        2
        +    id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),

      
        
        3
        +    note_id uuid REFERENCES notes (id) ON DELETE CASCADE,

      
        
        4
        +    user_id uuid REFERENCES users (id) ON DELETE CASCADE,

      
        
        5
        +    created_at timestamptz NOT NULL DEFAULT now()

      
        6
        6
         );

      
M migrations/20240729115827_verification_tokens.down.sql
···
        1
        
        -drop table verification_tokens;

      
        
        1
        +DROP TABLE verification_tokens;

      
M migrations/20240729115827_verification_tokens.up.sql
···
        1
        
        -create table verification_tokens (

      
        2
        
        -  id uuid primary key default uuid_generate_v4(),

      
        3
        
        -  user_id uuid not null unique references users(id),

      
        4
        
        -  token varchar(255) not null unique,

      
        5
        
        -  created_at timestamptz not null default now(),

      
        6
        
        -  expires_at timestamptz not null,

      
        7
        
        -  used_at timestamptz default null

      
        
        1
        +CREATE TABLE verification_tokens (

      
        
        2
        +    id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),

      
        
        3
        +    user_id uuid NOT NULL UNIQUE REFERENCES users (id),

      
        
        4
        +    token varchar(255) NOT NULL UNIQUE,

      
        
        5
        +    created_at timestamptz NOT NULL DEFAULT now(),

      
        
        6
        +    expires_at timestamptz NOT NULL,

      
        
        7
        +    used_at timestamptz DEFAULT NULL

      
        8
        8
         );