Database schema?
Closed this issue · 3 comments
LINKIWI commented
Is there documentation on how to create the database tables required by Trycode? Currently getting this stack trace when trying to run the application:
> trycode@1.0.0 start /home/kiwi/Downloads/trycode
> node ./dist/run.js
✅ Сервер запущен по адресу: http://localhost:5000
✅ Сокеты запущены!
Unhandled rejection Error: ER_NO_SUCH_TABLE: Table 'trycode.trycode' doesn't exist
at Query.Sequence._packetToError (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
at Query.ErrorPacket (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/sequences/Query.js:83:18)
at Protocol._parsePacket (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/Protocol.js:280:23)
at Parser.write (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/Parser.js:74:12)
at Protocol.write (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/Connection.js:109:28)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at Pipe.onread (net.js:548:20)
--------------------
at Protocol._enqueue (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/Protocol.js:141:48)
at Connection.query (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/Connection.js:214:25)
at /home/kiwi/Downloads/trycode/node_modules/knex/lib/dialects/mysql/index.js:152:18
at Promise._execute (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/debuggability.js:299:9)
at Promise._resolveFromExecutor (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/promise.js:481:18)
at new Promise (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/promise.js:77:14)
at Client_MySQL._query (/home/kiwi/Downloads/trycode/node_modules/knex/lib/dialects/mysql/index.js:146:12)
at Client_MySQL.query (/home/kiwi/Downloads/trycode/node_modules/knex/lib/client.js:189:17)
at Runner.<anonymous> (/home/kiwi/Downloads/trycode/node_modules/knex/lib/runner.js:138:36)
at Runner.tryCatcher (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/util.js:16:23)
at Runner.query (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/method.js:15:34)
at /home/kiwi/Downloads/trycode/node_modules/knex/lib/runner.js:61:21
at tryCatcher (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/util.js:16:23)
at /home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/using.js:185:26
at bound (domain.js:280:14)
at runBound (domain.js:293:12)
Dragomeat commented
Hello! It`s old branch, we are currently working on a new update for this project.
As a workaround you can use:
CREATE TABLE trycode
(
id
int(11) NOT NULL,
cid
varchar(255) NOT NULL,
user_id
int(11) DEFAULT NULL,
mode
varchar(24) NOT NULL,
code
longtext NOT NULL,
viewer
int(1) NOT NULL DEFAULT '0',
autorun
int(1) NOT NULL DEFAULT '0',
created_at
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8
LINKIWI commented
Hi @Dragomeat, thanks for your response! Unfortunately it does not seem like this schema works; I get this error:
> trycode@1.0.0 start /home/kiwi/Downloads/trycode
> node ./dist/run.js
✅ Сервер запущен по адресу: http://localhost:5000
✅ Сокеты запущены!
Unhandled rejection Error: ER_BAD_FIELD_ERROR: Unknown column 'ip' in 'field list'
at Query.Sequence._packetToError (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
at Query.ErrorPacket (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/sequences/Query.js:83:18)
at Protocol._parsePacket (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/Protocol.js:280:23)
at Parser.write (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/Parser.js:74:12)
at Protocol.write (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/Connection.js:109:28)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at Pipe.onread (net.js:548:20)
--------------------
at Protocol._enqueue (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/protocol/Protocol.js:141:48)
at Connection.query (/home/kiwi/Downloads/trycode/node_modules/mysql/lib/Connection.js:214:25)
at /home/kiwi/Downloads/trycode/node_modules/knex/lib/dialects/mysql/index.js:152:18
at Promise._execute (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/debuggability.js:299:9)
at Promise._resolveFromExecutor (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/promise.js:481:18)
at new Promise (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/promise.js:77:14)
at Client_MySQL._query (/home/kiwi/Downloads/trycode/node_modules/knex/lib/dialects/mysql/index.js:146:12)
at Client_MySQL.query (/home/kiwi/Downloads/trycode/node_modules/knex/lib/client.js:189:17)
at Runner.<anonymous> (/home/kiwi/Downloads/trycode/node_modules/knex/lib/runner.js:138:36)
at Runner.tryCatcher (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/util.js:16:23)
at Runner.query (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/method.js:15:34)
at /home/kiwi/Downloads/trycode/node_modules/knex/lib/runner.js:61:21
at tryCatcher (/home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/util.js:16:23)
at /home/kiwi/Downloads/trycode/node_modules/bluebird/js/release/using.js:185:26
at bound (domain.js:280:14)
at runBound (domain.js:293:12)
Archakov06 commented
ALTER TABLE `trycode` ADD `ip` VARCHAR(20) NOT NULL DEFAULT '0';
ALTER TABLE `trycode` ADD `time` int(15) NOT NULL DEFAULT '0';