Skip to content

Commit

Permalink
chore: Another way to create enumerations
Browse files Browse the repository at this point in the history
  • Loading branch information
cuixiaorui committed Jul 7, 2024
1 parent b6cfd44 commit 8ed444c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Execute SQL script
run: |
psql -U test -d earthworm_test -h localhost -p 5480 -f /packages/db/init.sql
- name: Run database initialization command
run: pnpm db:init:test:ci

Expand Down
1 change: 0 additions & 1 deletion packages/db/init.sql

This file was deleted.

4 changes: 3 additions & 1 deletion packages/db/src/migrate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { sql } from "drizzle-orm";
import { migrate } from "drizzle-orm/postgres-js/migrator";

import { db } from "./db";

async function main() {
console.log("Running your migrations...");

// 创建一个枚举类型
await db.execute(sql`CREATE TYPE membership_type AS ENUM ('regular', 'premium');`);
await migrate(db, { migrationsFolder: "drizzle" });
console.log("Woohoo! Migrations completed!");
return;
Expand Down

0 comments on commit 8ed444c

Please sign in to comment.