-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use migration both in tests and in docker compose
- Loading branch information
1 parent
620d09d
commit 932cc1a
Showing
5 changed files
with
51 additions
and
43 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 Bluebird from 'bluebird'; | ||
import fs from 'node:fs'; | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
|
||
export const up = async (db) => { | ||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
const sql = fs.readFileSync(path.join(__dirname, 'init.sql'), 'utf8'); | ||
const queries = sql.split('\n\n'); | ||
await Bluebird.map(queries, query => db.schema.raw(query)); | ||
}; | ||
|
||
export const down = () => {}; |
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,36 @@ | ||
CREATE TABLE IF NOT EXISTS adopted_probes ( | ||
id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY, | ||
user_created CHAR(36), | ||
date_created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
user_updated CHAR(36), | ||
date_updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
userId VARCHAR(255) NOT NULL, | ||
ip VARCHAR(255) NOT NULL, | ||
uuid VARCHAR(255), | ||
lastSyncDate DATE NOT NULL, | ||
isCustomCity TINYINT DEFAULT 0, | ||
tags LONGTEXT, | ||
status VARCHAR(255) NOT NULL, | ||
version VARCHAR(255) NOT NULL, | ||
country VARCHAR(255) NOT NULL, | ||
city VARCHAR(255), | ||
state VARCHAR(255), | ||
latitude FLOAT(10, 5), | ||
longitude FLOAT(10, 5), | ||
asn INTEGER NOT NULL, | ||
network VARCHAR(255) NOT NULL, | ||
countryOfCustomCity VARCHAR(255) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS directus_users ( | ||
id CHAR(36), | ||
github VARCHAR(255) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS directus_notifications ( | ||
id CHAR(10), | ||
recipient CHAR(36), | ||
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
subject VARCHAR(255), | ||
message TEXT | ||
); |
This file was deleted.
Oops, something went wrong.