Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples #10

Merged
merged 6 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# How it could work

## Given

* A CoreDB cluster is deployed
* I have user credentials to deploy to it
* I have created a coredb project on my machine via `coredb init` command
* I create files according to coredb docs

## When

* I type `coredb deploy`

## Then

* My files are analyzed and good stuff happens in the CoreDB cluster
* `db/schemas` directory is parsed for changes, and migrations are generated
* potentially problematic migrations are flagged
* the cli steps me through the migrations one-by-one
* `instances` directory is parsed for instances of postgres to spin up, within which dataplane clusters, and with what limitations (this assumes that we have magic multi-master functionality, which doesn't exist yet)
* `apps` directory is parsed for apps to bundle into the postgres deployment (initially, only `actix` framework)
26 changes: 26 additions & 0 deletions examples/db/schemas/posts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[table]
schema = "main"
name = "posts"

[table.fields.id]
type = "int"
default = "autoincrement()"

[table.fields.createdAt]
type = "DateTime"
default = "now()"

[table.fields.updatedAt]
type = "DateTime"

[table.fields.title]
type = "VARCHAR(200)"
default = ""

[table.fields.body]
type = "VARCHAR"
default = ""

[table.fields.slug]
type = "VARCHAR(255)"
unique = true
9 changes: 9 additions & 0 deletions examples/instances/primary.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[instance]
name = "primary"
cpu = "2"
mem = "4096"
coredb_account_cluster = "google-us-west"

[tables]
include = ["posts"]

10 changes: 10 additions & 0 deletions examples/instances/read.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[instance]
name = "read"
cpu = "1"
mem = "1024"
read_only = true
coredb_account_cluster = "aws-us-east"

[tables]
include = ["posts"]