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

Add prompt template #75

Merged
merged 19 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ We use PGlite and Drizzle ORM for database management in this project. This sect

To update the database schema:

1. Modify the existing schema as needed in the `src/db/schema.ts` file.
1. Modify the existing schema as needed in the `src/database/schema.ts` file.
2. After making changes, run the following command to generate migration files:

```
Expand All @@ -58,7 +58,7 @@ To update the database schema:
npm run migrate:compile
```

This will create or update the `src/db/migrations.json` file. Note that migration files in the 'drizzle' directory won't affect the project until they are compiled into this JSON file, which is used in the actual migration process.
This will create or update the `src/database/migrations.json` file. Note that migration files in the 'drizzle' directory won't affect the project until they are compiled into this JSON file, which is used in the actual migration process.

### Handling Migration Files

Expand Down
5 changes: 4 additions & 1 deletion compile-migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const fs = require('node:fs/promises')
async function compileMigrations() {
const migrations = readMigrationFiles({ migrationsFolder: './drizzle/' })

await fs.writeFile('./src/db/migrations.json', JSON.stringify(migrations))
await fs.writeFile(
'./src/database/migrations.json',
JSON.stringify(migrations),
)

console.log('Migrations compiled!')
}
Expand Down
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { defineConfig } from 'drizzle-kit'

export default defineConfig({
dialect: 'postgresql',
schema: './src/db/schema.ts',
schema: './src/database/schema.ts',
})
8 changes: 8 additions & 0 deletions drizzle/0005_create_template_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS "template" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text NOT NULL,
"data" jsonb NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "template_name_unique" UNIQUE("name")
);
Loading
Loading