Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHORE: move from json to sqlite #91

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DB_FILE_NAME=file:songs.db
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ out
notes.txt
playground
.DS_Store
songs.db
35 changes: 35 additions & 0 deletions drizzle/0000_naive_gamora.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
CREATE TABLE `audio` (
`songID` text NOT NULL,
`path` text PRIMARY KEY NOT NULL,
`ctime` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `audio_songID_unique` ON `audio` (`songID`);--> statement-breakpoint
CREATE UNIQUE INDEX `audio_path_unique` ON `audio` (`path`);--> statement-breakpoint
CREATE TABLE `songs` (
`audioPath` text NOT NULL,
`OsuFile` text PRIMARY KEY NOT NULL,
`path` text NOT NULL,
`ctime` integer,
`dateAdded` text NOT NULL,
`title` text NOT NULL,
`artist` text NOT NULL,
`creator` text NOT NULL,
`BPM` text,
`duration` real,
`diffs` text,
`artistUnicode` text NOT NULL,
`titleUnicode` text NOT NULL,
`beatmapSetId` integer NOT NULL,
`mode` integer NOT NULL,
`tags` text,
`bg` text NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `songs_OsuFile_unique` ON `songs` (`OsuFile`);--> statement-breakpoint
CREATE TABLE `test` (
`test` text PRIMARY KEY NOT NULL,
`number` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `test_test_unique` ON `test` (`test`);
11 changes: 11 additions & 0 deletions drizzle/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'dotenv/config'
import { defineConfig } from "drizzle-kit";

export default defineConfig({
dialect: "sqlite",
schema: "./src/main/lib/storage/Schema.ts",
out: "./drizzle",
dbCredentials: {
url: process.env.DB_FILE_NAME!,
}
});
233 changes: 233 additions & 0 deletions drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
{
"version": "6",
"dialect": "sqlite",
"id": "ff9445b7-ad29-4af2-9004-0eca36a2b429",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"audio": {
"name": "audio",
"columns": {
"songID": {
"name": "songID",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"path": {
"name": "path",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"ctime": {
"name": "ctime",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"audio_songID_unique": {
"name": "audio_songID_unique",
"columns": [
"songID"
],
"isUnique": true
},
"audio_path_unique": {
"name": "audio_path_unique",
"columns": [
"path"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"songs": {
"name": "songs",
"columns": {
"audioPath": {
"name": "audioPath",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"OsuFile": {
"name": "OsuFile",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"path": {
"name": "path",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"ctime": {
"name": "ctime",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"dateAdded": {
"name": "dateAdded",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"artist": {
"name": "artist",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"creator": {
"name": "creator",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"BPM": {
"name": "BPM",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"duration": {
"name": "duration",
"type": "real",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"diffs": {
"name": "diffs",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"artistUnicode": {
"name": "artistUnicode",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"titleUnicode": {
"name": "titleUnicode",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"beatmapSetId": {
"name": "beatmapSetId",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"mode": {
"name": "mode",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"tags": {
"name": "tags",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"bg": {
"name": "bg",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"songs_OsuFile_unique": {
"name": "songs_OsuFile_unique",
"columns": [
"OsuFile"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"test": {
"name": "test",
"columns": {
"test": {
"name": "test",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"number": {
"name": "number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"test_test_unique": {
"name": "test_test_unique",
"columns": [
"test"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}
13 changes: 13 additions & 0 deletions drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "sqlite",
"entries": [
{
"idx": 0,
"version": "6",
"when": 1732604465682,
"tag": "0000_naive_gamora",
"breakpoints": true
}
]
}
Loading