Skip to content

Commit

Permalink
Merge pull request #1 from bmorrisondev/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
bmorrisondev authored Aug 13, 2024
2 parents d980e03 + 95cb3b3 commit 887232e
Show file tree
Hide file tree
Showing 14 changed files with 1,728 additions and 247 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/apply-migrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Apply schema migrations

on:
push:
branches:
- main

jobs:
apply_migrations:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: Apply migrations
run: drizzle-kit migrate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
.env
15 changes: 15 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Config } from "drizzle-kit";
import * as dotenv from 'dotenv'

dotenv.config({ path: '.env.local' })

export default {
schema: "./src/db/schema.ts",
out: "./drizzle",
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL as string,
},
verbose: true,
strict: true,
} satisfies Config;
14 changes: 14 additions & 0 deletions drizzle/0000_skinny_magma.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS "orgs" (
"org_id" text NOT NULL,
"stripe_customer_id" text NOT NULL,
"license_count" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "tasks" (
"id" serial PRIMARY KEY NOT NULL,
"name" text,
"is_done" boolean,
"owner_id" text,
"created_on" timestamp,
"created_by_id" text
);
1 change: 1 addition & 0 deletions drizzle/0001_loose_mojo.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "tasks" ADD COLUMN "description" text;
91 changes: 91 additions & 0 deletions drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"id": "aed8b706-2b02-4a0d-adb6-98dda79f56e5",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.orgs": {
"name": "orgs",
"schema": "",
"columns": {
"org_id": {
"name": "org_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"stripe_customer_id": {
"name": "stripe_customer_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"license_count": {
"name": "license_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.tasks": {
"name": "tasks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_done": {
"name": "is_done",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"owner_id": {
"name": "owner_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_on": {
"name": "created_on",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_by_id": {
"name": "created_by_id",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"sequences": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
97 changes: 97 additions & 0 deletions drizzle/meta/0001_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"id": "5c7421c6-afad-4f83-9795-8d11a0c4175f",
"prevId": "aed8b706-2b02-4a0d-adb6-98dda79f56e5",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.orgs": {
"name": "orgs",
"schema": "",
"columns": {
"org_id": {
"name": "org_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"stripe_customer_id": {
"name": "stripe_customer_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"license_count": {
"name": "license_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.tasks": {
"name": "tasks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_done": {
"name": "is_done",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"owner_id": {
"name": "owner_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_on": {
"name": "created_on",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_by_id": {
"name": "created_by_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"sequences": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
20 changes: 20 additions & 0 deletions drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1723516334993,
"tag": "0000_skinny_magma",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1723516412852,
"tag": "0001_loose_mojo",
"breakpoints": true
}
]
}
Loading

0 comments on commit 887232e

Please sign in to comment.