-
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
49a1e7b
commit 627d919
Showing
17 changed files
with
166 additions
and
127 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
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,13 @@ | ||
import type { Config } from 'drizzle-kit'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
|
||
export default { | ||
schema: './src/schema/web.ts', | ||
out: './_migration_web', | ||
dialect: 'postgresql', | ||
dbCredentials: { | ||
url: process.env.DATABASE_CONNECTION || 'memory://./pglite', | ||
}, | ||
} satisfies Config; |
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,22 @@ | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
|
||
const scriptsPath = path.resolve(import.meta.url, './scripts'); | ||
|
||
// Copy the *.sql file from _migration_core to scripts core.sql. Overwrite if it exists. Ensure that paths are relative to where this script exists. | ||
const coreMigrationPath = path.resolve(import.meta.url, './_migration_core'); | ||
const coreSql = path.resolve(scriptsPath, './core.sql'); | ||
if (fs.existsSync(coreMigrationPath) && fs.existsSync(scriptsPath)) { | ||
fs.copyFileSync(coreMigrationPath, coreSql); | ||
// Remove the _migration_core directory. | ||
fs.rmdirSync(coreMigrationPath, { recursive: true }); | ||
} | ||
|
||
// Copy the *.sql file from _migration_web to scripts web.sql. Overwrite if it exists. Ensure that paths are relative to where this script exists. | ||
const webMigrationPath = path.resolve(import.meta.url, './_migration_web'); | ||
const webSql = path.resolve(scriptsPath, './web.sql'); | ||
if (fs.existsSync(webMigrationPath) && fs.existsSync(scriptsPath)) { | ||
fs.copyFileSync(webMigrationPath, webSql); | ||
// Remove the _migration_web directory. | ||
fs.rmdirSync(webMigrationPath, { recursive: true }); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CREATE TABLE IF NOT EXISTS "thing" ( | ||
"id" serial PRIMARY KEY NOT NULL, | ||
"name" varchar(255) NOT NULL, | ||
"description" text, | ||
"url" varchar(2083), | ||
"same_as" varchar(2083), | ||
"identifier" varchar(255), | ||
"image" varchar(2083), | ||
"additional_type" varchar(2083), | ||
"alternate_name" varchar(255), | ||
"disambiguating_description" text, | ||
"main_entity_of_page" varchar(2083), | ||
"date_created" timestamp DEFAULT now(), | ||
"date_modified" timestamp DEFAULT now() | ||
); |
Oops, something went wrong.