diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-06-30 04:49:30 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-06-30 04:49:30 +0900 |
| commit | b2cf74e878c3be3a079d83e93a869bffa6ee3387 (patch) | |
| tree | f198aae40a538e18785d5dd5194bac63285d6b4e /src/tools | |
| parent | Add initial migration (diff) | |
| download | sharkey-b2cf74e878c3be3a079d83e93a869bffa6ee3387.tar.gz sharkey-b2cf74e878c3be3a079d83e93a869bffa6ee3387.tar.bz2 sharkey-b2cf74e878c3be3a079d83e93a869bffa6ee3387.zip | |
Create accept-migration.ts
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/accept-migration.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/accept-migration.ts b/src/tools/accept-migration.ts new file mode 100644 index 0000000000..addce86f1f --- /dev/null +++ b/src/tools/accept-migration.ts @@ -0,0 +1,25 @@ +// ex) node built/tools/accept-migration Yo 1000000000001 + +import { createConnection } from 'typeorm'; +import config from '../config'; + +createConnection({ + type: 'postgres', + host: config.db.host, + port: config.db.port, + username: config.db.user, + password: config.db.pass, + database: config.db.db, + extra: config.db.extra, + synchronize: false, + dropSchema: false, +}).then(c => { + c.query(`INSERT INTO migrations(timestamp,name) VALUES (${process.argv[3]}, '${process.argv[2]}${process.argv[3]}');`).then(() => { + console.log('done'); + process.exit(0); + }).catch(e => { + console.log('ERROR:'); + console.log(e); + process.exit(1); + }); +}); |