16
packages/db/migrations/mysql/0001_fluffy_overlord.sql
Normal file
16
packages/db/migrations/mysql/0001_fluffy_overlord.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE `iconRepository` (
|
||||
`iconRepository_id` varchar(256) NOT NULL,
|
||||
`iconRepository_slug` varchar(150) NOT NULL,
|
||||
CONSTRAINT `iconRepository_iconRepository_id` PRIMARY KEY(`iconRepository_id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `icon` (
|
||||
`icon_id` varchar(256) NOT NULL,
|
||||
`icon_name` varchar(250) NOT NULL,
|
||||
`icon_url` text NOT NULL,
|
||||
`icon_checksum` text NOT NULL,
|
||||
`iconRepository_id` varchar(256) NOT NULL,
|
||||
CONSTRAINT `icon_icon_id` PRIMARY KEY(`icon_id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE `icon` ADD CONSTRAINT `icon_iconRepository_id_iconRepository_iconRepository_id_fk` FOREIGN KEY (`iconRepository_id`) REFERENCES `iconRepository`(`iconRepository_id`) ON DELETE cascade ON UPDATE no action;
|
||||
1150
packages/db/migrations/mysql/meta/0001_snapshot.json
Normal file
1150
packages/db/migrations/mysql/meta/0001_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,13 @@
|
||||
"when": 1714817536714,
|
||||
"tag": "0000_hot_mandrill",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "5",
|
||||
"when": 1714854892785,
|
||||
"tag": "0001_fluffy_overlord",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
13
packages/db/migrations/sqlite/0001_unusual_rage.sql
Normal file
13
packages/db/migrations/sqlite/0001_unusual_rage.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
CREATE TABLE `iconRepository` (
|
||||
`iconRepository_id` text PRIMARY KEY NOT NULL,
|
||||
`iconRepository_slug` text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `icon` (
|
||||
`icon_id` text PRIMARY KEY NOT NULL,
|
||||
`icon_name` text NOT NULL,
|
||||
`icon_url` text NOT NULL,
|
||||
`icon_checksum` text NOT NULL,
|
||||
`iconRepository_id` text NOT NULL,
|
||||
FOREIGN KEY (`iconRepository_id`) REFERENCES `iconRepository`(`iconRepository_id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
1097
packages/db/migrations/sqlite/meta/0001_snapshot.json
Normal file
1097
packages/db/migrations/sqlite/meta/0001_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,13 @@
|
||||
"when": 1714817544524,
|
||||
"tag": "0000_premium_forgotten_one",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "5",
|
||||
"when": 1714854863811,
|
||||
"tag": "0001_unusual_rage",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"migration:run": "tsx ./migrate.ts",
|
||||
"migration:mysql:generate": "drizzle-kit generate:mysql --config ./mysql.config.ts",
|
||||
"push": "drizzle-kit push:sqlite --config ./sqlite.config.ts",
|
||||
"studio": "drizzle-kit studio --config ./sqlite.config.ts",
|
||||
"studio": "drizzle-kit studio",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -285,6 +285,21 @@ export const integrationItems = mysqlTable(
|
||||
}),
|
||||
);
|
||||
|
||||
export const icons = mysqlTable("icon", {
|
||||
id: varchar("icon_id", { length: 256 }).notNull().primaryKey(),
|
||||
name: varchar("icon_name", { length: 250 }).notNull(),
|
||||
url: text("icon_url").notNull(),
|
||||
checksum: text("icon_checksum").notNull(),
|
||||
iconRepositoryId: varchar("iconRepository_id", { length: 256 })
|
||||
.notNull()
|
||||
.references(() => iconRepositories.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const iconRepositories = mysqlTable("iconRepository", {
|
||||
id: varchar("iconRepository_id", { length: 256 }).notNull().primaryKey(),
|
||||
slug: varchar("iconRepository_slug", { length: 150 }).notNull(),
|
||||
});
|
||||
|
||||
export const accountRelations = relations(accounts, ({ one }) => ({
|
||||
user: one(users, {
|
||||
fields: [accounts.userId],
|
||||
@@ -301,6 +316,20 @@ export const userRelations = relations(users, ({ many }) => ({
|
||||
invites: many(invites),
|
||||
}));
|
||||
|
||||
export const iconRelations = relations(icons, ({ one }) => ({
|
||||
repository: one(iconRepositories, {
|
||||
fields: [icons.iconRepositoryId],
|
||||
references: [iconRepositories.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const iconRepositoryRelations = relations(
|
||||
iconRepositories,
|
||||
({ many }) => ({
|
||||
icons: many(icons),
|
||||
}),
|
||||
);
|
||||
|
||||
export const inviteRelations = relations(invites, ({ one }) => ({
|
||||
creator: one(users, {
|
||||
fields: [invites.creatorId],
|
||||
|
||||
@@ -282,6 +282,21 @@ export const integrationItems = sqliteTable(
|
||||
}),
|
||||
);
|
||||
|
||||
export const icons = sqliteTable("icon", {
|
||||
id: text("icon_id").notNull().primaryKey(),
|
||||
name: text("icon_name").notNull(),
|
||||
url: text("icon_url").notNull(),
|
||||
checksum: text("icon_checksum").notNull(),
|
||||
iconRepositoryId: text("iconRepository_id")
|
||||
.notNull()
|
||||
.references(() => iconRepositories.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const iconRepositories = sqliteTable("iconRepository", {
|
||||
id: text("iconRepository_id").notNull().primaryKey(),
|
||||
slug: text("iconRepository_slug").notNull(),
|
||||
});
|
||||
|
||||
export const accountRelations = relations(accounts, ({ one }) => ({
|
||||
user: one(users, {
|
||||
fields: [accounts.userId],
|
||||
@@ -298,6 +313,20 @@ export const userRelations = relations(users, ({ many }) => ({
|
||||
invites: many(invites),
|
||||
}));
|
||||
|
||||
export const iconRelations = relations(icons, ({ one }) => ({
|
||||
repository: one(iconRepositories, {
|
||||
fields: [icons.iconRepositoryId],
|
||||
references: [iconRepositories.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const iconRepositoryRelations = relations(
|
||||
iconRepositories,
|
||||
({ many }) => ({
|
||||
icons: many(icons),
|
||||
}),
|
||||
);
|
||||
|
||||
export const inviteRelations = relations(invites, ({ one }) => ({
|
||||
creator: one(users, {
|
||||
fields: [invites.creatorId],
|
||||
|
||||
Reference in New Issue
Block a user