format and update schema migrations

This commit is contained in:
Pauline 2024-03-20 20:48:45 +01:00
parent e00be5d48b
commit 7349482c20
No known key found for this signature in database
GPG key ID: 722BB181973296AE
13 changed files with 140 additions and 45 deletions

8
.gitignore vendored
View file

@ -1,6 +1,14 @@
# Prisma
crates/prisma/src/prisma.rs
dev.db
dev.db-journal
# Vendor
dist
.eslintcache
.env*
vendor/
# Created by https://www.toptal.com/developers/gitignore/api/node,rust,yarn,linux,macos,windows,rust-analyzer,visualstudiocode,git
# Edit at https://www.toptal.com/developers/gitignore?templates=node,rust,yarn,linux,macos,windows,rust-analyzer,visualstudiocode,git

3
.npmrc
View file

@ -2,3 +2,6 @@
engine-strict=true
; tempfix for pnpm#5909: https://github.com/pnpm/pnpm/issues/5909#issuecomment-1397758156
prefer-symlinked-executables=false
auto-install-peers=true
max-old-space-size=4096
enable-pre-post-scripts=true

View file

@ -6,17 +6,25 @@ members = [
]
[workspace.package]
license = "GPL-3.0-only"
license = "AGPL-3.0-only"
edition = "2021"
repository = "https://github.com/Polyfrost/Nexus"
documentation = "https://docs.polyfrost.org/nexus"
readme = "README.md"
homepage = "https://polyfrost.org"
authors = [ "Polyfrost" ]
[workspace.dependencies]
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = [ "sqlite" ] }
prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = [ "sqlite" ] }
uuid = { version = "1.7.0", features = [ "serde" ] }
uuid = { version = "1.8", features = [ "serde" ] }
serde = { version = "1", features = [ "derive" ] }
serde_json = { version = "1" }
flate2 = { version = "1" }
tar = { version = "0.4" }
zip = { version = "0.6" }
tokio = { version = "1", features = [ "full" ] }
async-trait = { version = "0.1" }
[profile.dev]
# Make compilation faster on macOS

View file

@ -2,8 +2,12 @@
name = "prisma-cli"
version = "0.1.0"
license = { workspace = true }
repository = { workspace = true }
edition = { workspace = true }
repository = { workspace = true }
documentation = { workspace = true }
readme = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
[dependencies]
prisma-client-rust-cli = { workspace = true }

View file

@ -1,7 +1,13 @@
[package]
name = "poly-prisma"
version = "0.1.0"
edition = "2021"
license = { workspace = true }
edition = { workspace = true }
repository = { workspace = true }
documentation = { workspace = true }
readme = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
[dependencies]
prisma-client-rust = { workspace = true }

12
crates/utils/Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "poly-utils"
version = "0.1.0"
license = { workspace = true }
edition = { workspace = true }
repository = { workspace = true }
documentation = { workspace = true }
readme = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
[dependencies]

0
crates/utils/src/lib.rs Normal file
View file

View file

@ -5,4 +5,17 @@ import petal from '@flowr/eslint-config';
export default petal({
typescript: true,
solid: true,
});
gitignore: true,
ignores: [
'**/target',
'**/dist',
'**/types',
'**/cache',
'**/dist',
'**/.temp',
'**/*.svg',
'*.rs',
'pnpm-lock.yaml',
'./src-tauri/prisma/migrations/migration_lock.toml',
],
}, { rules: { 'petal/consistent-list-newline': 'off' } });

View file

@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"start": "vite",
"dev": "vite",
"dev": "pnpm tauri dev",
"build": "vite build",
"serve": "vite preview",
"tauri": "tauri",

View file

@ -2,25 +2,31 @@
name = "polyfrost-launcher"
version = "0.0.0"
description = "A Tauri App"
authors = [ "Polyfrost" ]
edition = "2021"
license = { workspace = true }
edition = { workspace = true }
repository = { workspace = true }
documentation = { workspace = true }
readme = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
[build-dependencies]
tauri-build = { version = "2.0.0-beta", features = [] }
[dependencies]
poly-prisma = { path = "../crates/prisma" }
poly-utils = { path = "../crates/utils" }
tauri = { version = "2.0.0-beta", features = [] }
tauri-plugin-shell = "2.0.0-beta.2"
tauri-plugin-http = "2.0.0-beta"
tokio = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
flate2 = "1.0.28"
tar = "0.4.40"
zip = "0.6.6"
flate2 = { workspace = true }
tar = { workspace = true }
zip = { workspace = true }
uuid = { workspace = true }
async-trait = "0.1.78"
async-trait = { workspace = true }
prisma-client-rust = { workspace = true }
[features]

View file

@ -0,0 +1,32 @@
-- CreateTable
CREATE TABLE "instance" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT,
"path" TEXT,
"hidden" BOOLEAN,
"time_played" DATETIME NOT NULL,
"last_played" DATETIME NOT NULL,
"date_created" DATETIME NOT NULL
);
-- CreateTable
CREATE TABLE "java_instance" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT,
"path" TEXT,
"version" TEXT,
"arch" TEXT,
"instance_id" INTEGER
);
-- CreateTable
CREATE TABLE "location" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT,
"path" TEXT,
"enabled" BOOLEAN NOT NULL DEFAULT true,
"hidden" BOOLEAN,
"date_added" DATETIME,
"instance_id" INTEGER,
CONSTRAINT "location_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instance" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);

View file

@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"

View file

@ -1,60 +1,60 @@
datasource db {
provider = "sqlite"
url = "file:dev.db"
provider = "sqlite"
url = "file:dev.db"
}
generator client {
provider = "cargo prisma"
output = "../../crates/prisma/src/prisma.rs"
provider = "cargo prisma"
output = "../../crates/prisma/src/prisma.rs"
}
// todo: replace all `path` fields with a model with a checksum n shit
// represents a single minecraft instance
model Instance {
id Int @id @default(autoincrement())
name String?
path String?
hidden Boolean?
id Int @id @default(autoincrement())
name String?
path String?
hidden Boolean?
time_played DateTime
last_played DateTime
date_created DateTime
time_played DateTime
last_played DateTime
date_created DateTime
mods Mod[]
// java_instance JavaInstance
mods Mod[]
@@map("instance")
java_instance JavaInstance @relation(fields: [java_instance_id], references: [id])
java_instance_id Int
@@map("instance")
}
model JavaInstance {
id Int @id @default(autoincrement())
name String?
path String?
version String?
arch String?
id Int @id @default(autoincrement())
name String?
path String?
version String?
arch String?
/// @local
instance_id Int?
// instance Instance? @relation(fields: [instance_id], references: [id])
instance Instance[]
@@map("java_instance")
@@map("java_instance")
}
model Mod {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
name String?
path String?
enabled Boolean @default(true)
hidden Boolean?
date_added DateTime?
name String?
path String?
enabled Boolean @default(true)
hidden Boolean?
date_added DateTime?
/// @local
instance_id Int?
instance Instance? @relation(fields: [instance_id], references: [id], onDelete: SetNull)
/// @local
instance_id Int?
instance Instance? @relation(fields: [instance_id], references: [id], onDelete: SetNull)
@@map("location")
@@map("location")
}
// todo the rest of this shit loll