diff --git a/apps/ai/src/components/publish/blog-card.tsx b/apps/ai/src/components/publish/blog-card.tsx
index ebf67eac..df021c4b 100644
--- a/apps/ai/src/components/publish/blog-card.tsx
+++ b/apps/ai/src/components/publish/blog-card.tsx
@@ -18,7 +18,7 @@ export default function BlogCard({ data }: BlogCardProps) {
{
while (!unique) {
newName = uniqueNamesGenerator(config);
- const existingUser: User | null = await db.user.findFirst({
+ const existingUser = await db.user.findFirst({
where: { displayName: newName },
});
diff --git a/apps/ai/src/lib/types/next-auth.d.ts b/apps/ai/src/lib/types/next-auth.d.ts
index 902dcc25..4eaafcb8 100644
--- a/apps/ai/src/lib/types/next-auth.d.ts
+++ b/apps/ai/src/lib/types/next-auth.d.ts
@@ -1,6 +1,6 @@
// :: Authentication Module Types ::
-import type { User as NextAuthUser } from 'next-auth';
+import type { DefaultSession, User as NextAuthUser } from 'next-auth';
import 'next-auth/jwt';
@@ -21,6 +21,6 @@ declare module 'next-auth' {
interface Session {
user: User & {
id: UserId;
- };
+ } & DefaultSession['user'];
}
}
diff --git a/packages/db/drizzle.config.ts b/packages/db/drizzle.config.ts
index c578a238..fac79282 100644
--- a/packages/db/drizzle.config.ts
+++ b/packages/db/drizzle.config.ts
@@ -10,7 +10,7 @@ if (!process.env.DREON_DIRECT_URL) {
export default {
schema: './src/schema',
- out: './drizzle',
+ out: './src/migrations',
driver: 'pg',
dbCredentials: {
connectionString: process.env.DREON_DIRECT_URL,
diff --git a/packages/db/src/index.ts b/packages/db/src/index.ts
index 52d2a74c..a0aba77a 100644
--- a/packages/db/src/index.ts
+++ b/packages/db/src/index.ts
@@ -1,42 +1,42 @@
import { neon, neonConfig } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';
-import * as accounts from './schema/accounts';
-import * as adminRoleEnum from './schema/admin-role-enum';
-import * as admins from './schema/admins';
-import * as membershipRoleEnum from './schema/membership-role-enum';
-import * as memberships from './schema/memberships';
-import * as posts from './schema/posts';
-import * as sessions from './schema/sessions';
-import * as sites from './schema/sites';
-import * as stripeCustomers from './schema/stripe-customers';
-import * as stripeSubscriptionStatusEnum from './schema/stripe-subscription-status-enum';
-import * as stripeSubscriptions from './schema/stripe-subscriptions';
-import * as teamInvitations from './schema/team-invitations';
-import * as teams from './schema/teams';
-import * as users from './schema/users';
-import * as verificationTokens from './schema/verification-tokens';
+import * as accountsTable from './schema/accounts';
+import * as adminRoleEnumTable from './schema/admin-role-enum';
+import * as adminsTable from './schema/admins';
+import * as membershipRoleEnumTable from './schema/membership-role-enum';
+import * as membershipsTable from './schema/memberships';
+import * as postsTable from './schema/posts';
+import * as sessionsTable from './schema/sessions';
+import * as sitesTable from './schema/sites';
+import * as stripeCustomersTable from './schema/stripe-customers';
+import * as stripeSubscriptionStatusEnumTable from './schema/stripe-subscription-status-enum';
+import * as stripeSubscriptionsTable from './schema/stripe-subscriptions';
+import * as teamInvitationsTable from './schema/team-invitations';
+import * as teamsTable from './schema/teams';
+import * as usersTable from './schema/users';
+import * as verificationTokensTable from './schema/verification-tokens';
export const schema = {
- ...accounts,
- ...adminRoleEnum,
- ...admins,
- ...membershipRoleEnum,
- ...memberships,
- ...posts,
- ...sessions,
- ...sites,
- ...stripeCustomers,
- ...stripeSubscriptionStatusEnum,
- ...stripeSubscriptions,
- ...teamInvitations,
- ...teams,
- ...users,
- ...verificationTokens,
+ ...accountsTable,
+ ...adminRoleEnumTable,
+ ...adminsTable,
+ ...membershipRoleEnumTable,
+ ...membershipsTable,
+ ...postsTable,
+ ...sessionsTable,
+ ...sitesTable,
+ ...stripeCustomersTable,
+ ...stripeSubscriptionStatusEnumTable,
+ ...stripeSubscriptionsTable,
+ ...teamInvitationsTable,
+ ...teamsTable,
+ ...usersTable,
+ ...verificationTokensTable,
};
export { myPgTable as tableCreator } from './schema/_table';
-
+export * from './statements/statements';
export * from 'drizzle-orm';
export type { PgTableFn } from 'drizzle-orm/pg-core';
diff --git a/packages/db/drizzle/0000_bright_orphan.sql b/packages/db/src/migrations/0000_bright_orphan.sql
similarity index 100%
rename from packages/db/drizzle/0000_bright_orphan.sql
rename to packages/db/src/migrations/0000_bright_orphan.sql
diff --git a/packages/db/src/migrations/0001_light_slapstick.sql b/packages/db/src/migrations/0001_light_slapstick.sql
new file mode 100644
index 00000000..7562382a
--- /dev/null
+++ b/packages/db/src/migrations/0001_light_slapstick.sql
@@ -0,0 +1,71 @@
+ALTER TABLE "av_accounts" DROP CONSTRAINT "av_accounts_userId_av_users_id_fk";
+--> statement-breakpoint
+ALTER TABLE "av_admins" DROP CONSTRAINT "av_admins_user_id_av_users_id_fk";
+--> statement-breakpoint
+ALTER TABLE "av_memberships" DROP CONSTRAINT "av_memberships_team_id_av_teams_id_fk";
+--> statement-breakpoint
+ALTER TABLE "av_posts" DROP CONSTRAINT "av_posts_user_id_av_users_id_fk";
+--> statement-breakpoint
+ALTER TABLE "av_sessions" DROP CONSTRAINT "av_sessions_userId_av_users_id_fk";
+--> statement-breakpoint
+ALTER TABLE "av_sites" DROP CONSTRAINT "av_sites_team_id_av_teams_id_fk";
+--> statement-breakpoint
+ALTER TABLE "av_stripe_customer" DROP CONSTRAINT "av_stripe_customer_user_id_av_users_id_fk";
+--> statement-breakpoint
+ALTER TABLE "av_stripe_subscriptions" DROP CONSTRAINT "av_stripe_subscriptions_team_id_av_teams_id_fk";
+--> statement-breakpoint
+ALTER TABLE "av_team_invitations" DROP CONSTRAINT "av_team_invitations_team_id_av_teams_id_fk";
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_accounts" ADD CONSTRAINT "av_accounts_userId_av_users_id_fk" FOREIGN KEY ("userId") REFERENCES "av_users"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_admins" ADD CONSTRAINT "av_admins_user_id_av_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "av_users"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_memberships" ADD CONSTRAINT "av_memberships_team_id_av_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "av_teams"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_posts" ADD CONSTRAINT "av_posts_user_id_av_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "av_users"("id") ON DELETE cascade ON UPDATE cascade;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_sessions" ADD CONSTRAINT "av_sessions_userId_av_users_id_fk" FOREIGN KEY ("userId") REFERENCES "av_users"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_sites" ADD CONSTRAINT "av_sites_team_id_av_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "av_teams"("id") ON DELETE cascade ON UPDATE cascade;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_stripe_customer" ADD CONSTRAINT "av_stripe_customer_user_id_av_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "av_users"("id") ON DELETE no action ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_stripe_subscriptions" ADD CONSTRAINT "av_stripe_subscriptions_team_id_av_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "av_teams"("id") ON DELETE no action ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "av_team_invitations" ADD CONSTRAINT "av_team_invitations_team_id_av_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "av_teams"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION
+ WHEN duplicate_object THEN null;
+END $$;
diff --git a/packages/db/drizzle/meta/0000_snapshot.json b/packages/db/src/migrations/meta/0000_snapshot.json
similarity index 100%
rename from packages/db/drizzle/meta/0000_snapshot.json
rename to packages/db/src/migrations/meta/0000_snapshot.json
diff --git a/packages/db/src/migrations/meta/0001_snapshot.json b/packages/db/src/migrations/meta/0001_snapshot.json
new file mode 100644
index 00000000..37f703ea
--- /dev/null
+++ b/packages/db/src/migrations/meta/0001_snapshot.json
@@ -0,0 +1,1122 @@
+{
+ "id": "9edb383f-5173-4fde-b6df-dea275880c46",
+ "prevId": "db1ac720-eced-4fbb-b413-5f5bb1774fe8",
+ "version": "5",
+ "dialect": "pg",
+ "tables": {
+ "av_accounts": {
+ "name": "av_accounts",
+ "schema": "",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "av_accounts_userId_av_users_id_fk": {
+ "name": "av_accounts_userId_av_users_id_fk",
+ "tableFrom": "av_accounts",
+ "tableTo": "av_users",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "av_accounts_provider_providerAccountId_pk": {
+ "name": "av_accounts_provider_providerAccountId_pk",
+ "columns": ["provider", "providerAccountId"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "av_admins": {
+ "name": "av_admins",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(255)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "admin_roles_enum",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "admin_user_id_idx": {
+ "name": "admin_user_id_idx",
+ "columns": ["user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "av_admins_user_id_av_users_id_fk": {
+ "name": "av_admins_user_id_av_users_id_fk",
+ "tableFrom": "av_admins",
+ "tableTo": "av_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "av_memberships": {
+ "name": "av_memberships",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(255)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "membership_roles_enum",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "accepted": {
+ "name": "accepted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "membership_user_id_site_id_idx": {
+ "name": "membership_user_id_site_id_idx",
+ "columns": ["user_id", "team_id"],
+ "isUnique": true
+ },
+ "membership_team_id_idx": {
+ "name": "membership_team_id_idx",
+ "columns": ["team_id"],
+ "isUnique": false
+ },
+ "membership_user_id_idx": {
+ "name": "membership_user_id_idx",
+ "columns": ["user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "av_memberships_team_id_av_teams_id_fk": {
+ "name": "av_memberships_team_id_av_teams_id_fk",
+ "tableFrom": "av_memberships",
+ "tableTo": "av_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "av_memberships_user_id_av_users_id_fk": {
+ "name": "av_memberships_user_id_av_users_id_fk",
+ "tableFrom": "av_memberships",
+ "tableTo": "av_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "av_posts": {
+ "name": "av_posts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(255)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'https://xa09cquxuk1zok5f.public.blob.vercel-storage.com/IoGBwOC-9CvtiYRSGCNZAuY0UAemMZ0UzFtuZ7.jpeg'"
+ },
+ "image_blur_hash": {
+ "name": "image_blur_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAhCAYAAACbffiEAAAACXBIWXMAABYlAAAWJQFJUiTwAAABfUlEQVR4nN3XyZLDIAwE0Pz/v3q3r55JDlSBplsIEI49h76k4opexCK/juP4eXjOT149f2Tf9ySPgcjCc7kdpBTgDPKByKK2bTPFEdMO0RDrusJ0wLRBGCIuelmWJAjkgPGDSIQEMBDCfA2CEPM80+Qwl0JkNxBimiaYGOTUlXYI60YoehzHJDEm7kxjV3whOQTD3AaCuhGKHoYhyb+CBMwjIAFz647kTqyapdV4enGINuDJMSScPmijSwjCaHeLcT77C7EC0C1ugaCTi2HYfAZANgj6Z9A8xY5eiYghDMNQBJNCWhASot0jGsSCUiHWZcSGQjaWWCDaGMOWnsCcn2QhVkRuxqqNxMSdUSElCDbp1hbNOsa6Ugxh7xXauF4DyM1m5BLtCylBXgaxvPXVwEoOBjeIFVODtW74oj1yBQah3E8tyz3SkpolKS9Geo9YMD1QJR1Go4oJkgO1pgbNZq0AOUPChyjvh7vlXaQa+X1UXwKxgHokB2XPxbX+AnijwIU4ahazAAAAAElFTkSuQmCC'"
+ },
+ "published": {
+ "name": "published",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "post_slug_site_id_idx": {
+ "name": "post_slug_site_id_idx",
+ "columns": ["slug", "site_id"],
+ "isUnique": true
+ },
+ "post_user_id_idx": {
+ "name": "post_user_id_idx",
+ "columns": ["user_id"],
+ "isUnique": false
+ },
+ "post_site_id_idx": {
+ "name": "post_site_id_idx",
+ "columns": ["site_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "av_posts_user_id_av_users_id_fk": {
+ "name": "av_posts_user_id_av_users_id_fk",
+ "tableFrom": "av_posts",
+ "tableTo": "av_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "av_posts_team_id_av_teams_id_fk": {
+ "name": "av_posts_team_id_av_teams_id_fk",
+ "tableFrom": "av_posts",
+ "tableTo": "av_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "av_posts_site_id_av_sites_id_fk": {
+ "name": "av_posts_site_id_av_sites_id_fk",
+ "tableFrom": "av_posts",
+ "tableTo": "av_sites",
+ "columnsFrom": ["site_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "av_sessions": {
+ "name": "av_sessions",
+ "schema": "",
+ "columns": {
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "av_sessions_userId_av_users_id_fk": {
+ "name": "av_sessions_userId_av_users_id_fk",
+ "tableFrom": "av_sessions",
+ "tableTo": "av_users",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "av_sites": {
+ "name": "av_sites",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(255)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'https://xa09cquxuk1zok5f.public.blob.vercel-storage.com/SgQEI5B-KRu6KULIVq8OXj0eKRn7drD4RRCGf1.png'"
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'https://xa09cquxuk1zok5f.public.blob.vercel-storage.com/qbRcbkW-GSx1IuBuKyVEbOJkFlkxBCVaCy5qfD.jpeg'"
+ },
+ "image_blur_hash": {
+ "name": "image_blur_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAhCAYAAACbffiEAAAACXBIWXMAABYlAAAWJQFJUiTwAAABfUlEQVR4nN3XyZLDIAwE0Pz/v3q3r55JDlSBplsIEI49h76k4opexCK/juP4eXjOT149f2Tf9ySPgcjCc7kdpBTgDPKByKK2bTPFEdMO0RDrusJ0wLRBGCIuelmWJAjkgPGDSIQEMBDCfA2CEPM80+Qwl0JkNxBimiaYGOTUlXYI60YoehzHJDEm7kxjV3whOQTD3AaCuhGKHoYhyb+CBMwjIAFz647kTqyapdV4enGINuDJMSScPmijSwjCaHeLcT77C7EC0C1ugaCTi2HYfAZANgj6Z9A8xY5eiYghDMNQBJNCWhASot0jGsSCUiHWZcSGQjaWWCDaGMOWnsCcn2QhVkRuxqqNxMSdUSElCDbp1hbNOsa6Ugxh7xXauF4DyM1m5BLtCylBXgaxvPXVwEoOBjeIFVODtW74oj1yBQah3E8tyz3SkpolKS9Geo9YMD1QJR1Go4oJkgO1pgbNZq0AOUPChyjvh7vlXaQa+X1UXwKxgHokB2XPxbX+AnijwIU4ahazAAAAAElFTkSuQmCC'"
+ },
+ "subdomain": {
+ "name": "subdomain",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "custom_domain": {
+ "name": "custom_domain",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "font": {
+ "name": "font",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'font-cal'"
+ },
+ "message_404": {
+ "name": "message_404",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'Oops! You found a page that does not exist.'"
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "site_user_id_idx": {
+ "name": "site_user_id_idx",
+ "columns": ["user_id"],
+ "isUnique": false
+ },
+ "site_team_id_idx": {
+ "name": "site_team_id_idx",
+ "columns": ["team_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "av_sites_team_id_av_teams_id_fk": {
+ "name": "av_sites_team_id_av_teams_id_fk",
+ "tableFrom": "av_sites",
+ "tableTo": "av_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "av_sites_user_id_av_users_id_fk": {
+ "name": "av_sites_user_id_av_users_id_fk",
+ "tableFrom": "av_sites",
+ "tableTo": "av_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "av_sites_subdomain_unique": {
+ "name": "av_sites_subdomain_unique",
+ "nullsNotDistinct": false,
+ "columns": ["subdomain"]
+ },
+ "av_sites_custom_domain_unique": {
+ "name": "av_sites_custom_domain_unique",
+ "nullsNotDistinct": false,
+ "columns": ["custom_domain"]
+ }
+ }
+ },
+ "av_stripe_customer": {
+ "name": "av_stripe_customer",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(255)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "av_stripe_customer_user_id_av_users_id_fk": {
+ "name": "av_stripe_customer_user_id_av_users_id_fk",
+ "tableFrom": "av_stripe_customer",
+ "tableTo": "av_users",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "av_stripe_customer_team_id_av_teams_id_fk": {
+ "name": "av_stripe_customer_team_id_av_teams_id_fk",
+ "tableFrom": "av_stripe_customer",
+ "tableTo": "av_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "av_stripe_customer_user_id_unique": {
+ "name": "av_stripe_customer_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id"]
+ },
+ "av_stripe_customer_team_id_unique": {
+ "name": "av_stripe_customer_team_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["team_id"]
+ },
+ "av_stripe_customer_stripe_customer_id_unique": {
+ "name": "av_stripe_customer_stripe_customer_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["stripe_customer_id"]
+ }
+ }
+ },
+ "av_stripe_subscriptions": {
+ "name": "av_stripe_subscriptions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(255)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "stripe_subscriptions_status_enum",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_price_id": {
+ "name": "stripe_price_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_current_period_end": {
+ "name": "stripe_current_period_end",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "stripe_subscription_team_id_idx": {
+ "name": "stripe_subscription_team_id_idx",
+ "columns": ["team_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "av_stripe_subscriptions_team_id_av_teams_id_fk": {
+ "name": "av_stripe_subscriptions_team_id_av_teams_id_fk",
+ "tableFrom": "av_stripe_subscriptions",
+ "tableTo": "av_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "av_stripe_subscriptions_stripe_customer_id_av_stripe_customer_stripe_customer_id_fk": {
+ "name": "av_stripe_subscriptions_stripe_customer_id_av_stripe_customer_stripe_customer_id_fk",
+ "tableFrom": "av_stripe_subscriptions",
+ "tableTo": "av_stripe_customer",
+ "columnsFrom": ["stripe_customer_id"],
+ "columnsTo": ["stripe_customer_id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "av_stripe_subscriptions_team_id_unique": {
+ "name": "av_stripe_subscriptions_team_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["team_id"]
+ },
+ "av_stripe_subscriptions_stripe_customer_id_unique": {
+ "name": "av_stripe_subscriptions_stripe_customer_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["stripe_customer_id"]
+ },
+ "av_stripe_subscriptions_stripe_subscription_id_unique": {
+ "name": "av_stripe_subscriptions_stripe_subscription_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["stripe_subscription_id"]
+ },
+ "av_stripe_subscriptions_stripe_price_id_unique": {
+ "name": "av_stripe_subscriptions_stripe_price_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["stripe_price_id"]
+ }
+ }
+ },
+ "av_team_invitations": {
+ "name": "av_team_invitations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(255)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_slug": {
+ "name": "team_slug",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invited_by": {
+ "name": "invited_by",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "membership_roles_enum",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "invites_team_id_email_idx": {
+ "name": "invites_team_id_email_idx",
+ "columns": ["team_id", "email"],
+ "isUnique": true
+ },
+ "invites_team_id_idx": {
+ "name": "invites_team_id_idx",
+ "columns": ["team_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "av_team_invitations_team_id_av_teams_id_fk": {
+ "name": "av_team_invitations_team_id_av_teams_id_fk",
+ "tableFrom": "av_team_invitations",
+ "tableTo": "av_teams",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "av_team_invitations_invited_by_av_users_id_fk": {
+ "name": "av_team_invitations_invited_by_av_users_id_fk",
+ "tableFrom": "av_team_invitations",
+ "tableTo": "av_users",
+ "columnsFrom": ["invited_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "av_team_invitations_token_unique": {
+ "name": "av_team_invitations_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ }
+ },
+ "av_teams": {
+ "name": "av_teams",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(255)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'https://xa09cquxuk1zok5f.public.blob.vercel-storage.com/SgQEI5B-KRu6KULIVq8OXj0eKRn7drD4RRCGf1.png'"
+ },
+ "image_blur_hash": {
+ "name": "image_blur_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAhCAYAAACbffiEAAAACXBIWXMAABYlAAAWJQFJUiTwAAABfUlEQVR4nN3XyZLDIAwE0Pz/v3q3r55JDlSBplsIEI49h76k4opexCK/juP4eXjOT149f2Tf9ySPgcjCc7kdpBTgDPKByKK2bTPFEdMO0RDrusJ0wLRBGCIuelmWJAjkgPGDSIQEMBDCfA2CEPM80+Qwl0JkNxBimiaYGOTUlXYI60YoehzHJDEm7kxjV3whOQTD3AaCuhGKHoYhyb+CBMwjIAFz647kTqyapdV4enGINuDJMSScPmijSwjCaHeLcT77C7EC0C1ugaCTi2HYfAZANgj6Z9A8xY5eiYghDMNQBJNCWhASot0jGsSCUiHWZcSGQjaWWCDaGMOWnsCcn2QhVkRuxqqNxMSdUSElCDbp1hbNOsa6Ugxh7xXauF4DyM1m5BLtCylBXgaxvPXVwEoOBjeIFVODtW74oj1yBQah3E8tyz3SkpolKS9Geo9YMD1QJR1Go4oJkgO1pgbNZq0AOUPChyjvh7vlXaQa+X1UXwKxgHokB2XPxbX+AnijwIU4ahazAAAAAElFTkSuQmCC'"
+ },
+ "is_personal": {
+ "name": "is_personal",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "team_team_name_slug_unique_idx": {
+ "name": "team_team_name_slug_unique_idx",
+ "columns": ["name", "slug"],
+ "isUnique": true
+ },
+ "team_team_slug_idx": {
+ "name": "team_team_slug_idx",
+ "columns": ["slug"],
+ "isUnique": false
+ },
+ "team_team_id_idx": {
+ "name": "team_team_id_idx",
+ "columns": ["id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "av_teams_name_unique": {
+ "name": "av_teams_name_unique",
+ "nullsNotDistinct": false,
+ "columns": ["name"]
+ },
+ "av_teams_slug_unique": {
+ "name": "av_teams_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ }
+ },
+ "av_users": {
+ "name": "av_users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dislpay_name": {
+ "name": "dislpay_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp (3)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_user_email_idx": {
+ "name": "user_user_email_idx",
+ "columns": ["email"],
+ "isUnique": false
+ },
+ "user_user_id_idx": {
+ "name": "user_user_id_idx",
+ "columns": ["id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "av_users_dislpay_name_unique": {
+ "name": "av_users_dislpay_name_unique",
+ "nullsNotDistinct": false,
+ "columns": ["dislpay_name"]
+ },
+ "av_users_email_unique": {
+ "name": "av_users_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ }
+ }
+ },
+ "av_verification_tokens": {
+ "name": "av_verification_tokens",
+ "schema": "",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "av_verification_tokens_identifier_token_pk": {
+ "name": "av_verification_tokens_identifier_token_pk",
+ "columns": ["identifier", "token"]
+ }
+ },
+ "uniqueConstraints": {}
+ }
+ },
+ "enums": {
+ "admin_roles_enum": {
+ "name": "admin_roles_enum",
+ "values": {
+ "admin": "admin",
+ "superadmin": "superadmin"
+ }
+ },
+ "membership_roles_enum": {
+ "name": "membership_roles_enum",
+ "values": {
+ "member": "member",
+ "admin": "admin",
+ "owner": "owner"
+ }
+ },
+ "stripe_subscriptions_status_enum": {
+ "name": "stripe_subscriptions_status_enum",
+ "values": {
+ "active": "active",
+ "canceled": "canceled",
+ "expired": "expired",
+ "incomplete": "incomplete",
+ "past_due": "past_due",
+ "paused": "paused",
+ "trialing": "trialing",
+ "unpaid": "unpaid"
+ }
+ }
+ },
+ "schemas": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/src/migrations/meta/_journal.json
similarity index 58%
rename from packages/db/drizzle/meta/_journal.json
rename to packages/db/src/migrations/meta/_journal.json
index 48a87cf2..d8a924f8 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/src/migrations/meta/_journal.json
@@ -8,6 +8,13 @@
"when": 1705822582536,
"tag": "0000_bright_orphan",
"breakpoints": true
+ },
+ {
+ "idx": 1,
+ "version": "5",
+ "when": 1705981147709,
+ "tag": "0001_light_slapstick",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/src/schema/accounts.ts b/packages/db/src/schema/accounts.ts
index 45001052..ea1338ab 100644
--- a/packages/db/src/schema/accounts.ts
+++ b/packages/db/src/schema/accounts.ts
@@ -35,3 +35,6 @@ export const accountsTableRelations = relations(accountsTable, ({ one }) => ({
references: [usersTable.id],
}),
}));
+
+export type Account = typeof accountsTable.$inferSelect;
+export type NewAccount = typeof accountsTable.$inferInsert;
diff --git a/packages/db/src/schema/admins.ts b/packages/db/src/schema/admins.ts
index 6b5a7165..b09ac233 100644
--- a/packages/db/src/schema/admins.ts
+++ b/packages/db/src/schema/admins.ts
@@ -36,3 +36,6 @@ export const adminsTableRelations = relations(adminsTable, ({ one }) => ({
references: [usersTable.id],
}),
}));
+
+export type Admin = typeof adminsTable.$inferSelect;
+export type NewAdmin = typeof adminsTable.$inferInsert;
diff --git a/packages/db/src/schema/memberships.ts b/packages/db/src/schema/memberships.ts
index eaec6831..311c76b2 100644
--- a/packages/db/src/schema/memberships.ts
+++ b/packages/db/src/schema/memberships.ts
@@ -61,3 +61,6 @@ export const membershipsTableRelations = relations(
}),
}),
);
+
+export type Membership = typeof membershipsTable.$inferSelect;
+export type NewMembership = typeof membershipsTable.$inferInsert;
diff --git a/packages/db/src/schema/posts.ts b/packages/db/src/schema/posts.ts
index a4473ca7..2f21bcac 100644
--- a/packages/db/src/schema/posts.ts
+++ b/packages/db/src/schema/posts.ts
@@ -83,3 +83,6 @@ export const postsTableRelations = relations(postsTable, ({ one }) => ({
references: [sitesTable.id],
}),
}));
+
+export type Post = typeof postsTable.$inferSelect;
+export type NewPost = typeof postsTable.$inferInsert;
diff --git a/packages/db/src/schema/sessions.ts b/packages/db/src/schema/sessions.ts
index 728b8491..6afcd8b2 100644
--- a/packages/db/src/schema/sessions.ts
+++ b/packages/db/src/schema/sessions.ts
@@ -19,3 +19,6 @@ export const sessionsTableRelations = relations(sessionsTable, ({ one }) => ({
references: [usersTable.id],
}),
}));
+
+export type Session = typeof sessionsTable.$inferSelect;
+export type NewSession = typeof sessionsTable.$inferInsert;
diff --git a/packages/db/src/schema/sites.ts b/packages/db/src/schema/sites.ts
index cc39f2b0..6512d72e 100644
--- a/packages/db/src/schema/sites.ts
+++ b/packages/db/src/schema/sites.ts
@@ -69,3 +69,6 @@ export const sitesTableRelations = relations(sitesTable, ({ one, many }) => ({
}),
posts: many(postsTable, { relationName: 'PostToSite' }),
}));
+
+export type Site = typeof sitesTable.$inferSelect;
+export type NewSite = typeof sitesTable.$inferInsert;
diff --git a/packages/db/src/schema/stripe-customers.ts b/packages/db/src/schema/stripe-customers.ts
index 25a589c8..87bffee1 100644
--- a/packages/db/src/schema/stripe-customers.ts
+++ b/packages/db/src/schema/stripe-customers.ts
@@ -34,3 +34,6 @@ export const stripeCustomersTableRelations = relations(
}),
}),
);
+
+export type StripeCustomer = typeof stripeCustomersTable.$inferSelect;
+export type NewStripeCustomer = typeof stripeCustomersTable.$inferInsert;
diff --git a/packages/db/src/schema/stripe-subscriptions.ts b/packages/db/src/schema/stripe-subscriptions.ts
index 8ca2f744..bb9d2529 100644
--- a/packages/db/src/schema/stripe-subscriptions.ts
+++ b/packages/db/src/schema/stripe-subscriptions.ts
@@ -56,3 +56,7 @@ export const stripeSubscriptionsTableRelations = relations(
}),
}),
);
+
+export type StripeSubscription = typeof stripeSubscriptionsTable.$inferSelect;
+export type NewStripeSubscription =
+ typeof stripeSubscriptionsTable.$inferInsert;
diff --git a/packages/db/src/schema/team-invitations.ts b/packages/db/src/schema/team-invitations.ts
index 80e33b1a..b358efd7 100644
--- a/packages/db/src/schema/team-invitations.ts
+++ b/packages/db/src/schema/team-invitations.ts
@@ -58,3 +58,6 @@ export const teamInvitationsTableRelations = relations(
}),
}),
);
+
+export type TeamInvitation = typeof teamInvitationsTable.$inferSelect;
+export type NewTeamInvitation = typeof teamInvitationsTable.$inferInsert;
diff --git a/packages/db/src/schema/teams.ts b/packages/db/src/schema/teams.ts
index f3d74772..e726c13a 100644
--- a/packages/db/src/schema/teams.ts
+++ b/packages/db/src/schema/teams.ts
@@ -66,3 +66,6 @@ export const teamsTableRelations = relations(teamsTable, ({ one, many }) => ({
sites: many(sitesTable, { relationName: 'SiteToTeam' }),
posts: many(postsTable, { relationName: 'PostToTeam' }),
}));
+
+export type Team = typeof teamsTable.$inferSelect;
+export type NewTeam = typeof teamsTable.$inferInsert;
diff --git a/packages/db/src/schema/users.ts b/packages/db/src/schema/users.ts
index 29e5239a..79ccf4f8 100644
--- a/packages/db/src/schema/users.ts
+++ b/packages/db/src/schema/users.ts
@@ -51,3 +51,6 @@ export const usersTableRelations = relations(usersTable, ({ one, many }) => ({
references: [adminsTable.userId],
}),
}));
+
+export type User = typeof usersTable.$inferSelect;
+export type NewUser = typeof usersTable.$inferInsert;
diff --git a/packages/db/src/schema/verification-tokens.ts b/packages/db/src/schema/verification-tokens.ts
index a486da7c..7e62ed80 100644
--- a/packages/db/src/schema/verification-tokens.ts
+++ b/packages/db/src/schema/verification-tokens.ts
@@ -13,3 +13,6 @@ export const verificationTokensTable = myPgTable(
compoundKey: primaryKey({ columns: [vt.identifier, vt.token] }),
}),
);
+
+export type VerificationToken = typeof verificationTokensTable.$inferSelect;
+export type NewVerificationToken = typeof verificationTokensTable.$inferInsert;
diff --git a/packages/db/src/statements/statements.ts b/packages/db/src/statements/statements.ts
new file mode 100644
index 00000000..c658ff15
--- /dev/null
+++ b/packages/db/src/statements/statements.ts
@@ -0,0 +1,10 @@
+import { eq, sql } from 'drizzle-orm';
+
+import { db } from '..';
+import { usersTable } from '../schema/users';
+
+export const psGetUserByEmail = db
+ .select()
+ .from(usersTable)
+ .where(eq(usersTable.email, sql.placeholder('email')))
+ .prepare('psGetUserByEmail');
diff --git a/tooling/eslint/base.js b/tooling/eslint/base.js
index 6c26e22e..4e7a2f28 100644
--- a/tooling/eslint/base.js
+++ b/tooling/eslint/base.js
@@ -30,6 +30,7 @@ const config = {
2,
{ checksVoidReturn: { attributes: false } },
],
+ '@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
diff --git a/tooling/typescript/base.json b/tooling/typescript/base.json
index 6d077ac3..d3597bdd 100644
--- a/tooling/typescript/base.json
+++ b/tooling/typescript/base.json
@@ -19,5 +19,5 @@
"strict": true,
"strictNullChecks": true
},
- "exclude": ["node_modules", "build", "dist", ".next"]
+ "exclude": ["node_modules", "build", "dist", ".next", "cursor"]
}