@kevinmarrec/create-app 0.6.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/template/backend/.env.development +1 -1
- package/template/backend/package.json +1 -1
- package/template/backend/src/auth/index.ts +1 -1
- package/template/backend/src/database/drizzle/config.ts +2 -1
- package/template/backend/src/database/index.ts +4 -7
- package/template/backend/src/database/migrations/0000_init.sql +50 -0
- package/template/backend/src/database/migrations/meta/0000_snapshot.json +92 -105
- package/template/backend/src/database/migrations/meta/_journal.json +4 -4
- package/template/backend/src/database/schema/accounts.ts +6 -6
- package/template/backend/src/database/schema/sessions.ts +5 -5
- package/template/backend/src/database/schema/users.ts +5 -5
- package/template/backend/src/database/schema/verifications.ts +5 -5
- package/template/backend/src/database/migrations/0000_fluffy_salo.sql +0 -49
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevinmarrec/create-app",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"packageManager": "bun@1.3.1",
|
|
6
6
|
"description": "CLI that scaffolds an opinionated Bun & Vue fullstack application.",
|
|
7
7
|
"author": "Kevin Marrec <kevin@marrec.io>",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"release": "bumpp",
|
|
42
42
|
"update": "bunx taze -I -rwi",
|
|
43
43
|
"test": "vitest",
|
|
44
|
-
"test:coverage": "vitest
|
|
44
|
+
"test:coverage": "vitest --coverage"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@clack/prompts": "^0.11.0",
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"@kevinmarrec/stylelint-config": "^1.2.2",
|
|
56
56
|
"@kevinmarrec/tsconfig": "^1.1.0",
|
|
57
57
|
"@types/bun": "^1.3.0",
|
|
58
|
-
"@vitest/coverage-v8": "^
|
|
58
|
+
"@vitest/coverage-v8": "^4.0.1",
|
|
59
59
|
"bumpp": "^10.3.1",
|
|
60
60
|
"eslint": "^9.38.0",
|
|
61
61
|
"knip": "^5.66.0",
|
|
62
62
|
"stylelint": "^16.25.0",
|
|
63
63
|
"tsdown": "^0.15.7",
|
|
64
64
|
"typescript": "^5.9.3",
|
|
65
|
-
"vitest": "^
|
|
65
|
+
"vitest": "^4.0.1",
|
|
66
66
|
"vue-tsc": "^3.1.1"
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -2,7 +2,8 @@ import { defineConfig } from 'drizzle-kit'
|
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
casing: 'snake_case',
|
|
5
|
-
dialect: '
|
|
5
|
+
dialect: 'postgresql',
|
|
6
|
+
driver: 'pglite',
|
|
6
7
|
dbCredentials: { url: import.meta.env.DATABASE_URL },
|
|
7
8
|
schema: 'src/database/schema',
|
|
8
9
|
out: 'src/database/migrations',
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { logger } from '@backend/utils/logger'
|
|
2
|
-
import {
|
|
2
|
+
import { PGlite } from '@electric-sql/pglite'
|
|
3
|
+
import { drizzle } from 'drizzle-orm/pglite'
|
|
3
4
|
|
|
4
5
|
import * as schema from './schema'
|
|
5
6
|
|
|
6
|
-
export const db = drizzle(
|
|
7
|
+
export const db = drizzle({
|
|
8
|
+
client: new PGlite(import.meta.env.DATABASE_URL),
|
|
7
9
|
casing: 'snake_case',
|
|
8
10
|
schema,
|
|
9
11
|
logger: {
|
|
@@ -15,9 +17,4 @@ export const db = drizzle(import.meta.env.DATABASE_URL, {
|
|
|
15
17
|
},
|
|
16
18
|
})
|
|
17
19
|
|
|
18
|
-
db.run('PRAGMA journal_mode = WAL')
|
|
19
|
-
db.run('PRAGMA journal_size_limit = 6144000')
|
|
20
|
-
db.run('PRAGMA synchronous = NORMAL')
|
|
21
|
-
db.run('PRAGMA foreign_keys = ON')
|
|
22
|
-
|
|
23
20
|
export type Database = typeof db
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
CREATE TABLE "users" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"name" text NOT NULL,
|
|
4
|
+
"email" text NOT NULL,
|
|
5
|
+
"email_verified" boolean DEFAULT false NOT NULL,
|
|
6
|
+
"image" text,
|
|
7
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
8
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
9
|
+
CONSTRAINT "users_email_unique" UNIQUE("email")
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE TABLE "sessions" (
|
|
13
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
14
|
+
"user_id" text NOT NULL,
|
|
15
|
+
"token" text NOT NULL,
|
|
16
|
+
"expires_at" timestamp NOT NULL,
|
|
17
|
+
"ip_address" text,
|
|
18
|
+
"user_agent" text,
|
|
19
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
20
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
21
|
+
CONSTRAINT "sessions_token_unique" UNIQUE("token")
|
|
22
|
+
);
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
CREATE TABLE "accounts" (
|
|
25
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
26
|
+
"user_id" text NOT NULL,
|
|
27
|
+
"account_id" text NOT NULL,
|
|
28
|
+
"provider_id" text NOT NULL,
|
|
29
|
+
"access_token" text,
|
|
30
|
+
"refresh_token" text,
|
|
31
|
+
"access_token_expires_at" timestamp,
|
|
32
|
+
"refresh_token_expires_at" timestamp,
|
|
33
|
+
"scope" text,
|
|
34
|
+
"id_token" text,
|
|
35
|
+
"password" text,
|
|
36
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
37
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
38
|
+
);
|
|
39
|
+
--> statement-breakpoint
|
|
40
|
+
CREATE TABLE "verifications" (
|
|
41
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
42
|
+
"identifier" text NOT NULL,
|
|
43
|
+
"value" text NOT NULL,
|
|
44
|
+
"expires_at" timestamp NOT NULL,
|
|
45
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
46
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
47
|
+
);
|
|
48
|
+
--> statement-breakpoint
|
|
49
|
+
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
50
|
+
ALTER TABLE "accounts" ADD CONSTRAINT "accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
|
@@ -1,146 +1,131 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"dialect": "sqlite",
|
|
4
|
-
"id": "c1982d78-242a-497b-b4b3-6a4f8a375c7f",
|
|
2
|
+
"id": "21bfd4d4-350d-4701-b4b8-b0d991fc163e",
|
|
5
3
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
6
|
"tables": {
|
|
7
|
-
"users": {
|
|
7
|
+
"public.users": {
|
|
8
8
|
"name": "users",
|
|
9
|
+
"schema": "",
|
|
9
10
|
"columns": {
|
|
10
11
|
"id": {
|
|
11
12
|
"name": "id",
|
|
12
13
|
"type": "text",
|
|
13
14
|
"primaryKey": true,
|
|
14
|
-
"notNull": true
|
|
15
|
-
"autoincrement": false
|
|
15
|
+
"notNull": true
|
|
16
16
|
},
|
|
17
17
|
"name": {
|
|
18
18
|
"name": "name",
|
|
19
19
|
"type": "text",
|
|
20
20
|
"primaryKey": false,
|
|
21
|
-
"notNull": true
|
|
22
|
-
"autoincrement": false
|
|
21
|
+
"notNull": true
|
|
23
22
|
},
|
|
24
23
|
"email": {
|
|
25
24
|
"name": "email",
|
|
26
25
|
"type": "text",
|
|
27
26
|
"primaryKey": false,
|
|
28
|
-
"notNull": true
|
|
29
|
-
"autoincrement": false
|
|
27
|
+
"notNull": true
|
|
30
28
|
},
|
|
31
29
|
"email_verified": {
|
|
32
30
|
"name": "email_verified",
|
|
33
|
-
"type": "
|
|
31
|
+
"type": "boolean",
|
|
34
32
|
"primaryKey": false,
|
|
35
33
|
"notNull": true,
|
|
36
|
-
"autoincrement": false,
|
|
37
34
|
"default": false
|
|
38
35
|
},
|
|
39
36
|
"image": {
|
|
40
37
|
"name": "image",
|
|
41
38
|
"type": "text",
|
|
42
39
|
"primaryKey": false,
|
|
43
|
-
"notNull": false
|
|
44
|
-
"autoincrement": false
|
|
40
|
+
"notNull": false
|
|
45
41
|
},
|
|
46
42
|
"created_at": {
|
|
47
43
|
"name": "created_at",
|
|
48
|
-
"type": "
|
|
44
|
+
"type": "timestamp",
|
|
49
45
|
"primaryKey": false,
|
|
50
46
|
"notNull": true,
|
|
51
|
-
"
|
|
47
|
+
"default": "now()"
|
|
52
48
|
},
|
|
53
49
|
"updated_at": {
|
|
54
50
|
"name": "updated_at",
|
|
55
|
-
"type": "
|
|
51
|
+
"type": "timestamp",
|
|
56
52
|
"primaryKey": false,
|
|
57
53
|
"notNull": true,
|
|
58
|
-
"
|
|
54
|
+
"default": "now()"
|
|
59
55
|
}
|
|
60
56
|
},
|
|
61
|
-
"indexes": {
|
|
57
|
+
"indexes": {},
|
|
58
|
+
"foreignKeys": {},
|
|
59
|
+
"compositePrimaryKeys": {},
|
|
60
|
+
"uniqueConstraints": {
|
|
62
61
|
"users_email_unique": {
|
|
63
62
|
"name": "users_email_unique",
|
|
63
|
+
"nullsNotDistinct": false,
|
|
64
64
|
"columns": [
|
|
65
65
|
"email"
|
|
66
|
-
]
|
|
67
|
-
"isUnique": true
|
|
66
|
+
]
|
|
68
67
|
}
|
|
69
68
|
},
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"checkConstraints": {}
|
|
69
|
+
"policies": {},
|
|
70
|
+
"checkConstraints": {},
|
|
71
|
+
"isRLSEnabled": false
|
|
74
72
|
},
|
|
75
|
-
"sessions": {
|
|
73
|
+
"public.sessions": {
|
|
76
74
|
"name": "sessions",
|
|
75
|
+
"schema": "",
|
|
77
76
|
"columns": {
|
|
78
77
|
"id": {
|
|
79
78
|
"name": "id",
|
|
80
79
|
"type": "text",
|
|
81
80
|
"primaryKey": true,
|
|
82
|
-
"notNull": true
|
|
83
|
-
"autoincrement": false
|
|
81
|
+
"notNull": true
|
|
84
82
|
},
|
|
85
83
|
"user_id": {
|
|
86
84
|
"name": "user_id",
|
|
87
85
|
"type": "text",
|
|
88
86
|
"primaryKey": false,
|
|
89
|
-
"notNull": true
|
|
90
|
-
"autoincrement": false
|
|
87
|
+
"notNull": true
|
|
91
88
|
},
|
|
92
89
|
"token": {
|
|
93
90
|
"name": "token",
|
|
94
91
|
"type": "text",
|
|
95
92
|
"primaryKey": false,
|
|
96
|
-
"notNull": true
|
|
97
|
-
"autoincrement": false
|
|
93
|
+
"notNull": true
|
|
98
94
|
},
|
|
99
95
|
"expires_at": {
|
|
100
96
|
"name": "expires_at",
|
|
101
|
-
"type": "
|
|
97
|
+
"type": "timestamp",
|
|
102
98
|
"primaryKey": false,
|
|
103
|
-
"notNull": true
|
|
104
|
-
"autoincrement": false
|
|
99
|
+
"notNull": true
|
|
105
100
|
},
|
|
106
101
|
"ip_address": {
|
|
107
102
|
"name": "ip_address",
|
|
108
103
|
"type": "text",
|
|
109
104
|
"primaryKey": false,
|
|
110
|
-
"notNull": false
|
|
111
|
-
"autoincrement": false
|
|
105
|
+
"notNull": false
|
|
112
106
|
},
|
|
113
107
|
"user_agent": {
|
|
114
108
|
"name": "user_agent",
|
|
115
109
|
"type": "text",
|
|
116
110
|
"primaryKey": false,
|
|
117
|
-
"notNull": false
|
|
118
|
-
"autoincrement": false
|
|
111
|
+
"notNull": false
|
|
119
112
|
},
|
|
120
113
|
"created_at": {
|
|
121
114
|
"name": "created_at",
|
|
122
|
-
"type": "
|
|
115
|
+
"type": "timestamp",
|
|
123
116
|
"primaryKey": false,
|
|
124
117
|
"notNull": true,
|
|
125
|
-
"
|
|
118
|
+
"default": "now()"
|
|
126
119
|
},
|
|
127
120
|
"updated_at": {
|
|
128
121
|
"name": "updated_at",
|
|
129
|
-
"type": "
|
|
122
|
+
"type": "timestamp",
|
|
130
123
|
"primaryKey": false,
|
|
131
124
|
"notNull": true,
|
|
132
|
-
"
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
"indexes": {
|
|
136
|
-
"sessions_token_unique": {
|
|
137
|
-
"name": "sessions_token_unique",
|
|
138
|
-
"columns": [
|
|
139
|
-
"token"
|
|
140
|
-
],
|
|
141
|
-
"isUnique": true
|
|
125
|
+
"default": "now()"
|
|
142
126
|
}
|
|
143
127
|
},
|
|
128
|
+
"indexes": {},
|
|
144
129
|
"foreignKeys": {
|
|
145
130
|
"sessions_user_id_users_id_fk": {
|
|
146
131
|
"name": "sessions_user_id_users_id_fk",
|
|
@@ -157,102 +142,102 @@
|
|
|
157
142
|
}
|
|
158
143
|
},
|
|
159
144
|
"compositePrimaryKeys": {},
|
|
160
|
-
"uniqueConstraints": {
|
|
161
|
-
|
|
145
|
+
"uniqueConstraints": {
|
|
146
|
+
"sessions_token_unique": {
|
|
147
|
+
"name": "sessions_token_unique",
|
|
148
|
+
"nullsNotDistinct": false,
|
|
149
|
+
"columns": [
|
|
150
|
+
"token"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"policies": {},
|
|
155
|
+
"checkConstraints": {},
|
|
156
|
+
"isRLSEnabled": false
|
|
162
157
|
},
|
|
163
|
-
"accounts": {
|
|
158
|
+
"public.accounts": {
|
|
164
159
|
"name": "accounts",
|
|
160
|
+
"schema": "",
|
|
165
161
|
"columns": {
|
|
166
162
|
"id": {
|
|
167
163
|
"name": "id",
|
|
168
164
|
"type": "text",
|
|
169
165
|
"primaryKey": true,
|
|
170
|
-
"notNull": true
|
|
171
|
-
"autoincrement": false
|
|
166
|
+
"notNull": true
|
|
172
167
|
},
|
|
173
168
|
"user_id": {
|
|
174
169
|
"name": "user_id",
|
|
175
170
|
"type": "text",
|
|
176
171
|
"primaryKey": false,
|
|
177
|
-
"notNull": true
|
|
178
|
-
"autoincrement": false
|
|
172
|
+
"notNull": true
|
|
179
173
|
},
|
|
180
174
|
"account_id": {
|
|
181
175
|
"name": "account_id",
|
|
182
176
|
"type": "text",
|
|
183
177
|
"primaryKey": false,
|
|
184
|
-
"notNull": true
|
|
185
|
-
"autoincrement": false
|
|
178
|
+
"notNull": true
|
|
186
179
|
},
|
|
187
180
|
"provider_id": {
|
|
188
181
|
"name": "provider_id",
|
|
189
182
|
"type": "text",
|
|
190
183
|
"primaryKey": false,
|
|
191
|
-
"notNull": true
|
|
192
|
-
"autoincrement": false
|
|
184
|
+
"notNull": true
|
|
193
185
|
},
|
|
194
186
|
"access_token": {
|
|
195
187
|
"name": "access_token",
|
|
196
188
|
"type": "text",
|
|
197
189
|
"primaryKey": false,
|
|
198
|
-
"notNull": false
|
|
199
|
-
"autoincrement": false
|
|
190
|
+
"notNull": false
|
|
200
191
|
},
|
|
201
192
|
"refresh_token": {
|
|
202
193
|
"name": "refresh_token",
|
|
203
194
|
"type": "text",
|
|
204
195
|
"primaryKey": false,
|
|
205
|
-
"notNull": false
|
|
206
|
-
"autoincrement": false
|
|
196
|
+
"notNull": false
|
|
207
197
|
},
|
|
208
198
|
"access_token_expires_at": {
|
|
209
199
|
"name": "access_token_expires_at",
|
|
210
|
-
"type": "
|
|
200
|
+
"type": "timestamp",
|
|
211
201
|
"primaryKey": false,
|
|
212
|
-
"notNull": false
|
|
213
|
-
"autoincrement": false
|
|
202
|
+
"notNull": false
|
|
214
203
|
},
|
|
215
204
|
"refresh_token_expires_at": {
|
|
216
205
|
"name": "refresh_token_expires_at",
|
|
217
|
-
"type": "
|
|
206
|
+
"type": "timestamp",
|
|
218
207
|
"primaryKey": false,
|
|
219
|
-
"notNull": false
|
|
220
|
-
"autoincrement": false
|
|
208
|
+
"notNull": false
|
|
221
209
|
},
|
|
222
210
|
"scope": {
|
|
223
211
|
"name": "scope",
|
|
224
212
|
"type": "text",
|
|
225
213
|
"primaryKey": false,
|
|
226
|
-
"notNull": false
|
|
227
|
-
"autoincrement": false
|
|
214
|
+
"notNull": false
|
|
228
215
|
},
|
|
229
216
|
"id_token": {
|
|
230
217
|
"name": "id_token",
|
|
231
218
|
"type": "text",
|
|
232
219
|
"primaryKey": false,
|
|
233
|
-
"notNull": false
|
|
234
|
-
"autoincrement": false
|
|
220
|
+
"notNull": false
|
|
235
221
|
},
|
|
236
222
|
"password": {
|
|
237
223
|
"name": "password",
|
|
238
224
|
"type": "text",
|
|
239
225
|
"primaryKey": false,
|
|
240
|
-
"notNull": false
|
|
241
|
-
"autoincrement": false
|
|
226
|
+
"notNull": false
|
|
242
227
|
},
|
|
243
228
|
"created_at": {
|
|
244
229
|
"name": "created_at",
|
|
245
|
-
"type": "
|
|
230
|
+
"type": "timestamp",
|
|
246
231
|
"primaryKey": false,
|
|
247
232
|
"notNull": true,
|
|
248
|
-
"
|
|
233
|
+
"default": "now()"
|
|
249
234
|
},
|
|
250
235
|
"updated_at": {
|
|
251
236
|
"name": "updated_at",
|
|
252
|
-
"type": "
|
|
237
|
+
"type": "timestamp",
|
|
253
238
|
"primaryKey": false,
|
|
254
239
|
"notNull": true,
|
|
255
|
-
"
|
|
240
|
+
"default": "now()"
|
|
256
241
|
}
|
|
257
242
|
},
|
|
258
243
|
"indexes": {},
|
|
@@ -273,69 +258,71 @@
|
|
|
273
258
|
},
|
|
274
259
|
"compositePrimaryKeys": {},
|
|
275
260
|
"uniqueConstraints": {},
|
|
276
|
-
"
|
|
261
|
+
"policies": {},
|
|
262
|
+
"checkConstraints": {},
|
|
263
|
+
"isRLSEnabled": false
|
|
277
264
|
},
|
|
278
|
-
"verifications": {
|
|
265
|
+
"public.verifications": {
|
|
279
266
|
"name": "verifications",
|
|
267
|
+
"schema": "",
|
|
280
268
|
"columns": {
|
|
281
269
|
"id": {
|
|
282
270
|
"name": "id",
|
|
283
271
|
"type": "text",
|
|
284
272
|
"primaryKey": true,
|
|
285
|
-
"notNull": true
|
|
286
|
-
"autoincrement": false
|
|
273
|
+
"notNull": true
|
|
287
274
|
},
|
|
288
275
|
"identifier": {
|
|
289
276
|
"name": "identifier",
|
|
290
277
|
"type": "text",
|
|
291
278
|
"primaryKey": false,
|
|
292
|
-
"notNull": true
|
|
293
|
-
"autoincrement": false
|
|
279
|
+
"notNull": true
|
|
294
280
|
},
|
|
295
281
|
"value": {
|
|
296
282
|
"name": "value",
|
|
297
283
|
"type": "text",
|
|
298
284
|
"primaryKey": false,
|
|
299
|
-
"notNull": true
|
|
300
|
-
"autoincrement": false
|
|
285
|
+
"notNull": true
|
|
301
286
|
},
|
|
302
287
|
"expires_at": {
|
|
303
288
|
"name": "expires_at",
|
|
304
|
-
"type": "
|
|
289
|
+
"type": "timestamp",
|
|
305
290
|
"primaryKey": false,
|
|
306
|
-
"notNull": true
|
|
307
|
-
"autoincrement": false
|
|
291
|
+
"notNull": true
|
|
308
292
|
},
|
|
309
293
|
"created_at": {
|
|
310
294
|
"name": "created_at",
|
|
311
|
-
"type": "
|
|
295
|
+
"type": "timestamp",
|
|
312
296
|
"primaryKey": false,
|
|
313
297
|
"notNull": true,
|
|
314
|
-
"
|
|
298
|
+
"default": "now()"
|
|
315
299
|
},
|
|
316
300
|
"updated_at": {
|
|
317
301
|
"name": "updated_at",
|
|
318
|
-
"type": "
|
|
302
|
+
"type": "timestamp",
|
|
319
303
|
"primaryKey": false,
|
|
320
304
|
"notNull": true,
|
|
321
|
-
"
|
|
305
|
+
"default": "now()"
|
|
322
306
|
}
|
|
323
307
|
},
|
|
324
308
|
"indexes": {},
|
|
325
309
|
"foreignKeys": {},
|
|
326
310
|
"compositePrimaryKeys": {},
|
|
327
311
|
"uniqueConstraints": {},
|
|
328
|
-
"
|
|
312
|
+
"policies": {},
|
|
313
|
+
"checkConstraints": {},
|
|
314
|
+
"isRLSEnabled": false
|
|
329
315
|
}
|
|
330
316
|
},
|
|
331
|
-
"views": {},
|
|
332
317
|
"enums": {},
|
|
318
|
+
"schemas": {},
|
|
319
|
+
"sequences": {},
|
|
320
|
+
"roles": {},
|
|
321
|
+
"policies": {},
|
|
322
|
+
"views": {},
|
|
333
323
|
"_meta": {
|
|
324
|
+
"columns": {},
|
|
334
325
|
"schemas": {},
|
|
335
|
-
"tables": {}
|
|
336
|
-
"columns": {}
|
|
337
|
-
},
|
|
338
|
-
"internal": {
|
|
339
|
-
"indexes": {}
|
|
326
|
+
"tables": {}
|
|
340
327
|
}
|
|
341
328
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "7",
|
|
3
|
-
"dialect": "
|
|
3
|
+
"dialect": "postgresql",
|
|
4
4
|
"entries": [
|
|
5
5
|
{
|
|
6
6
|
"idx": 0,
|
|
7
|
-
"version": "
|
|
8
|
-
"when":
|
|
9
|
-
"tag": "
|
|
7
|
+
"version": "7",
|
|
8
|
+
"when": 1761156145639,
|
|
9
|
+
"tag": "0000_init",
|
|
10
10
|
"breakpoints": true
|
|
11
11
|
}
|
|
12
12
|
]
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pgTable } from 'drizzle-orm/pg-core'
|
|
2
2
|
|
|
3
3
|
import { users } from './users'
|
|
4
4
|
|
|
5
5
|
// https://www.better-auth.com/docs/concepts/database#account
|
|
6
|
-
export const accounts =
|
|
6
|
+
export const accounts = pgTable('accounts', t => ({
|
|
7
7
|
id: t.text().primaryKey(),
|
|
8
8
|
userId: t.text().notNull().references(() => users.id, { onDelete: 'cascade' }),
|
|
9
9
|
accountId: t.text().notNull(),
|
|
10
10
|
providerId: t.text().notNull(),
|
|
11
11
|
accessToken: t.text(),
|
|
12
12
|
refreshToken: t.text(),
|
|
13
|
-
accessTokenExpiresAt: t.
|
|
14
|
-
refreshTokenExpiresAt: t.
|
|
13
|
+
accessTokenExpiresAt: t.timestamp(),
|
|
14
|
+
refreshTokenExpiresAt: t.timestamp(),
|
|
15
15
|
scope: t.text(),
|
|
16
16
|
idToken: t.text(),
|
|
17
17
|
password: t.text(),
|
|
18
|
-
createdAt: t.
|
|
19
|
-
updatedAt: t.
|
|
18
|
+
createdAt: t.timestamp().notNull().defaultNow(),
|
|
19
|
+
updatedAt: t.timestamp().notNull().defaultNow().$onUpdate(() => new Date()),
|
|
20
20
|
}))
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pgTable } from 'drizzle-orm/pg-core'
|
|
2
2
|
|
|
3
3
|
import { users } from './users'
|
|
4
4
|
|
|
5
5
|
// https://www.better-auth.com/docs/concepts/database#session
|
|
6
|
-
export const sessions =
|
|
6
|
+
export const sessions = pgTable('sessions', t => ({
|
|
7
7
|
id: t.text().primaryKey(),
|
|
8
8
|
userId: t.text().notNull().references(() => users.id, { onDelete: 'cascade' }),
|
|
9
9
|
token: t.text().notNull().unique(),
|
|
10
|
-
expiresAt: t.
|
|
10
|
+
expiresAt: t.timestamp().notNull(),
|
|
11
11
|
ipAddress: t.text(),
|
|
12
12
|
userAgent: t.text(),
|
|
13
|
-
createdAt: t.
|
|
14
|
-
updatedAt: t.
|
|
13
|
+
createdAt: t.timestamp().notNull().defaultNow(),
|
|
14
|
+
updatedAt: t.timestamp().notNull().defaultNow().$onUpdate(() => new Date()),
|
|
15
15
|
}))
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pgTable } from 'drizzle-orm/pg-core'
|
|
2
2
|
|
|
3
3
|
// https://www.better-auth.com/docs/concepts/database#user
|
|
4
|
-
export const users =
|
|
4
|
+
export const users = pgTable('users', t => ({
|
|
5
5
|
id: t.text().primaryKey(),
|
|
6
6
|
name: t.text().notNull(),
|
|
7
7
|
email: t.text().notNull().unique(),
|
|
8
|
-
emailVerified: t.
|
|
8
|
+
emailVerified: t.boolean().notNull().default(false),
|
|
9
9
|
image: t.text(),
|
|
10
|
-
createdAt: t.
|
|
11
|
-
updatedAt: t.
|
|
10
|
+
createdAt: t.timestamp().notNull().defaultNow(),
|
|
11
|
+
updatedAt: t.timestamp().notNull().defaultNow().$onUpdate(() => new Date()),
|
|
12
12
|
}))
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pgTable } from 'drizzle-orm/pg-core'
|
|
2
2
|
|
|
3
3
|
// https://www.better-auth.com/docs/concepts/database#verification
|
|
4
|
-
export const verifications =
|
|
4
|
+
export const verifications = pgTable('verifications', t => ({
|
|
5
5
|
id: t.text().primaryKey(),
|
|
6
6
|
identifier: t.text().notNull(),
|
|
7
7
|
value: t.text().notNull(),
|
|
8
|
-
expiresAt: t.
|
|
9
|
-
createdAt: t.
|
|
10
|
-
updatedAt: t.
|
|
8
|
+
expiresAt: t.timestamp().notNull(),
|
|
9
|
+
createdAt: t.timestamp().notNull().defaultNow(),
|
|
10
|
+
updatedAt: t.timestamp().notNull().defaultNow().$onUpdate(() => new Date()),
|
|
11
11
|
}))
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
CREATE TABLE `users` (
|
|
2
|
-
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
-
`name` text NOT NULL,
|
|
4
|
-
`email` text NOT NULL,
|
|
5
|
-
`email_verified` integer DEFAULT false NOT NULL,
|
|
6
|
-
`image` text,
|
|
7
|
-
`created_at` integer NOT NULL,
|
|
8
|
-
`updated_at` integer NOT NULL
|
|
9
|
-
);
|
|
10
|
-
--> statement-breakpoint
|
|
11
|
-
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
|
|
12
|
-
CREATE TABLE `sessions` (
|
|
13
|
-
`id` text PRIMARY KEY NOT NULL,
|
|
14
|
-
`user_id` text NOT NULL,
|
|
15
|
-
`token` text NOT NULL,
|
|
16
|
-
`expires_at` integer NOT NULL,
|
|
17
|
-
`ip_address` text,
|
|
18
|
-
`user_agent` text,
|
|
19
|
-
`created_at` integer NOT NULL,
|
|
20
|
-
`updated_at` integer NOT NULL,
|
|
21
|
-
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
22
|
-
);
|
|
23
|
-
--> statement-breakpoint
|
|
24
|
-
CREATE UNIQUE INDEX `sessions_token_unique` ON `sessions` (`token`);--> statement-breakpoint
|
|
25
|
-
CREATE TABLE `accounts` (
|
|
26
|
-
`id` text PRIMARY KEY NOT NULL,
|
|
27
|
-
`user_id` text NOT NULL,
|
|
28
|
-
`account_id` text NOT NULL,
|
|
29
|
-
`provider_id` text NOT NULL,
|
|
30
|
-
`access_token` text,
|
|
31
|
-
`refresh_token` text,
|
|
32
|
-
`access_token_expires_at` integer,
|
|
33
|
-
`refresh_token_expires_at` integer,
|
|
34
|
-
`scope` text,
|
|
35
|
-
`id_token` text,
|
|
36
|
-
`password` text,
|
|
37
|
-
`created_at` integer NOT NULL,
|
|
38
|
-
`updated_at` integer NOT NULL,
|
|
39
|
-
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
40
|
-
);
|
|
41
|
-
--> statement-breakpoint
|
|
42
|
-
CREATE TABLE `verifications` (
|
|
43
|
-
`id` text PRIMARY KEY NOT NULL,
|
|
44
|
-
`identifier` text NOT NULL,
|
|
45
|
-
`value` text NOT NULL,
|
|
46
|
-
`expires_at` integer NOT NULL,
|
|
47
|
-
`created_at` integer NOT NULL,
|
|
48
|
-
`updated_at` integer NOT NULL
|
|
49
|
-
);
|