-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
570e100
commit 7e88088
Showing
17 changed files
with
185 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
# Keep environment variables out of version control | ||
.env | ||
pack/database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default [ | ||
...require('./polyfill/index'), | ||
require('./database/index'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default [ | ||
require('./timeout') | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const webpack = require('webpack'); | ||
|
||
var __polyfillTimeout_timers = {}; | ||
function __polyfillTimeout_generateNewId() { | ||
var r = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); | ||
while (__polyfillTimeout_timers.hasOwnProperty(r)) { // check weather the id already exists | ||
r = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); | ||
} | ||
return r; | ||
} | ||
|
||
|
||
function __polyfillTimeout_check() { | ||
if (Object.keys(__polyfillTimeout_timers).length <= 0) return; | ||
|
||
var t = Date.now(); | ||
for (var timerId in __polyfillTimeout_timers) { | ||
if (__polyfillTimeout_timers.hasOwnProperty(timerId) && t > __polyfillTimeout_timers[timerId].time) { | ||
__polyfillTimeout_timers[timerId].callback(); | ||
clearTimeout(timerId); | ||
} | ||
} | ||
requestIdleCallback(__polyfillTimeout_check); | ||
} | ||
|
||
|
||
function _setTimeout(callback, delay) { | ||
if (typeof(callback) != 'function') throw new Error("callback should be a function"); | ||
if (typeof(delay) != 'number' || delay < 0) throw new Error("delay should be a positive number"); | ||
var newId = __polyfillTimeout_generateNewId(); | ||
__polyfillTimeout_timers[newId] = { | ||
callback: callback, | ||
time: Date.now() + delay | ||
}; | ||
if (Object.keys(__polyfillTimeout_timers).length == 1) { | ||
requestIdleCallback(__polyfillTimeout_check); | ||
} | ||
return newId; | ||
} | ||
|
||
function _clearTimeout(id) { | ||
if (__polyfillTimeout_timers.hasOwnProperty(id)) delete __polyfillTimeout_timers[id]; | ||
} | ||
|
||
export default timeout = new webpack.DefinePlugin({ | ||
__polyfillTimeout_timers, | ||
__polyfillTimeout_generateNewId, | ||
__polyfillTimeout_check, | ||
setTimeout: _setTimeout, | ||
clearTimeout: _clearTimeout, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
48 changes: 48 additions & 0 deletions
48
packages/core/prisma/migrations/20230909231306_refracture/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
-- CreateTable | ||
CREATE TABLE "Track" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"title" TEXT NOT NULL, | ||
"duration" BIGINT NOT NULL, | ||
"track_number" INTEGER NOT NULL, | ||
CONSTRAINT "Track_id_fkey" FOREIGN KEY ("id") REFERENCES "Collection" ("id") ON DELETE RESTRICT ON UPDATE CASCADE | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Artist" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"profile_image" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"biography" TEXT NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"profile_image" TEXT NOT NULL, | ||
"name" TEXT NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Collection" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"title" TEXT NOT NULL, | ||
"art" TEXT, | ||
"year" INTEGER, | ||
"duration" BIGINT NOT NULL, | ||
CONSTRAINT "Collection_id_fkey" FOREIGN KEY ("id") REFERENCES "Artist" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, | ||
CONSTRAINT "Collection_id_fkey" FOREIGN KEY ("id") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "_ArtistToTrack" ( | ||
"A" INTEGER NOT NULL, | ||
"B" INTEGER NOT NULL, | ||
CONSTRAINT "_ArtistToTrack_A_fkey" FOREIGN KEY ("A") REFERENCES "Artist" ("id") ON DELETE CASCADE ON UPDATE CASCADE, | ||
CONSTRAINT "_ArtistToTrack_B_fkey" FOREIGN KEY ("B") REFERENCES "Track" ("id") ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "_ArtistToTrack_AB_unique" ON "_ArtistToTrack"("A", "B"); | ||
|
||
-- CreateIndex | ||
CREATE INDEX "_ArtistToTrack_B_index" ON "_ArtistToTrack"("B"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"esModuleInterop": true, | ||
"target": "ES2020" | ||
"target": "ES2020", | ||
"module": "NodeNext" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export async function webpackDB(pkg_dir: string) { | ||
const migrations: { date: number, sql: string }[] = []; | ||
|
||
const output = | ||
`const webpack = require('webpack'); | ||
export default new webpack.DefinePlugin({ | ||
database_migrations: { | ||
index: [ ${migrations.map(m => m.date).join(', ')} ], | ||
entries: { | ||
${migrations.map(m => ` ${m.date}: \`${m.sql}\`,`).join('\n')} | ||
} | ||
} | ||
})` | ||
} |