-
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.
Merge pull request #77 from koyopro/feature/examples
Update examples
- Loading branch information
Showing
12 changed files
with
330 additions
and
216 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,13 +1,6 @@ | ||
import { initAccelRecord } from "accel-record"; | ||
import { Accel } from "accella"; | ||
import { getDatabaseConfig } from "../models"; | ||
|
||
export const setupDatabase = async () => { | ||
const sqlitePath = Accel.root.child( | ||
"./db/schema/", | ||
import.meta.env.DATABASE_URL.replace("file:", "") | ||
); | ||
await initAccelRecord({ | ||
type: "sqlite", | ||
datasourceUrl: sqlitePath.toString(), | ||
}); | ||
await initAccelRecord(getDatabaseConfig()); | ||
}; |
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,41 @@ | ||
/* eslint-disable */ | ||
/*************************************************************** | ||
* This file is automatically generated. Please do not modify. | ||
***************************************************************/ | ||
|
||
import { type DataSource } from "@prisma/generator-helper"; | ||
|
||
import { | ||
generateDatabaseConfig, | ||
registerModel, | ||
type Collection, | ||
type Filter, | ||
type StringFilter, | ||
} from "accel-record"; | ||
import { Attribute, defineEnumTextAttribute } from "accel-record/enums"; | ||
|
||
declare module "accel-record" { | ||
function meta<T>(model: T): Meta<T>; | ||
|
||
interface Relation<T, M> {} | ||
} | ||
|
||
type Meta<T> = any; | ||
|
||
export const schemaDir = "../../../db"; | ||
export const dataSource = { | ||
name: "db", | ||
provider: "sqlite", | ||
activeProvider: "sqlite", | ||
url: { | ||
fromEnvVar: "DATABASE_URL", | ||
value: null, | ||
}, | ||
schemas: [], | ||
} as DataSource; | ||
|
||
/** | ||
* Retrieves the database connection settings based on the Prisma schema file. | ||
*/ | ||
export const getDatabaseConfig = () => | ||
generateDatabaseConfig(dataSource, import.meta.url, schemaDir); |
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,5 @@ | ||
import { Model } from "accel-record"; | ||
|
||
export class ApplicationRecord extends Model { | ||
// Implement methods | ||
} |
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 @@ | ||
export * from "./_types.js"; |
Oops, something went wrong.