Skip to content

Commit

Permalink
create DB schema file
Browse files Browse the repository at this point in the history
  • Loading branch information
kenliu committed Jan 1, 2024
1 parent efb262b commit 10d762d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sql/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CREATE DATABASE IF NOT EXISTS bookmarks;

USE "bookmarks";

CREATE TABLE IF NOT EXISTS bookmarks (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
bookmark_id TEXT NOT NULL,
url TEXT NOT NULL,
title TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

/* add index for url */
CREATE UNIQUE INDEX IF NOT EXISTS bookmarks_url_idx ON bookmarks (url);

/* add index for bookmark_id */
CREATE UNIQUE INDEX IF NOT EXISTS bookmarks_bookmark_id_idx ON bookmarks (bookmark_id);

0 comments on commit 10d762d

Please sign in to comment.