From 474481a764b30eef57535939214018d89825fb29 Mon Sep 17 00:00:00 2001 From: markisayan Date: Mon, 25 Jul 2022 13:14:25 -0400 Subject: [PATCH 1/5] Run sqitch init --- .gitignore | 212 +++++++++++++++++++++++++++++++++++++++++++++ schema/sqitch.conf | 8 ++ schema/sqitch.plan | 3 + 3 files changed, 223 insertions(+) create mode 100644 .gitignore create mode 100644 schema/sqitch.conf create mode 100644 schema/sqitch.plan diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4866399 --- /dev/null +++ b/.gitignore @@ -0,0 +1,212 @@ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +.idea +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + + +dist/ \ No newline at end of file diff --git a/schema/sqitch.conf b/schema/sqitch.conf new file mode 100644 index 0000000..b02482b --- /dev/null +++ b/schema/sqitch.conf @@ -0,0 +1,8 @@ +[core] + engine = pg + # plan_file = sqitch.plan + # top_dir = . +# [engine "pg"] + # target = db:pg: + # registry = sqitch + # client = /usr/bin/psql diff --git a/schema/sqitch.plan b/schema/sqitch.plan new file mode 100644 index 0000000..308adb8 --- /dev/null +++ b/schema/sqitch.plan @@ -0,0 +1,3 @@ +%syntax-version=1.0.0 +%project=todo_app + From 64860d581358bfcea36bddefbad87a2bd86e0bef Mon Sep 17 00:00:00 2001 From: markisayan Date: Mon, 25 Jul 2022 16:43:08 -0400 Subject: [PATCH 2/5] Add todo_app schema --- schema/deploy/todo_app.sql | 7 +++++++ schema/revert/todo_app.sql | 7 +++++++ schema/sqitch.conf | 8 ++++---- schema/sqitch.plan | 1 + schema/verify/todo_app.sql | 7 +++++++ 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 schema/deploy/todo_app.sql create mode 100644 schema/revert/todo_app.sql create mode 100644 schema/verify/todo_app.sql diff --git a/schema/deploy/todo_app.sql b/schema/deploy/todo_app.sql new file mode 100644 index 0000000..f02eb07 --- /dev/null +++ b/schema/deploy/todo_app.sql @@ -0,0 +1,7 @@ +-- Deploy todo_app:todo_app to pg + +BEGIN; + +CREATE SCHEMA todo_app; + +COMMIT; diff --git a/schema/revert/todo_app.sql b/schema/revert/todo_app.sql new file mode 100644 index 0000000..840d070 --- /dev/null +++ b/schema/revert/todo_app.sql @@ -0,0 +1,7 @@ +-- Revert todo_app:todo_app from pg + +BEGIN; + +DROP SCHEMA todo_app.todo_app; + +COMMIT; diff --git a/schema/sqitch.conf b/schema/sqitch.conf index b02482b..e03c0bc 100644 --- a/schema/sqitch.conf +++ b/schema/sqitch.conf @@ -2,7 +2,7 @@ engine = pg # plan_file = sqitch.plan # top_dir = . -# [engine "pg"] - # target = db:pg: - # registry = sqitch - # client = /usr/bin/psql +[engine "pg"] + target = db:pg:todo_app + registry = sqitch + client = psql diff --git a/schema/sqitch.plan b/schema/sqitch.plan index 308adb8..688ec30 100644 --- a/schema/sqitch.plan +++ b/schema/sqitch.plan @@ -1,3 +1,4 @@ %syntax-version=1.0.0 %project=todo_app +todo_app 2022-07-25T20:21:59Z Mark Isayan # Add todo_app schema diff --git a/schema/verify/todo_app.sql b/schema/verify/todo_app.sql new file mode 100644 index 0000000..b928a1a --- /dev/null +++ b/schema/verify/todo_app.sql @@ -0,0 +1,7 @@ +-- Verify todo_app:todo_app on pg + +BEGIN; + + + +ROLLBACK; From c9932c134566e7f41bc9487e810fe49533b7eb1a Mon Sep 17 00:00:00 2001 From: markisayan Date: Mon, 25 Jul 2022 17:34:18 -0400 Subject: [PATCH 3/5] Add tasks database --- schema/deploy/tasks.sql | 14 ++++++++++++++ schema/revert/tasks.sql | 7 +++++++ schema/sqitch.plan | 1 + schema/verify/tasks.sql | 11 +++++++++++ schema/verify/todo_app.sql | 3 +++ 5 files changed, 36 insertions(+) create mode 100644 schema/deploy/tasks.sql create mode 100644 schema/revert/tasks.sql create mode 100644 schema/verify/tasks.sql diff --git a/schema/deploy/tasks.sql b/schema/deploy/tasks.sql new file mode 100644 index 0000000..59d7c85 --- /dev/null +++ b/schema/deploy/tasks.sql @@ -0,0 +1,14 @@ +-- Deploy todo_app:tasks to pg +-- requires: todo_app + +BEGIN; + +CREATE TABLE todo_app.tasks ( + id Serial PRIMARY KEY, + tasks TEXT NOT NULL, + completed BOOLEAN NOT NULL, + date_created TIMESTAMP NOT NULL DEFAULT NOW(), + date_updated TIMESTAMP NOT NULL DEFAULT NOW() +); + +COMMIT; diff --git a/schema/revert/tasks.sql b/schema/revert/tasks.sql new file mode 100644 index 0000000..e587ad9 --- /dev/null +++ b/schema/revert/tasks.sql @@ -0,0 +1,7 @@ +-- Revert todo_app:tasks from pg + +BEGIN; + +DROP TABLE todo_app.tasks; + +COMMIT; diff --git a/schema/sqitch.plan b/schema/sqitch.plan index 688ec30..a76c6e5 100644 --- a/schema/sqitch.plan +++ b/schema/sqitch.plan @@ -2,3 +2,4 @@ %project=todo_app todo_app 2022-07-25T20:21:59Z Mark Isayan # Add todo_app schema +tasks [todo_app] 2022-07-25T21:10:56Z Mark Isayan # Add tasks table diff --git a/schema/verify/tasks.sql b/schema/verify/tasks.sql new file mode 100644 index 0000000..fe4885e --- /dev/null +++ b/schema/verify/tasks.sql @@ -0,0 +1,11 @@ +-- Verify todo_app:tasks on pg + +BEGIN; + +SELECT 1 / COUNT(*) +FROM information_schema.tables +WHERE table_schema = 'todo_app' + AND table_name = 'tasks'; + + +ROLLBACK; diff --git a/schema/verify/todo_app.sql b/schema/verify/todo_app.sql index b928a1a..a748558 100644 --- a/schema/verify/todo_app.sql +++ b/schema/verify/todo_app.sql @@ -2,6 +2,9 @@ BEGIN; +SELECT 1/COUNT(*) +FROM information_schema.schemata +WHERE schema_name = 'todo_app'; ROLLBACK; From 1afa187116c977040f7c600a35c6f032a7cf5f00 Mon Sep 17 00:00:00 2001 From: markisayan Date: Mon, 25 Jul 2022 17:36:33 -0400 Subject: [PATCH 4/5] Fix todo_app revert script --- schema/revert/todo_app.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/revert/todo_app.sql b/schema/revert/todo_app.sql index 840d070..0b35f5c 100644 --- a/schema/revert/todo_app.sql +++ b/schema/revert/todo_app.sql @@ -2,6 +2,6 @@ BEGIN; -DROP SCHEMA todo_app.todo_app; +DROP SCHEMA todo_app; COMMIT; From 59877796cdb188893ce878c436ee15889e5e0fdf Mon Sep 17 00:00:00 2001 From: markisayan Date: Mon, 25 Jul 2022 19:08:41 -0400 Subject: [PATCH 5/5] Fix typo --- schema/deploy/tasks.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/deploy/tasks.sql b/schema/deploy/tasks.sql index 59d7c85..af1769a 100644 --- a/schema/deploy/tasks.sql +++ b/schema/deploy/tasks.sql @@ -5,7 +5,7 @@ BEGIN; CREATE TABLE todo_app.tasks ( id Serial PRIMARY KEY, - tasks TEXT NOT NULL, + task TEXT NOT NULL, completed BOOLEAN NOT NULL, date_created TIMESTAMP NOT NULL DEFAULT NOW(), date_updated TIMESTAMP NOT NULL DEFAULT NOW()