Skip to content

Commit ca8ca87

Browse files
authored
1667 xata lite migration (#1670)
* add export button for project and payment table * migration * some fix and env var change * fix db type issue * small edits * fix project member preview api permission * edit docs
1 parent f0766df commit ca8ca87

35 files changed

Lines changed: 229 additions & 159 deletions

.env.example

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,11 @@ UPSTASH_REDIS_REST_TOKEN=upstash-redis-token
3737
NEXT_PUBLIC_MAPBOX_API=mapbox-key
3838

3939
# Cron (openssl rand -hex 32)
40-
CRON_SECRET=some-random-secret
40+
CRON_SECRET=some-random-secret
41+
42+
# Resend
43+
RESEND_API_KEY=
44+
45+
# Supabase
46+
SUPABASE_DB_URL=
47+
SUPABASE_ANON_KEY=

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Bootstrapped using the create-t3-app using:
1414
- [Drizzle ORM](https://orm.drizzle.team/docs/overview)
1515
- [Clerk authentication](https://clerk.com/docs)
1616
- [Vercel](https://vercel.com)
17-
- [Xata](https://app.xata.io)
17+
- [Supabase](https://supabase.com/)
18+
- Deprecated: [Xata lite](https://app.xata.io)
1819

1920
We use [pnpm](https://pnpm.io/) as the package manager for this project.
2021

@@ -34,20 +35,25 @@ pnpm upgrade -L
3435
# Database migration
3536
pnpm drizzle-kit pull
3637
pnpm drizzle-kit generate
37-
pnpm drizzle-kit migrate
38+
pnpm drizzle-kit push
3839
```
3940

41+
### Notes
42+
43+
- UTC time
44+
- When you make changes to the DB, please back up the data first.
45+
4046
## Planned Features
4147

4248
### Project Integration Enhancements
4349

44-
- Profiles will soon showcase the projects that users have contributed to, highlighting their work and collaborations.
50+
- Profiles showcase the projects that users have contributed to, highlighting their work and collaborations.
4551
- Applications to join our seasonal Summer and Winter projects will be directly accessible through the site for our members.
4652
- Committee members and Administrators will gain the ability to upload project specifics directly to the platform.
4753

4854
### User Profile Enhancements
4955

50-
- The platform will support multiple role assignments for users, offering tailored experiences based on their involvement and interests.
56+
- The platform supports multiple role assignments for users, offering tailored experiences based on their involvement and interests.
5157
- Enhanced profile customization options will be introduced.
5258

5359
### Event Participation and Management

drizzle.config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { defineConfig } from "drizzle-kit"
22

3-
import { getXataClient } from "~/server/db/xata"
4-
53
export default defineConfig({
64
out: "./src/server/db/migrations",
75
schema: "./src/server/db/schema.ts",
86
verbose: true,
97
dialect: "postgresql",
108
tablesFilter: ["cfc-website_*"],
119
dbCredentials: {
12-
url: getXataClient().sql.connectionString,
10+
url: process.env.SUPABASE_DB_URL!,
1311
},
1412
})

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"next": "14.2.26",
7272
"next-themes": "0.3.0",
7373
"pg": "^8.14.1",
74+
"pg-native": "^3.5.2",
7475
"react": "18.3.1",
7576
"react-day-picker": "8.10.0",
7677
"react-dom": "18.3.1",
@@ -96,6 +97,7 @@
9697
"@types/eslint": "8.56.6",
9798
"@types/mapbox-gl": "3.1.0",
9899
"@types/node": "20.12.2",
100+
"@types/pg": "^8.16.0",
99101
"@types/react": "18.3.3",
100102
"@types/react-dom": "18.2.23",
101103
"@typescript-eslint/eslint-plugin": "7.4.0",

pnpm-lock.yaml

Lines changed: 65 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/dashboard/(root)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default async function Dashboard() {
1313
Here you can see our upcoming projects and the projects you have participated in. You can apply for new
1414
projects here if we link the application form.
1515
</p>
16-
<div className="flex h-full mb-8">
16+
<div className="h-full mb-8">
1717
<DashboardContent />
1818
</div>
1919
</div>

src/app/dashboard/admin/@analytics/count.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import Link from "next/link"
2-
31
import { api } from "~/trpc/server"
42

53
interface CardProps {
@@ -25,13 +23,14 @@ const Card = (props: CardProps) => {
2523

2624
const Count = async () => {
2725
const count = await api.admin.analytics.getUserCount.query()
26+
const projectCount = await api.admin.analytics.getProjectCount.query()
2827

2928
return (
3029
<>
3130
<Card heading="Users" count={count.users} icon="group" />
3231
<Card heading="Members" count={count.members} icon="group" />
33-
<Card heading="Projects" count={"N/A"} icon="devices" />
34-
<Card heading="Events" count={"N/A"} icon="event" />
32+
<Card heading="Projects" count={projectCount.publicProjects} icon="devices" />
33+
{/* <Card heading="Events" count={"N/A"} icon="event" /> */}
3534
</>
3635
)
3736
}

src/app/dashboard/admin/@tools/page.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ export default async function AdminUserTable() {
1212
<div className="flex h-[50px] items-center p-1">
1313
<h2 className="text-2xl font-semibold">Tools</h2>
1414
</div>
15-
<div className="grid grid-cols-1 md:grid-cols-5 gap-4">
16-
<UpdateEmail />
17-
</div>
1815
<div className=" flex flex-col space-y-4 my-4">
1916
<ExportButton data={projects} label="projects" />
2017
<ExportButton data={payments} label="payments" />

0 commit comments

Comments
 (0)