Skip to content

Commit

Permalink
Tutorial update
Browse files Browse the repository at this point in the history
  • Loading branch information
liamfallon committed Dec 16, 2024
1 parent ad3c21c commit 82f08b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
26 changes: 0 additions & 26 deletions examples/tutorials/database-cache/db_repo.yaml

This file was deleted.

23 changes: 22 additions & 1 deletion examples/tutorials/database-cache/porch-db.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DROP TABLE IF EXISTS package_revisions;
DROP TABLE IF EXISTS packages;
DROP TABLE IF EXISTS repositories;
DROP TABLE IF EXISTS resources;

DROP TYPE IF EXISTS package_rev_lifecycle;

Expand All @@ -17,8 +18,10 @@ CREATE TABLE IF NOT EXISTS repositories (

CREATE TABLE IF NOT EXISTS packages (
namespace TEXT NOT NULL,
repo_name TEXT NOT NULL,
repo_name TEXT NOT NULL,
package_name TEXT NOT NULL,
meta JSONB NOT NULL,
spec JSONB NOT NULL,
updated TIMESTAMPTZ NOT NULL,
updatedby TEXT NOT NULL,
PRIMARY KEY (namespace, repo_name, package_name),
Expand All @@ -36,9 +39,27 @@ CREATE TABLE IF NOT EXISTS package_revisions (
package_name TEXT NOT NULL,
package_rev TEXT NOT NULL,
workspace_name TEXT NOT NULL,
meta JSONB NOT NULL,
spec JSONB NOT NULL,
updated TIMESTAMPTZ NOT NULL,
updatedby TEXT NOT NULL,
lifecycle package_rev_lifecycle NOT NULL,
PRIMARY KEY (namespace, repo_name, package_name, package_rev),
CONSTRAINT fk_package
FOREIGN KEY (namespace, repo_name, package_name)
REFERENCES packages (namespace, repo_name, package_name)
ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS resources (
namespace TEXT NOT NULL,
repo_name TEXT NOT NULL,
package_name TEXT NOT NULL,
package_rev TEXT NOT NULL,
workspace_name TEXT NOT NULL,
resource_key TEXT NOT NULL,
resource_value JSONB NOT NULL,
lifecycle package_rev_lifecycle NOT NULL,
resources BYTEA,
PRIMARY KEY (namespace, repo_name, package_name, package_rev),
CONSTRAINT fk_package
Expand Down

0 comments on commit 82f08b3

Please sign in to comment.