drizzle-graphql-plus 0.8.6 → 0.8.7
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/index.cjs +1974 -0
- package/index.cjs.map +1 -0
- package/index.d.cts +247 -0
- package/index.d.ts +247 -0
- package/index.js +2012 -0
- package/index.js.map +1 -0
- package/package.json +16 -15
- package/.github/workflows/release.yaml +0 -74
- package/LICENSE +0 -201
- package/dprint.json +0 -31
- package/drizzle.test-config.ts +0 -29
- package/scripts/build.ts +0 -28
- package/src/index.ts +0 -74
- package/src/types.ts +0 -417
- package/src/util/builders/common.ts +0 -840
- package/src/util/builders/index.ts +0 -5
- package/src/util/builders/mysql.ts +0 -482
- package/src/util/builders/pg.ts +0 -517
- package/src/util/builders/sqlite.ts +0 -524
- package/src/util/builders/types.ts +0 -231
- package/src/util/case-ops/index.ts +0 -9
- package/src/util/data-mappers/index.ts +0 -162
- package/src/util/type-converter/index.ts +0 -148
- package/src/util/type-converter/types.ts +0 -54
- package/tests/mysql-custom.test.ts +0 -2009
- package/tests/mysql.test.ts +0 -4600
- package/tests/pg-custom.test.ts +0 -2054
- package/tests/pg.test.ts +0 -4285
- package/tests/schema/mysql.ts +0 -72
- package/tests/schema/pg.ts +0 -83
- package/tests/schema/sqlite.ts +0 -64
- package/tests/sqlite-custom.test.ts +0 -1956
- package/tests/sqlite.test.ts +0 -3749
- package/tests/tsconfig.json +0 -11
- package/tests/util/query/index.ts +0 -30
- package/tsconfig.build.json +0 -4
- package/tsconfig.dts.json +0 -13
- package/tsconfig.json +0 -48
- package/vitest.config.ts +0 -17
package/tests/schema/mysql.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { relations } from 'drizzle-orm';
|
|
2
|
-
import {
|
|
3
|
-
bigint,
|
|
4
|
-
boolean,
|
|
5
|
-
char,
|
|
6
|
-
date,
|
|
7
|
-
int,
|
|
8
|
-
mysqlEnum,
|
|
9
|
-
mysqlTable,
|
|
10
|
-
text,
|
|
11
|
-
timestamp,
|
|
12
|
-
varchar,
|
|
13
|
-
} from 'drizzle-orm/mysql-core';
|
|
14
|
-
|
|
15
|
-
export const Users = mysqlTable('users', {
|
|
16
|
-
id: int('id').autoincrement().primaryKey(),
|
|
17
|
-
name: text('name').notNull(),
|
|
18
|
-
email: text('email'),
|
|
19
|
-
bigint: bigint('big_int', { mode: 'bigint', unsigned: true }),
|
|
20
|
-
birthdayString: date('birthday_string', { mode: 'string' }),
|
|
21
|
-
birthdayDate: date('birthday_date', { mode: 'date' }),
|
|
22
|
-
createdAt: timestamp('created_at').notNull().defaultNow(),
|
|
23
|
-
role: mysqlEnum('role', ['admin', 'user']),
|
|
24
|
-
roleText: text('role1', { enum: ['admin', 'user'] }),
|
|
25
|
-
roleText2: text('role2', { enum: ['admin', 'user'] }).default('user'),
|
|
26
|
-
profession: varchar('profession', { length: 20 }),
|
|
27
|
-
initials: char('initials', { length: 2 }),
|
|
28
|
-
isConfirmed: boolean('is_confirmed'),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export const Customers = mysqlTable('customers', {
|
|
32
|
-
id: int('id').autoincrement().primaryKey(),
|
|
33
|
-
address: text('address').notNull(),
|
|
34
|
-
isConfirmed: boolean('is_confirmed'),
|
|
35
|
-
registrationDate: timestamp('registration_date').notNull().defaultNow(),
|
|
36
|
-
userId: int('user_id')
|
|
37
|
-
.references(() => Users.id)
|
|
38
|
-
.notNull(),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export const Posts = mysqlTable('posts', {
|
|
42
|
-
id: int('id').autoincrement().primaryKey(),
|
|
43
|
-
content: text('content'),
|
|
44
|
-
authorId: int('author_id'),
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export const usersRelations = relations(Users, ({ one, many }) => ({
|
|
48
|
-
posts: many(Posts),
|
|
49
|
-
customer: one(Customers, {
|
|
50
|
-
fields: [Users.id],
|
|
51
|
-
references: [Customers.userId],
|
|
52
|
-
}),
|
|
53
|
-
}));
|
|
54
|
-
|
|
55
|
-
export const customersRelations = relations(Customers, ({ one, many }) => ({
|
|
56
|
-
user: one(Users, {
|
|
57
|
-
fields: [Customers.userId],
|
|
58
|
-
references: [Users.id],
|
|
59
|
-
}),
|
|
60
|
-
posts: many(Posts),
|
|
61
|
-
}));
|
|
62
|
-
|
|
63
|
-
export const postsRelations = relations(Posts, ({ one }) => ({
|
|
64
|
-
author: one(Users, {
|
|
65
|
-
fields: [Posts.authorId],
|
|
66
|
-
references: [Users.id],
|
|
67
|
-
}),
|
|
68
|
-
customer: one(Customers, {
|
|
69
|
-
fields: [Posts.authorId],
|
|
70
|
-
references: [Customers.userId],
|
|
71
|
-
}),
|
|
72
|
-
}));
|
package/tests/schema/pg.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { relations } from 'drizzle-orm';
|
|
2
|
-
import {
|
|
3
|
-
boolean,
|
|
4
|
-
char,
|
|
5
|
-
date,
|
|
6
|
-
geometry,
|
|
7
|
-
integer,
|
|
8
|
-
pgEnum,
|
|
9
|
-
pgTable,
|
|
10
|
-
serial,
|
|
11
|
-
text,
|
|
12
|
-
timestamp,
|
|
13
|
-
varchar,
|
|
14
|
-
vector,
|
|
15
|
-
} from 'drizzle-orm/pg-core';
|
|
16
|
-
|
|
17
|
-
export const roleEnum = pgEnum('role', ['admin', 'user']);
|
|
18
|
-
|
|
19
|
-
export const Users = pgTable('users', {
|
|
20
|
-
a: integer('a').array(),
|
|
21
|
-
id: serial('id').primaryKey(),
|
|
22
|
-
name: text('name').notNull(),
|
|
23
|
-
email: text('email'),
|
|
24
|
-
birthdayString: date('birthday_string', { mode: 'string' }),
|
|
25
|
-
birthdayDate: date('birthday_date', { mode: 'date' }),
|
|
26
|
-
createdAt: timestamp('created_at').notNull().defaultNow(),
|
|
27
|
-
role: roleEnum('role'),
|
|
28
|
-
roleText: text('role1', { enum: ['admin', 'user'] }),
|
|
29
|
-
roleText2: text('role2', { enum: ['admin', 'user'] }).default('user'),
|
|
30
|
-
profession: varchar('profession', { length: 20 }),
|
|
31
|
-
initials: char('initials', { length: 2 }),
|
|
32
|
-
isConfirmed: boolean('is_confirmed'),
|
|
33
|
-
vector: vector('vector_column', { dimensions: 5 }),
|
|
34
|
-
geoXy: geometry('geometry_xy', {
|
|
35
|
-
mode: 'xy',
|
|
36
|
-
}),
|
|
37
|
-
geoTuple: geometry('geometry_tuple', {
|
|
38
|
-
mode: 'tuple',
|
|
39
|
-
}),
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const Customers = pgTable('customers', {
|
|
43
|
-
id: serial('id').primaryKey(),
|
|
44
|
-
address: text('address').notNull(),
|
|
45
|
-
isConfirmed: boolean('is_confirmed'),
|
|
46
|
-
registrationDate: timestamp('registration_date').notNull().defaultNow(),
|
|
47
|
-
userId: integer('user_id')
|
|
48
|
-
.references(() => Users.id)
|
|
49
|
-
.notNull(),
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
export const Posts = pgTable('posts', {
|
|
53
|
-
id: serial('id').primaryKey(),
|
|
54
|
-
content: text('content'),
|
|
55
|
-
authorId: integer('author_id'),
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export const usersRelations = relations(Users, ({ one, many }) => ({
|
|
59
|
-
posts: many(Posts),
|
|
60
|
-
customer: one(Customers, {
|
|
61
|
-
fields: [Users.id],
|
|
62
|
-
references: [Customers.userId],
|
|
63
|
-
}),
|
|
64
|
-
}));
|
|
65
|
-
|
|
66
|
-
export const customersRelations = relations(Customers, ({ one, many }) => ({
|
|
67
|
-
user: one(Users, {
|
|
68
|
-
fields: [Customers.userId],
|
|
69
|
-
references: [Users.id],
|
|
70
|
-
}),
|
|
71
|
-
posts: many(Posts),
|
|
72
|
-
}));
|
|
73
|
-
|
|
74
|
-
export const postsRelations = relations(Posts, ({ one }) => ({
|
|
75
|
-
author: one(Users, {
|
|
76
|
-
fields: [Posts.authorId],
|
|
77
|
-
references: [Users.id],
|
|
78
|
-
}),
|
|
79
|
-
customer: one(Customers, {
|
|
80
|
-
fields: [Posts.authorId],
|
|
81
|
-
references: [Customers.userId],
|
|
82
|
-
}),
|
|
83
|
-
}));
|
package/tests/schema/sqlite.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { relations } from 'drizzle-orm';
|
|
2
|
-
import { blob, integer, numeric, real, sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
|
3
|
-
|
|
4
|
-
export const Users = sqliteTable('users', {
|
|
5
|
-
id: integer('id').primaryKey().notNull(),
|
|
6
|
-
name: text('name').notNull(),
|
|
7
|
-
email: text('email'),
|
|
8
|
-
textJson: text('text_json', { mode: 'json' }),
|
|
9
|
-
blobBigInt: blob('blob_bigint', { mode: 'bigint' }),
|
|
10
|
-
numeric: numeric('numeric'),
|
|
11
|
-
createdAt: integer('created_at', { mode: 'timestamp' }),
|
|
12
|
-
createdAtMs: integer('created_at_ms', { mode: 'timestamp_ms' }),
|
|
13
|
-
real: real('real'),
|
|
14
|
-
text: text('text', { length: 255 }),
|
|
15
|
-
role: text('role', { enum: ['admin', 'user'] }).default('user'),
|
|
16
|
-
isConfirmed: integer('is_confirmed', {
|
|
17
|
-
mode: 'boolean',
|
|
18
|
-
}),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export const Customers = sqliteTable('customers', {
|
|
22
|
-
id: integer('id').primaryKey(),
|
|
23
|
-
address: text('address').notNull(),
|
|
24
|
-
isConfirmed: integer('is_confirmed', { mode: 'boolean' }),
|
|
25
|
-
registrationDate: integer('registration_date', { mode: 'timestamp_ms' })
|
|
26
|
-
.notNull()
|
|
27
|
-
.$defaultFn(() => new Date()),
|
|
28
|
-
userId: integer('user_id')
|
|
29
|
-
.references(() => Users.id)
|
|
30
|
-
.notNull(),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export const Posts = sqliteTable('posts', {
|
|
34
|
-
id: integer('id').primaryKey(),
|
|
35
|
-
content: text('content'),
|
|
36
|
-
authorId: integer('author_id'),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export const usersRelations = relations(Users, ({ one, many }) => ({
|
|
40
|
-
posts: many(Posts),
|
|
41
|
-
customer: one(Customers, {
|
|
42
|
-
fields: [Users.id],
|
|
43
|
-
references: [Customers.userId],
|
|
44
|
-
}),
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
export const customersRelations = relations(Customers, ({ one, many }) => ({
|
|
48
|
-
user: one(Users, {
|
|
49
|
-
fields: [Customers.userId],
|
|
50
|
-
references: [Users.id],
|
|
51
|
-
}),
|
|
52
|
-
posts: many(Posts),
|
|
53
|
-
}));
|
|
54
|
-
|
|
55
|
-
export const postsRelations = relations(Posts, ({ one }) => ({
|
|
56
|
-
author: one(Users, {
|
|
57
|
-
fields: [Posts.authorId],
|
|
58
|
-
references: [Users.id],
|
|
59
|
-
}),
|
|
60
|
-
customer: one(Customers, {
|
|
61
|
-
fields: [Posts.authorId],
|
|
62
|
-
references: [Customers.userId],
|
|
63
|
-
}),
|
|
64
|
-
}));
|