Skip to content

Instantly share code, notes, and snippets.

@verdi327
Last active May 6, 2019 17:56
Show Gist options
  • Save verdi327/61b6204e1bf51da8c627f67fca358b5f to your computer and use it in GitHub Desktop.
Save verdi327/61b6204e1bf51da8c627f67fca358b5f to your computer and use it in GitHub Desktop.
DB Seed File for Bookmarks
DROP DATABASE if exists bookmark_app_db;
CREATE DATABASE bookmark_app_db;
\c bookmark_app_db;
DROP TABLE if exists bookmarks;
CREATE TABLE bookmarks (
id INTEGER primary key generated by default as identity,
title VARCHAR(100) UNIQUE NOT NULL,
url TEXT UNIQUE NOT NULL,
description TEXT,
rating CHAR(1),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
INSERT INTO bookmarks (title, url, description, rating)
VALUES
('Foo', 'foo.com', null, null),
('Bar', 'bar.com', null, null),
('Baz', 'baz.com', null, null),
('Foo Bar', 'http://foobar.com', 'foobar is great', '5'),
('Foo Baz', 'https://foobaz.com', 'foobaz is an even better description', '3');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment