Skip to content

Commit

Permalink
set up sqitch, db, and create table
Browse files Browse the repository at this point in the history
  • Loading branch information
BCerki committed Feb 23, 2022
1 parent 62e0df9 commit dac185d
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 0 deletions.
7 changes: 7 additions & 0 deletions schema/deploy/todo_app.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Deploy todo_app:todo_appschema to pg

BEGIN;

CREATE SCHEMA todo_app;

COMMIT;
16 changes: 16 additions & 0 deletions schema/deploy/todos.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Deploy todo_app:todos to pg
-- requires: todo_app

BEGIN;

SET client_min_messages = 'warning';

CREATE TABLE todo_app.todos (
id integer primary key generated always as identity,
task TEXT NOT NULL,
completed BOOLEAN NOT NULL,
date_created TIMESTAMPTZ NOT NULL DEFAULT NOW(),
date_updated TIMESTAMPTZ NOT NULL
);

COMMIT;
7 changes: 7 additions & 0 deletions schema/revert/todo_app.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Revert todo_app:todo_appschema from pg

BEGIN;

DROP SCHEMA todo_app;

COMMIT;
7 changes: 7 additions & 0 deletions schema/revert/todos.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Revert todo_app:todos from pg

BEGIN;

DROP TABLE todo_app.todos;

COMMIT;
8 changes: 8 additions & 0 deletions schema/sqitch.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[core]
engine = pg
# plan_file = sqitch.plan
# top_dir = .
[engine "pg"]
target = todo_app
[target "todo_app"]
uri = db:pg://localhost/todo_app
6 changes: 6 additions & 0 deletions schema/sqitch.plan
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
%syntax-version=1.0.0
%project=todo_app
%uri=https://github.com/button-inc/button-onboarding

todo_appschema 2022-02-23T18:45:03Z Brianna Cerkiewicz <briannacerkiewicz@pop-os> # Add schema for all todo app objects.
data [todo_appschema] 2022-02-23T19:17:10Z Brianna Cerkiewicz <briannacerkiewicz@pop-os> # Creates table to hold app data.
7 changes: 7 additions & 0 deletions schema/verify/todo_app.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Verify todo_app:todo_appschema on pg

BEGIN;

-- XXX Add verifications here.

ROLLBACK;
9 changes: 9 additions & 0 deletions schema/verify/todos.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Verify todo_app:todos on pg

BEGIN;

SELECT task, completed, date_created, date_updated
FROM todo_app.todos
WHERE FALSE;

ROLLBACK;

0 comments on commit dac185d

Please sign in to comment.